mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Add special lisp indent logic for add-hook
So that inline defun forms are indented like other body forms.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user