From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Wiesner Newsgroups: gmane.emacs.help Subject: Re: Menu on minor mode lighter Date: Thu, 07 Aug 2014 13:11:37 +0200 Message-ID: <12241137.Xj2nKZaNqX@lunaryorn> References: <1941405.TxWBKa76P1@lunaryorn> <87zjfk8iqh.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Trace: ger.gmane.org 1407409950 5838 80.91.229.3 (7 Aug 2014 11:12:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Aug 2014 11:12:30 +0000 (UTC) Cc: Michael Heerdegen To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 07 13:12:25 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XFLcK-0005YP-I8 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Aug 2014 13:12:20 +0200 Original-Received: from localhost ([::1]:45569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFLcJ-0004Oa-W7 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Aug 2014 07:12:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFLc5-0004OQ-P3 for help-gnu-emacs@gnu.org; Thu, 07 Aug 2014 07:12:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFLc1-0005vM-BY for help-gnu-emacs@gnu.org; Thu, 07 Aug 2014 07:12:05 -0400 Original-Received: from vega.uberspace.de ([95.143.172.245]:34175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFLc1-0005vA-2P for help-gnu-emacs@gnu.org; Thu, 07 Aug 2014 07:12:01 -0400 Original-Received: (qmail 20739 invoked from network); 7 Aug 2014 11:11:57 -0000 Original-Received: from localhost (HELO lunaryorn.localnet) (127.0.0.1) by vega.uberspace.de with SMTP; 7 Aug 2014 11:11:57 -0000 User-Agent: KMail/4.13.3 (Linux/3.15.8-1-ARCH; KDE/4.13.3; x86_64; ; ) In-Reply-To: <87zjfk8iqh.fsf@web.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 95.143.172.245 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99114 Archived-At: Am Montag, 4. August 2014, 15:52:38 schrieb Michael Heerdegen: > Sebastian Wiesner 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.