mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
tweak(emacs-lisp): imenu: rearrange groups & fix nested cl types
In order to make imenu in elisp buffers more useful: - Sections are given the highest precedence, and should only show lines with more than two semicolons at the start of the line. - Fixes an issue where cl-defstruct blocks with options in its NAME argument were missed by imenu. I.e. with (cl-defstruct (foo ...)), `foo` would not show up in imenu.
This commit is contained in:
@ -259,8 +259,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)
|
||||
("Evil commands" "^\\s-*(evil-define-\\(?:command\\|operator\\|motion\\) +\\(\\_<[^ ()\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)
|
||||
("Major modes" "^\\s-*(define-derived-mode +\\([^ ()\n]+\\)" 1)
|
||||
@ -273,7 +272,8 @@ https://emacs.stackexchange.com/questions/10230/how-to-indent-keywords-aligned"
|
||||
("CLI Command" "^\\s-*(\\(def\\(?:cli\\|alias\\|obsolete\\|autoload\\)! +\\([^\n]+\\)\\)" 1)
|
||||
("Functions" "^\\s-*(\\(?:cl-\\)?def\\(?:un\\|un\\*\\|method\\|generic\\|-memoized!\\) +\\([^ ,)\n]+\\)" 1)
|
||||
("Variables" "^\\s-*(\\(def\\(?:c\\(?:onst\\(?:ant\\)?\\|ustom\\)\\|ine-symbol-macro\\|parameter\\|var\\(?:-local\\)?\\)\\)\\s-+\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2)
|
||||
("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2))))
|
||||
("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?(?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2)
|
||||
("Section" "^[ \t]*;;;+\\**[ \t]+\\([^\n]+\\)" 1))))
|
||||
|
||||
(defun +emacs-lisp--in-package-buffer-p ()
|
||||
(let* ((file-path (buffer-file-name (buffer-base-buffer)))
|
||||
|
Reference in New Issue
Block a user