Add special lisp indent logic for add-hook
So that inline defun forms are indented like other body forms.
This commit is contained in:
parent
be789caa04
commit
18078dd160
1 changed files with 8 additions and 0 deletions
|
@ -48,6 +48,14 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
;; variable-width indentation is superior in elisp
|
||||
(add-to-list 'doom-detect-indentation-excluded-modes 'emacs-lisp-mode nil #'eq)
|
||||
|
||||
;; Special indentation behavior for `add-hook'; indent like a defun block if
|
||||
;; it contains `defun' forms and like normal otherwise.
|
||||
(defun +emacs-lisp--indent-add-hook-fn (indent-point state)
|
||||
(goto-char indent-point)
|
||||
(when (looking-at-p "\\s-*(defun ")
|
||||
(lisp-indent-defform state indent-point)))
|
||||
(put 'add-hook 'lisp-indent-function #'+emacs-lisp--indent-add-hook-fn)
|
||||
|
||||
(add-hook! 'emacs-lisp-mode-hook
|
||||
#'(outline-minor-mode
|
||||
;; fontificiation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue