bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8638: 24.0.50; Imenu should not include vacuous defvars


From: Drew Adams
Subject: bug#8638: 24.0.50; Imenu should not include vacuous defvars
Date: Fri, 27 May 2011 09:00:13 -0700

> FWIW, this is what I use in my code (imenu+.el):
> (concat "^\\s-*("
>         (regexp-opt
>           '("defvar" "defconst" "defconstant" "defcustom"
>             "defparameter" "define-symbol-macro") t)
>         "\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)"
>         "\\s-+[^) \t\n]")
> Not perfect, perhaps, but it seems to do the job OK so far.


FWIW, I use this now.
Changed the whitespace match after var name.

(concat "^\\s-*("
        (regexp-opt
          '("defvar" "defconst" "defconstant" "defcustom"
            "defparameter" "define-symbol-macro") t)
        "\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)"
        "\\(\\s-\\|[\n]\\)+" ; \n has char syntax `>', not `-'
        "[^) \t\n]")

\s-+ does not match newlines in Lisp modes (newlines have comment-end syntax),
so I changed \s-+ to \(\s-\|[\n]\)+.  No doubt still not perfect, but seems to
work OK.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]