2018-06-15 13:10:00 +02:00
|
|
|
;;; emacs/electric/config.el -*- lexical-binding: t; -*-
|
2017-02-20 20:42:37 -05:00
|
|
|
|
|
|
|
;; Smarter, keyword-based electric-indent
|
|
|
|
|
2018-06-15 12:30:56 +02:00
|
|
|
(defvar-local +electric-indent-words '()
|
|
|
|
"The list of electric words. Typing these will trigger reindentation of the
|
|
|
|
current line.")
|
2017-02-20 20:42:37 -05:00
|
|
|
|
2018-05-25 00:46:11 +02:00
|
|
|
;;
|
|
|
|
(after! electric
|
|
|
|
(setq-default electric-indent-chars '(?\n ?\^?))
|
|
|
|
|
2019-07-23 12:30:47 +02:00
|
|
|
(add-hook 'electric-indent-functions
|
|
|
|
(defun +electric-indent-char-fn (_c)
|
|
|
|
(when (and (eolp) +electric-indent-words)
|
|
|
|
(save-excursion
|
|
|
|
(backward-word)
|
|
|
|
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words))))))))
|