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

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

Re: Menu on minor mode lighter


From: Sebastian Wiesner
Subject: Re: Menu on minor mode lighter
Date: Thu, 07 Aug 2014 13:11:37 +0200
User-agent: KMail/4.13.3 (Linux/3.15.8-1-ARCH; KDE/4.13.3; x86_64; ; )

Am Montag, 4. August 2014, 15:52:38 schrieb Michael Heerdegen:
> Sebastian Wiesner <swiesner@lunaryorn.com> writes:
> > Yes, it looks like it, but I'd rather go without an advice.  This
> > feature isn't intended for my own customization, but rather for a
> > package that I maintain (see [1]), and I am under the impression that
> > advices in packages are really bad style.
> 
> Indeed.
> 
> > Couldn't I just add my own menu to the 'local-map property of the mode
> > line lighter text?
> 
> That could work, but i'm not sure if that would be of better style.  You
> would circumvent built in code and hardcode a certain (generally
> configurable) mouse key.
> 
> > [1]: https://github.com/flycheck/flycheck/issues/365
> 
> I see.  Note that the situation for ispell is similar: It has a menu bar
> menu under Tools, but this menu isn't present in the mode-line, because
> the code doesn't capture that case.
> 
> There's probably no nice solution for your problem.

Turns out that there is.  After careful reading of the Elisp reference and 
"mouse.el", and some experiments, I figured out that it's just a matter of 
defining the menu in a special way.

The top menu bar will only show items that have no special key attached to the 
"[menu-bar]" binding, whereas the minor mode lighter simply shows the entire 
menu in the minor mode map.

Hence, creating a menu with "easy-menu-create-menu", and binding it as "[menu-
bar flycheck]" in the mode map does the job.

https://github.com/flycheck/flycheck/commit/b727e98fcbdfd27f4dc2ebe0777ec888192973d0
 
has the corresponding change, for reference.

Many many thanks for your help.  Without your pointer to "mouse-minor-mode-
menu" and "minor-mode-menu-from-indicator" I'd never have been able to figure 
it out.



reply via email to

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