From 0e833a1d5f93d3028ef1ea133174636b46bc64f1 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sun, 23 Jan 2022 14:12:34 +0100 Subject: Improve scheme-imenu-generic-expression * lisp/progmodes/scheme.el (scheme-imenu-generic-expression): Improve so that we match `define-public' etc (bug#33117). --- lisp/progmodes/scheme.el | 53 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'lisp/progmodes/scheme.el') diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el index 6f47f645e02..592e2d50570 100644 --- a/lisp/progmodes/scheme.el +++ b/lisp/progmodes/scheme.el @@ -115,12 +115,53 @@ (define-abbrev-table 'scheme-mode-abbrev-table ()) (defvar scheme-imenu-generic-expression - '((nil - "^(define\\(?:-\\(?:generic\\(?:-procedure\\)?\\|method\\)\\)?\\s-+(?\\(\\sw+\\)" 1) - ("Types" - "^(define-class\\s-+(?\\(\\sw+\\)" 1) - ("Macros" - "^(\\(defmacro\\|define-macro\\|define-syntax\\)\\s-+(?\\(\\sw+\\)" 2)) + `((nil + ,(rx bol "(define" + (zero-or-one "*") + (zero-or-one "-public") + (one-or-more space) + (zero-or-one "(") + (group (one-or-more (or word (syntax symbol))))) + 1) + ("Methods" + ,(rx bol "(define-" + (or "generic" "method" "accessor") + (one-or-more space) + (zero-or-one "(") + (group (one-or-more (or word (syntax symbol))))) + 1) + ("Classes" + ,(rx bol "(define-class" + (one-or-more space) + (zero-or-one "(") + (group (one-or-more (or word (syntax symbol))))) + 1) + ("Records" + ,(rx bol "(define-record-type" + (zero-or-one "*") + (one-or-more space) + (group (one-or-more (or word (syntax symbol))))) + 1) + ("Conditions" + ,(rx bol "(define-condition-type" + (one-or-more space) + (group (one-or-more (or word (syntax symbol))))) + 1) + ("Modules" + ,(rx bol "(define-module" + (one-or-more space) + (group "(" (one-or-more any) ")")) + 1) + ("Macros" + ,(rx bol "(" + (or (and "defmacro" + (zero-or-one "*") + (zero-or-one "-public")) + "define-macro" "define-syntax" "define-syntax-rule") + (one-or-more space) + (zero-or-one "(") + (group (one-or-more (or word (syntax symbol))))) + 1)) "Imenu generic expression for Scheme mode. See `imenu-generic-expression'.") (defun scheme-mode-variables () -- cgit v1.2.3