GNU bug report logs - #8638
24.0.50; Imenu should not include vacuous defvars

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sun, 8 May 2011 18:16:01 UTC

Severity: minor

Found in version 24.0.50

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 8638 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juanma Barranquero'" <lekktu <at> gmail.com>
Cc: 8638 <at> debbugs.gnu.org
Subject: RE: bug#8638: 24.0.50; Imenu should not include vacuous defvars
Date: Sun, 8 May 2011 12:07:31 -0700
> With lexical binding, (defvar foobar) is used to tell the bytecompiler
> that the variable has dynamic scope.

It's still a vacuous definition.  And any defvar tells the byte compiler that a
variable has dynamic scope, no?

This seems irrelevant to the bug report.  I'd still suggest removing vacuous
defvars from the menu.  Mixing in vacuous entries with entries that really
define variables distracts users.  You want to think that accessing a menu item
will take you to a real variable definition.

If someone wants to provide vacuous defvars in a different submenu from
`Variables' (e.g. `Vacuous Vars') I have no problem with that.  But I don't
really think that's needed.

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.





This bug report was last modified 12 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.