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: Thu, 16 Oct 2014 10:50:45 -0400	[thread overview]
Message-ID: <jwvppdsrscx.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <xa1tk340gpeb.fsf@mina86.com> (Michal Nazarewicz's message of "Thu, 16 Oct 2014 14:39:08 +0200")

> (I would still argue :args syntax is also convenient though).

The :args syntax has the problem that it can only be explained/defined
by explaining how args work for functions and how `interactive' works,
so from a conceptual point of view (say, explaining to someone who doesn't
know Elisp yet) it's not really simpler than the full (lambda
...) form.  IOW the only gain is a few characters.

>> (define-key MAP KEY '(dired "foo"))
[...]
> Thing I'm worried about here is that the function will not get
> byte-compiled, whereas with set-key macro it will.  Also, I'm not
> entirely sure whether the function should use lexical-binding.

Indeed, that's incompatible with lexical-binding.
As you know, I find this to be a *major* downer.  But the only
alternative would be to define a new macro (like you've done), which
implies a larger change, and added complexity: since we're not
going to deprecate define-key, it means we'd simply have yet another
slightly different way to define key bindings.  I already dislike
global-set-key and local-set-key, FWIW.

I think if we want to make it easier for users to customize
key-bindings, we should take a step back and look at the
larger picture, trying to see exactly what it is that's hard.

Maybe then we'll get a need for something that's substantially different
from define-key (and in which your ideas can then easily be integrated).

I'm thinking of things like tweaking key-bindings via Customize, and/or
being able to specify keybindings for specific major modes (without
needing to go through add-hook or eval-after-load), ...


        Stefan





  reply	other threads:[~2014-10-16 14:50 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
2014-10-16 12:39   ` Michal Nazarewicz
2014-10-16 14:50     ` Stefan Monnier [this message]
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=jwvppdsrscx.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).