[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18729: [PATCH] subr.el (set-key): New macro making creating new bind
From: |
Stefan Monnier |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> (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