From cccccbb3fd0fb158acded32876aa80781125fb2a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 15 Jun 2018 13:29:25 +0200 Subject: [PATCH] set-electric!: fix & improve error handling --- modules/emacs/electric/autoload.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/emacs/electric/autoload.el b/modules/emacs/electric/autoload.el index 9fd5b4443..18e99a24e 100644 --- a/modules/emacs/electric/autoload.el +++ b/modules/emacs/electric/autoload.el @@ -5,16 +5,18 @@ "Declare :words (list of strings) or :chars (lists of chars) in MODES that trigger electric indentation." (declare (indent 1)) + (unless plist + (signal 'wrong-number-of-arguments + (list '(:char :words) plist))) (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)))) + (dolist (mode (doom-enlist modes)) + (let ((fn (intern (format "+electric-indent--init-%s" mode)))) (fset fn - (lambda () (electric-indent-local-mode +1) + (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)))))) + (add-hook (intern (format "%s-hook" mode)) fn))))) ;; FIXME obsolete :electric ;;;###autoload