]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve scheme-imenu-generic-expression
authorAlex Kost <alezost@gmail.com>
Sun, 23 Jan 2022 13:12:34 +0000 (14:12 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 23 Jan 2022 13:12:34 +0000 (14:12 +0100)
* lisp/progmodes/scheme.el (scheme-imenu-generic-expression):
Improve so that we match `define-public' etc (bug#33117).

lisp/progmodes/scheme.el

index 6f47f645e020f1227a23ed3d0ccccc9fcb9fcd50..592e2d50570f35235e9997da556f1bb12966dfae 100644 (file)
 (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 ()