emacs-devel
[Top][All Lists]
Advanced

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

RE: patch to imenu.el and lisp-mode.el for better menu in Lisp modes


From: Drew Adams
Subject: RE: patch to imenu.el and lisp-mode.el for better menu in Lisp modes
Date: Sat, 14 Jul 2007 15:54:21 -0700

> > Below are patches to imenu.el and lisp-mode.el. They divide
> > Lisp definitions in the Index imenu into submenus.
>
> Please be careful: only the lisp-mode.el patch does what you say.
> The imenu.el one does something different.
> When you post such suggestions, please don't mix things up that way.

I thought when I posted them that both patches were necessary to provide the
submenus for Lisp. You're right that the imenu.el changes are not needed for
that.

> And clearly distinguish between bug-fixes (which are usually
> non-controversial and might even be installed without any prior
> discussion),

I didn't intend or mention any bug fixes.

Do you mean sorting the submenus prior to splitting instead of afterward? To
be honest, I don't remember why I made that change (I made it in 1999 in my
own code). I tried it both ways just now, and the only difference I can see
is that *Rescan* is placed (correctly, IMO) at the end of the menu with my
version, instead of at the beginning. I don't think that in itself was why I
made that change, but I don't remember the reason, and I can't see any other
difference now. I even compared the change to the vanilla Emacs 20 behavior
just now, but that seems no different from the Emacs 22 behavior in this
respect. Maybe I'm low on caffeine...

Unless someone has an idea why sorting prior to splitting would be
preferable, you can ignore the imenu.el patch.

> new features, and changes to existing defaults (this latter one is usually
> more sensitive so you will probably want to be more careful and make it
> clear that the rest of the suggested changes do not depend on it).

I called attention to the change in default value of `imenu-sort-function'.

Yes, the rest of the changes do not strictly depend on the default value of
`imenu-sort-function'. However, if definitions are classified by type
(submenu), then I think it makes more sense to sort the names.

The change in default value affects more than just Lisp buffers, but I think
it still makes sense for the default behavior to sort index entries. That
might also encourage implementors of `imenu-generic-expression' for other
languages to classify definitions into submenus.

Let me withdraw the imenu.el patch, unless someone sees a good reason to
sort before splitting, and instead propose only that we change the default
value of `imenu-sort-function' from nil (no sorting) to
`imenu--sort-by-name'.

I also think it would be a good idea to add a command to toggle sorting (and
add it to the menu, like *Rescan*), but you can ignore that too.

Another change we might like to make is to the default value of
`emacs-lisp-mode-hook'. Instead of nil, I'd propose
(imenu-add-menubar-index). I'm not sure how many users will look to
customizing the mode hook to find that they can easily have an index menu
that helps them access definitions.

Thanks for making me look at the patches a little closer.






reply via email to

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