Add unset capability to set-electric!
This commit is contained in:
parent
8c5deef5fc
commit
22c145105d
1 changed files with 13 additions and 12 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue