;;; emacs/electric/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))
  (unless plist
    (signal 'wrong-number-of-arguments
            (list '(:char :words) plist)))
  (cl-destructuring-bind (&key chars words) plist
    (dolist (mode (doom-enlist modes))
      (let ((fn (intern (format "+electric|init-%s" mode))))
        (fset fn
              (lambda ()
                (electric-indent-local-mode +1)
                (if chars (setq electric-indent-chars chars))
                (if words (setq +electric-indent-words words))))
        (add-hook (intern (format "%s-hook" mode)) fn)))))

;; FIXME obsolete :electric
;;;###autoload
(def-setting! :electric (modes &rest plist)
  :obsolete set-electric!
  `(set-electric! ,modes ,@plist))

;;; emacs/electric/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))
  (dolist (mode (doom-enlist modes))
    (let ((hook (intern (format "%s-hook" mode)))
          (fn   (intern (format "+electric|init-%s" mode))))
      (cond ((null (car-safe plist))
             (remove-hook hook fn)
             (unintern fn nil))
            ((fset fn
                   (lambda ()
                     (cl-destructuring-bind (&key chars words) plist
                       (electric-indent-local-mode +1)
                       (if chars (setq electric-indent-chars chars))
                       (if words (setq +electric-indent-words words)))))
             (add-hook hook fn))))))

;; FIXME obsolete :electric
;;;###autoload
(def-setting! :electric (modes &rest plist)
  :obsolete set-electric!
  `(set-electric! ,modes ,@plist))

Add unset capability to set-electric!
Add unset capability to set-electric!

hlissner/.emacs.d,hlissner/doom-emacs,hlissner/.emacs.d,hlissner/doom-emacs,hlissner/doom-emacs,hlissner/.emacs.d,UndeadKernel/emacs_doom,hlissner/.emacs.d,UndeadKernel/emacs_doom,hlissner/.emacs.d,hlissner/.emacs.d,UndeadKernel/emacs_doom,hlissner/.emacs.d,UndeadKernel/emacs_doom,UndeadKernel/emacs_doom,hlissner/doom-emacs,hlissner/doom-emacs,hlissner/doom-emacs,hlissner/doom-emacs,hlissner/.emacs.d,UndeadKernel/emacs_doom,UndeadKernel/emacs_doom