all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Commands with more than one keybinding in menus
Date: Wed, 14 Aug 2013 12:23:12 -0400	[thread overview]
Message-ID: <jwvfvucb65t.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.3205.1376494881.12400.help-gnu-emacs@gnu.org

> The macro was offered by a user of outshine, I only fiddled around with
> it until it worked without errors. It serves its purpose, because
> without it a minor-mode, unconditionally defining 'M-[S-]<arrow-key>'
> bindings, runs a high risk of breaking major-mode or user settings - I
> would not want to do without it.

There are a few ways to have your cake and eat it too:
- Move the conditional test into the command, so the menu entries are
  bound to the same command as the keys.  If you want the menu-entries
  to skip the test, then you can do that by checking the event(s) that
  triggered the command.
- You can use ":keys STRING" in the menu.  This will show "STRING" as
  the shortcut without checking if it indeed runs the same command.
- You can use dynamic key-bindings, i.e. instead of binding your key to
  (lambda () (interactive) (if foo (CMD))), bind it to
  (menu-item "" CMD :filter (lambda (cmd) (if foo cmd))).


        Stefan


  parent reply	other threads:[~2013-08-14 16:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3104.1376386441.12400.help-gnu-emacs@gnu.org>
2013-08-13 14:57 ` Commands with more than one keybinding in menus Stefan Monnier
2013-08-13 21:13   ` Thorsten Jolitz
2013-08-14 12:36     ` Michael Heerdegen
2013-08-14 13:25       ` Thorsten Jolitz
     [not found]       ` <mailman.3200.1376486779.12400.help-gnu-emacs@gnu.org>
2013-08-14 14:12         ` Stefan Monnier
2013-08-14 15:40           ` Thorsten Jolitz
     [not found]           ` <mailman.3205.1376494881.12400.help-gnu-emacs@gnu.org>
2013-08-14 16:23             ` Stefan Monnier [this message]
2013-08-14 16:55               ` Thorsten Jolitz
     [not found]   ` <mailman.3163.1376428457.12400.help-gnu-emacs@gnu.org>
2013-08-14 14:09     ` Stefan Monnier
2013-08-13  9:33 Thorsten Jolitz
2013-08-13 13:48 ` Michael Heerdegen
2013-08-13 14:52   ` Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvfvucb65t.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.