doomemacs/modules/emacs/electric-indent/config.el
Henrik Lissner 9f0ebe42e8
Replace :electric with set-electric-rules!
And general refactor of the emacs/electric-indent module.

Also updates (set! :electric ...) references in various :lang modules
2018-06-15 13:32:07 +02:00

19 lines
599 B
EmacsLisp

;;; emacs/electric-indent/config.el -*- lexical-binding: t; -*-
;; Smarter, keyword-based electric-indent
(defvar-local +electric-indent-words '()
"The list of electric words. Typing these will trigger reindentation of the
current line.")
;;
(after! electric
(setq-default electric-indent-chars '(?\n ?\^?))
(defun +electric-indent|char (_c)
(when (and (eolp) +electric-indent-words)
(save-excursion
(backward-word)
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words))))))
(add-to-list 'electric-indent-functions #'+electric-indent|char nil #'eq))