From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Sebastian Wiesner <swiesner@lunaryorn.com>
Newsgroups: gmane.emacs.help
Subject: Re: Menu on minor mode lighter
Date: Mon, 04 Aug 2014 08:54:15 +0200
Message-ID: <1941405.TxWBKa76P1@lunaryorn>
References: <E23806B9-ED5C-410B-9561-3F068CF65502@lunaryorn.com>
	<020BFB09-E6B9-462F-8C29-882795452C3A@lunaryorn.com>
	<87r40xa228.fsf@web.de>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1407135304 6456 80.91.229.3 (4 Aug 2014 06:55:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 4 Aug 2014 06:55:04 +0000 (UTC)
Cc: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 04 08:54:58 2014
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
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 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1XECAa-0004GX-98
	for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Aug 2014 08:54:56 +0200
Original-Received: from localhost ([::1]:50579 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1XECAX-0005Io-N3
	for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Aug 2014 02:54:53 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54218)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <swiesner@lunaryorn.com>) id 1XECAI-0005IW-Q4
	for help-gnu-emacs@gnu.org; Mon, 04 Aug 2014 02:54:43 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <swiesner@lunaryorn.com>) id 1XECAE-0003vT-Cb
	for help-gnu-emacs@gnu.org; Mon, 04 Aug 2014 02:54:38 -0400
Original-Received: from vega.uberspace.de ([95.143.172.245]:47594)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <swiesner@lunaryorn.com>) id 1XECAE-0003uT-3U
	for help-gnu-emacs@gnu.org; Mon, 04 Aug 2014 02:54:34 -0400
Original-Received: (qmail 9288 invoked from network); 4 Aug 2014 06:54:30 -0000
Original-Received: from localhost (HELO lunaryorn.localnet) (127.0.0.1)
	by vega.uberspace.de with SMTP; 4 Aug 2014 06:54:30 -0000
User-Agent: KMail/4.13.3 (Linux/3.15.7-1-ARCH; KDE/4.13.3; x86_64; ; )
In-Reply-To: <87r40xa228.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 <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=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:99069
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/99069>

Am Sonntag, 3. August 2014, 19:57:35 schrieb Michael Heerdegen:
> Sebastian Wiesner <swiesner@lunaryorn.com> writes:
> > So how do I do that?  How do I =E2=80=9Cdefine a menu for a minor m=
ode=E2=80=9D?
>=20
> As you like, e.g. with "easymenu".  Here is an example of how you cou=
ld
> do it:
>=20
> --8<---------------cut here---------------start------------->8---
> (require 'easymenu)
>=20
> (defvar my-mode-line-menus '()
>   "My alist of menus for the mode-line.")
>=20
> (defun my-add-menu-to-mode-line (mode menu)
>   "Add MENU as mode-line indicator menu for MODE."
>   (unless (assoc mode my-mode-line-menus)
>     (push (cons mode menu)
>           my-mode-line-menus)))
>=20
> (defadvice minor-mode-menu-from-indicator
>            (around add-my-stuff activate)
>   (let* ((mode (lookup-minor-mode-from-indicator (ad-get-arg 0)))
>          (my-menu (cdr (assoc mode my-mode-line-menus))))
>     (if my-menu
>         (popup-menu my-menu)
>       ad-do-it)))
>=20
>=20
> ;; Example: add menu for ispell
>=20
> (my-add-menu-to-mode-line
>  'ispell-minor-mode
>  (easy-menu-create-menu
>   "Ispell"
>   '(["Spell word"   ispell-word]
>     ["Spell buffer" ispell-buffer])))
> --8<---------------cut here---------------end--------------->8---
>=20
> Does that do what you want?

Yes, it looks like it, but I'd rather go without an advice.  This featu=
re=20
isn't intended for my own customization, but rather for a package that =
I=20
maintain (see [1]), and I am under the impression that advices in packa=
ges are=20
really bad style.

Couldn't I just add my own menu to the 'local-map property of the mode =
line=20
lighter text?

[1]: https://github.com/flycheck/flycheck/issues/365