mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Add unset capability to set-electric!
This commit is contained in:
@ -5,18 +5,19 @@
|
|||||||
"Declare :words (list of strings) or :chars (lists of chars) in MODES that
|
"Declare :words (list of strings) or :chars (lists of chars) in MODES that
|
||||||
trigger electric indentation."
|
trigger electric indentation."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
(unless plist
|
(dolist (mode (doom-enlist modes))
|
||||||
(signal 'wrong-number-of-arguments
|
(let ((hook (intern (format "%s-hook" mode)))
|
||||||
(list '(:char :words) plist)))
|
(fn (intern (format "+electric|init-%s" mode))))
|
||||||
(cl-destructuring-bind (&key chars words) plist
|
(cond ((null (car-safe plist))
|
||||||
(dolist (mode (doom-enlist modes))
|
(remove-hook hook fn)
|
||||||
(let ((fn (intern (format "+electric|init-%s" mode))))
|
(unintern fn nil))
|
||||||
(fset fn
|
((fset fn
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(electric-indent-local-mode +1)
|
(cl-destructuring-bind (&key chars words) plist
|
||||||
(if chars (setq electric-indent-chars chars))
|
(electric-indent-local-mode +1)
|
||||||
(if words (setq +electric-indent-words words))))
|
(if chars (setq electric-indent-chars chars))
|
||||||
(add-hook (intern (format "%s-hook" mode)) fn)))))
|
(if words (setq +electric-indent-words words)))))
|
||||||
|
(add-hook hook fn))))))
|
||||||
|
|
||||||
;; FIXME obsolete :electric
|
;; FIXME obsolete :electric
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
Reference in New Issue
Block a user