Subject: Re: bug#57000: Wrong entry "c-mode" in definition prefix for semantic

From: Stefan Kangas <[email-masked]>
Date: Fri, 5 Aug 2022 12:51:55 +0200

Stefan Kangas <[email-masked]> writes:

> I see in loaddefs.el:
>
>     (register-definition-prefixes "semantic/bovine/c" '("c-mode" "semantic"))
>
> I think "c-mode" shouldn't be there, but I can't seem to figure out why
> it is.

This is caused by

    defcustom-mode-local-semantic-dependency-system-include-path

One possible fix below, but I'm not sure we want to do this generally:

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index afba9f8fbc..8aa17be765 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -68,6 +68,7 @@ autoload-ignored-definitions
     "define-short-documentation-group"
     "def-edebug-elem-spec"
     "defvar-mode-local"
+    "defcustom-mode-local-semantic-dependency-system-include-path"
     "define-ibuffer-column"
     "define-ibuffer-sorter")
   "List of strings naming definitions to ignore for prefixes.
@@ -456,7 +457,7 @@ loaddefs-generate--compute-prefixes
   (let ((prefs nil))
     ;; Avoid (defvar <foo>) by requiring a trailing space.
     (while (re-search-forward
-            "^(\\(def[^ \t]+\\)[ \t]+['(]*\\([^' ()\"\n]+\\)[\n \t]" nil t)
+            "^(\\(def[^ \t\n]+\\)[ \t\n]+['(]*\\([^' ()\"\n]+\\)[\n \t]" nil t)
       (unless (member (match-string 1) autoload-ignored-definitions)
         (let ((name (match-string-no-properties 2)))
           (when (save-excursion