Move emacs/electric-indent to emacs/electric
This module will later be expanded to customize more of electric's functionality.
This commit is contained in:
parent
715167bec8
commit
c22b3da9f9
3 changed files with 4 additions and 3 deletions
19
modules/emacs/electric/config.el
Normal file
19
modules/emacs/electric/config.el
Normal file
|
@ -0,0 +1,19 @@
|
|||
;;; emacs/electric/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))
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue