[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keymap initialization

From: Stefan Monnier
Subject: Re: Keymap initialization
Date: Mon, 26 Jun 2017 16:27:04 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>> C-M-x on the (defvar foo-map ...) takes care of it as well.  Or using
>> `defconst` instead of `defvar` would do the trick also (although that's
>> also less idiomatic).  Or write a new M-x reload-file which causes all
>> the defvars to be re-evaluated.
> Workarounds, every one.

Like your solution.  As I said, they all have advantages and disadvantages.

E.g. your solution will override some ~/.emacs changes to the cc-mode
map when reloading the file.  And it will fail to remove old bindings
when you change your code (e.g. when you move a binding from one key to
another or when you remove a binding altogether).  It has various other
additional failure modes.

> Why do you think things should be standardised?  (Not a rhetorical
> question)

It's important for the core Emacs maintainers so they can fix things
without having to decypher all the idiosyncrasies of all packages.

It's important for the end user who uses various major modes (which I'd
expect to be a large fraction of Emacs users) and will benefit from
fewer surprises due to gratuitous subtle differences between the
different major modes.

Also, standardization is generally a necessary first step before being
able to consolidate.  Consolidation in turn means that all major modes
will get more features out of the box with less work on the coder's part.

What benefit do you see in CC-mode being non-standard?

>> IOW, rather than make CC-mode yet-a-bit-more different from the rest of
>> Emacs, I wish you would try to find a way to solve your problem globally.
>> If this annoyance affects you, there's a good chance it affects many
>> other developers, so finding a general solution would be a lot better.
> That seems to presume that the way things are already done in Emacs is
> at or near some optimum, and deviating from that way is therefore
> sub-optimal.

Actually, if you read carefully, nowhere did I say that the current
idiomatic way is in itself better.  I'm OK with changing the standard to
fix problems with it.  What I object to is having a single package
(e.g. CC-mode) stray from the currently followed standard for reasons
unrelated to the specificities of this package.

IOW I would object less strenuously to a patch which applies the same
change to all of Emacs's major modes.

> I don't think there's any evidence for this.  I see some "standard"
> ways of doing things in Emacs which I don't think are good.

I often see that as well.  My reaction is to try and change that in
a way which works for everyone.
Your reaction instead seems to be "oh screw them, I'll do it my way".

> Setting key map entries at load time could be a general solution to that
> particular annoyance.  People, having seen it in CC Mode, will be able
> to adapt it for their own modes, should they see fit.

That could be an OK argument in theory, but this approach has been used
for many years in many packages and did not prove superior (nor
significantly worse, indeed).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]