feat(emacs-lisp,lispy): recognize ;;* outline headings

Permit `;;* ...` be recognized by imenu and outline-minor-mode (and
outline's commands). This also patches Lispy to reflect this new
configuration (if :lang emacs-lisp is active).

Close: #6732
Co-authored-by: LemonBreezes <LemonBreezes@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2022-10-28 02:44:27 +02:00
parent 6887998c23
commit a0ccb6b95b
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 19 additions and 4 deletions

View file

@ -28,6 +28,12 @@ to a pop up buffer."
(kill-buffer buffer))))
(current-buffer)))
;;;###autoload
(defun +emacs-lisp-outline-level ()
"Return outline level for comment at point.
Intended to replace `lisp-outline-level'."
(- (match-end 1) (match-beginning 1)))
;;
;;; Handlers
@ -232,7 +238,7 @@ https://emacs.stackexchange.com/questions/10230/how-to-indent-keywords-aligned"
(defun +emacs-lisp-extend-imenu-h ()
"Improve imenu support in `emacs-lisp-mode' for Doom's APIs."
(setq imenu-generic-expression
`(("Section" "^[ \t]*;;;;*[ \t]+\\([^\n]+\\)" 1)
`(("Section" "^[ \t]*;;;*\\**[ \t]+\\([^\n]+\\)" 1)
("Evil commands" "^\\s-*(evil-define-\\(?:command\\|operator\\|motion\\) +\\(\\_<[^ ()\n]+\\_>\\)" 1)
("Unit tests" "^\\s-*(\\(?:ert-deftest\\|describe\\) +\"\\([^\")]+\\)\"" 1)
("Package" "^\\s-*\\(?:;;;###package\\|(\\(?:package!\\|use-package!?\\|after!\\)\\) +\\(\\_<[^ ()\n]+\\_>\\)" 1)