unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: 18729@debbugs.gnu.org
Subject: bug#18729: [PATCH] subr.el (set-key): New macro making creating new bindings more concise.
Date: Wed, 15 Oct 2014 10:20:33 -0400	[thread overview]
Message-ID: <jwvwq811l3c.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <xa1tiojln57i.fsf@mina86.com> (Michal Nazarewicz's message of "Wed, 15 Oct 2014 09:48:49 +0200")

> +(defmacro set-key (keymap key &rest def)

I'm not convinced the added complexity is worth the trouble, I'm afraid.
I don't see a real benefit in

   (set-key :global KEY CMD)
   (set-key :local KEY CMD)
   (set-key MAP KEY CMD)

over

   (global-set-key KEY CMD)
   (local-set-key KEY CMD)
   (define-key MAP KEY CMD)
or
   (define-key global-map KEY CMD)
   (define-key (current-local-map) KEY CMD)
   (define-key MAP KEY CMD)

I also don't see the benefit of (:args ARGS INTERACTIVE . BODY)
over (lambda ARGS (interactive INTERACTIVE) . BODY).

The only thing I think is really valuable is things like

   (set-key ... KEY (dired "foo"))

For which there is also a precedent in easy-define-menu (where the CMD
can be either a symbol or an expression, in which case that expression
gets wrapped in (lambda () (interactive) ...)).

Maybe we could simply extend define-key to accept

   (define-key MAP KEY '(dired "foo"))


-- Stefan





  reply	other threads:[~2014-10-15 14:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-15  7:48 bug#18729: [PATCH] subr.el (set-key): New macro making creating new bindings more concise Michal Nazarewicz
2014-10-15 14:20 ` Stefan Monnier [this message]
2014-10-16 12:39   ` Michal Nazarewicz
2014-10-16 14:50     ` Stefan Monnier
2014-10-27 17:52       ` Michal Nazarewicz
2015-01-19 15:40 ` Michal Nazarewicz

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvwq811l3c.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=18729@debbugs.gnu.org \
    --cc=mina86@mina86.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).