Replace :electric with set-electric-rules!
And general refactor of the emacs/electric-indent module. Also updates (set! :electric ...) references in various :lang modules
This commit is contained in:
parent
f801939ce7
commit
9f0ebe42e8
9 changed files with 39 additions and 33 deletions
25
modules/emacs/electric-indent/autoload.el
Normal file
25
modules/emacs/electric-indent/autoload.el
Normal file
|
@ -0,0 +1,25 @@
|
|||
;;; emacs/electric-indent/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autodef
|
||||
(defun set-electric! (modes &rest plist)
|
||||
"Declare :words (list of strings) or :chars (lists of chars) in MODES that
|
||||
trigger electric indentation."
|
||||
(declare (indent 1))
|
||||
(cl-destructuring-bind (&key char words) plist
|
||||
(when (or chars words)
|
||||
(let* ((name (mapconcat #'symbol-name modes "-"))
|
||||
(fn (intern (format "+electric-indent--init-%s" name))))
|
||||
(fset fn
|
||||
(lambda () (electric-indent-local-mode +1)
|
||||
(if chars (setq electric-indent-chars chars))
|
||||
(if words (setq +electric-indent-words words))))
|
||||
(dolist (mode modes)
|
||||
(add-hook (intern (format "%s-hook" mode)) fn-name))))))
|
||||
|
||||
;; FIXME obsolete :electric
|
||||
;;;###autoload
|
||||
(def-setting! :electric (modes &rest plist)
|
||||
"Declare :words (list of strings) or :chars (lists of chars) in MODES that
|
||||
trigger electric indentation."
|
||||
:obsolete set-electric!
|
||||
`(set-electric! ,modes ,@plist))
|
Loading…
Add table
Add a link
Reference in a new issue