From 88978c39ac6076ac912ba6d95b61d3c50f1d422a Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 22 Mar 2023 18:13:05 -0700 Subject: fix setting lisp-imenu-generic-expression on Emacs 28 --- .emacs.d/init.el | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index eb8959f7..827fd8f8 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -4387,24 +4387,27 @@ mutt's review view, after exiting EDITOR." ;; because a basic expression to find custom defining forms will also find ;; everything that the default value finds, and indeed merge them into the top ;; level of the menu, anyway. -(when (get 'lisp-mode-symbol 'rx-definition) ; for Emacs 28 - (setq lisp-imenu-generic-expression - (rx-let ((spc (in blank ?\n)) - (sym (| word (syntax symbol)))) - `((nil ,(rx bol (0+ blank) ?\( (opt "spw/") (opt "cl-") "def" - (| (1+ word) - (: "ine-" - ;; Require symbol constituents next, but we don't - ;; want to index calls to `define-key' ... - ;; There is also `define-abbrev'. - (| (: (in "a-jl-z0-9-") (0+ sym)) - (: ?k (opt (in "a-df-z0-9-") (0+ sym))) - (: "ke" (opt (in "a-xz0-9-") (0+ sym))) - (: "key" (1+ sym))))) - (1+ spc) (opt ?') (group lisp-mode-symbol) - ;; Exclude declarations like (defvar FOO) in Elisp. - (1+ spc) (not ?\))) - 1))))) +(setq lisp-imenu-generic-expression + (rx-let ((spc (in blank ?\n)) + (sym (| word (syntax symbol))) + ;; For Emacs 28. + (lisp-mode-symbol (+ (| (syntax word) + (syntax symbol) + (: "\\" nonl))))) + `((nil ,(rx bol (0+ blank) ?\( (opt "spw/") (opt "cl-") "def" + (| (1+ word) + (: "ine-" + ;; Require symbol constituents next, but we don't + ;; want to index calls to `define-key' ... + ;; There is also `define-abbrev'. + (| (: (in "a-jl-z0-9-") (0+ sym)) + (: ?k (opt (in "a-df-z0-9-") (0+ sym))) + (: "ke" (opt (in "a-xz0-9-") (0+ sym))) + (: "key" (1+ sym))))) + (1+ spc) (opt ?') (group lisp-mode-symbol) + ;; Exclude declarations like (defvar FOO) in Elisp. + (1+ spc) (not ?\))) + 1)))) (defun spw/consfig-indentation-hints () (put 'spwcrontab 'common-lisp-indent-function '1) -- cgit v1.2.3