GNU bug report logs - #55301
Wishlist: Customize should have a way to edit keymaps

Previous Next

Package: emacs;

Reported by: Phil Hudson <phil.hudson <at> iname.com>

Date: Sat, 7 May 2022 14:08:02 UTC

Severity: wishlist

Found in version 27.2

To reply to this bug, email your comments to 55301 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Sat, 07 May 2022 14:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Phil Hudson <phil.hudson <at> iname.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 07 May 2022 14:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.2; RFE: Auto-create defcustom for declared minor mode keymap
Date: Sat, 7 May 2022 15:07:23 +0100
---------
How about if the KEYMAP argument (or the :keymap slot) of
`define-minor-mode', if given, planted a `defcustom' form for the
keymap, thus automagically making each minor mode keymap a
customization option?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Sat, 07 May 2022 15:35:01 GMT) Full text and rfc822 format available.

Message #8 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Phil Hudson <phil.hudson <at> iname.com>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Sat, 07 May 2022 17:34:30 +0200
Phil Hudson <phil.hudson <at> iname.com> writes:

> How about if the KEYMAP argument (or the :keymap slot) of
> `define-minor-mode', if given, planted a `defcustom' form for the
> keymap, thus automagically making each minor mode keymap a
> customization option?

We don't use defcustoms for other mode maps, so I'm not sure why we
should for the ones tied to `define-minor-mode'?  Am I missing
something?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 07 May 2022 15:37:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Sat, 07 May 2022 16:50:02 GMT) Full text and rfc822 format available.

Message #13 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Sat, 7 May 2022 17:49:35 +0100
If nobody sees any benefit from the idea, I imagine the best thing is
to just close this.

On Sat, 7 May 2022 at 16:34, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Phil Hudson <phil.hudson <at> iname.com> writes:
>
> > How about if the KEYMAP argument (or the :keymap slot) of
> > `define-minor-mode', if given, planted a `defcustom' form for the
> > keymap, thus automagically making each minor mode keymap a
> > customization option?
>
> We don't use defcustoms for other mode maps, so I'm not sure why we
> should for the ones tied to `define-minor-mode'?  Am I missing
> something?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Sun, 08 May 2022 11:47:01 GMT) Full text and rfc822 format available.

Message #16 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Phil Hudson <phil.hudson <at> iname.com>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Sun, 08 May 2022 13:46:48 +0200
Phil Hudson <phil.hudson <at> iname.com> writes:

> If nobody sees any benefit from the idea, I imagine the best thing is
> to just close this.

I just don't understand the request -- we don't have a Customize
interface for altering keymaps anyway.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Sun, 08 May 2022 13:49:02 GMT) Full text and rfc822 format available.

Message #19 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Sun, 8 May 2022 14:47:57 +0100
Not a built-in one, no, but it is not difficult to construct a composite
defcustom.  There are plenty of sequence types and a keybinding type to compose
with.

Perhaps Emacs *should* have a standard built-in keymap defcustom type, but that
would be the subject for a separate RFE.

What I am proposing is something along the lines of this: when a mode (major or
minor, it's strictly irrelevant) declares a keymap, part of the processing of
the expansion of the mode definition should include a defcustom enabling the
user to customize that keymap using the Customize UI, rather than (only) by
writing elisp code.  In other words, where foo-mode-map is currently implemented
(I assume) using a defvar, that should change to a defcustom.  That's really all
I'm suggesting: change the defvar (or whatever) to a defcustom.

On Sun, 8 May 2022 at 12:46, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Phil Hudson <phil.hudson <at> iname.com> writes:
>
> > If nobody sees any benefit from the idea, I imagine the best thing is
> > to just close this.
>
> I just don't understand the request -- we don't have a Customize
> interface for altering keymaps anyway.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Mon, 09 May 2022 09:35:02 GMT) Full text and rfc822 format available.

Message #22 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Phil Hudson <phil.hudson <at> iname.com>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Mon, 09 May 2022 11:34:07 +0200
Phil Hudson <phil.hudson <at> iname.com> writes:

> What I am proposing is something along the lines of this: when a mode
> (major or minor, it's strictly irrelevant) declares a keymap, part of
> the processing of the expansion of the mode definition should include
> a defcustom enabling the user to customize that keymap using the
> Customize UI, rather than (only) by writing elisp code.  In other
> words, where foo-mode-map is currently implemented (I assume) using a
> defvar, that should change to a defcustom.  That's really all I'm
> suggesting: change the defvar (or whatever) to a defcustom.

Emacs doesn't have a Customize UI to alter keymaps, so changing defvars
to defcustom isn't currently useful (because there's no :type that
could be used other than `sexp').

It would be possible to create such an UI, of course, but it would work
quite differently than all other Customize widgets.  I don't think
anybody wants to have the entire definitions of keymaps in their .emacs
files -- they want to add a keystroke or remove a keystroke or two, and
that's it.  (And, besides, they want to get new keystrokes that are
added to the maps.)

But it'd be nice to have; sure.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Severity set to 'wishlist' from 'normal' Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 May 2022 09:35:03 GMT) Full text and rfc822 format available.

Changed bug title to 'Wishlist: Customize should have a way to edit keymaps' from '27.2; RFE: Auto-create defcustom for declared minor mode keymap' Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 May 2022 09:36:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Mon, 09 May 2022 09:54:02 GMT) Full text and rfc822 format available.

Message #29 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Mon, 9 May 2022 10:52:58 +0100
How about ":type '(alist :key-type key-sequence :value-type function)"?

On Mon, 9 May 2022 at 10:34, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Phil Hudson <phil.hudson <at> iname.com> writes:
>
> > What I am proposing is something along the lines of this: when a mode
> > (major or minor, it's strictly irrelevant) declares a keymap, part of
> > the processing of the expansion of the mode definition should include
> > a defcustom enabling the user to customize that keymap using the
> > Customize UI, rather than (only) by writing elisp code.  In other
> > words, where foo-mode-map is currently implemented (I assume) using a
> > defvar, that should change to a defcustom.  That's really all I'm
> > suggesting: change the defvar (or whatever) to a defcustom.
>
> Emacs doesn't have a Customize UI to alter keymaps, so changing defvars
> to defcustom isn't currently useful (because there's no :type that
> could be used other than `sexp').
>
> It would be possible to create such an UI, of course, but it would work
> quite differently than all other Customize widgets.  I don't think
> anybody wants to have the entire definitions of keymaps in their .emacs
> files -- they want to add a keystroke or remove a keystroke or two, and
> that's it.  (And, besides, they want to get new keystrokes that are
> added to the maps.)
>
> But it'd be nice to have; sure.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Mon, 09 May 2022 09:55:02 GMT) Full text and rfc822 format available.

Message #32 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Phil Hudson <phil.hudson <at> iname.com>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Mon, 09 May 2022 11:54:36 +0200
Phil Hudson <phil.hudson <at> iname.com> writes:

> How about ":type '(alist :key-type key-sequence :value-type function)"?

Like I said, that wouldn't be very useful, because people don't want the
entire keymap in their .emacs files anyway.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Mon, 09 May 2022 09:56:01 GMT) Full text and rfc822 format available.

Message #35 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Mon, 9 May 2022 10:55:06 +0100
On Mon, 9 May 2022 at 10:34, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> (And, besides, they want to get new keystrokes that are
> added to the maps.)

Customize does support insertion of new elements in its composite
types, of course.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Mon, 09 May 2022 10:03:01 GMT) Full text and rfc822 format available.

Message #38 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Mon, 9 May 2022 11:02:20 +0100
On Mon, 9 May 2022 at 10:54, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Phil Hudson <phil.hudson <at> iname.com> writes:
>
> > How about ":type '(alist :key-type key-sequence :value-type function)"?
>
> Like I said, that wouldn't be very useful, because people don't want the
> entire keymap in their .emacs files anyway.

Isn't that exactly the right place for declarative personal preferences?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Mon, 09 May 2022 13:40:02 GMT) Full text and rfc822 format available.

Message #41 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Phil Hudson <phil.hudson <at> iname.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Mon, 09 May 2022 15:39:01 +0200
>>>>> On Mon, 9 May 2022 11:02:20 +0100, Phil Hudson <phil.hudson <at> iname.com> said:

    Phil> On Mon, 9 May 2022 at 10:54, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
    >> 
    >> Phil Hudson <phil.hudson <at> iname.com> writes:
    >> 
    >> > How about ":type '(alist :key-type key-sequence :value-type function)"?
    >> 
    >> Like I said, that wouldn't be very useful, because people don't want the
    >> entire keymap in their .emacs files anyway.

    Phil> Isn't that exactly the right place for declarative personal preferences?

Yes, but if a keymap were a defcustom, then the whole keymap would be
in your .emacs, and you would not receive any updates if the keymap
definition changed, since that affects the *default* defcustom value.

Now if you wanted to define a defcustom type for changing bindings in an
existing keymap, thatʼs a different proposition (and we already have
define-key, so Iʼm not so sure of the utility).

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Mon, 09 May 2022 15:05:02 GMT) Full text and rfc822 format available.

Message #44 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Mon, 9 May 2022 16:04:26 +0100
On Mon, 9 May 2022 at 14:39, Robert Pluim <rpluim <at> gmail.com> wrote:
>
> >>>>> On Mon, 9 May 2022 11:02:20 +0100, Phil Hudson <phil.hudson <at> iname.com> said:
>
>     Phil> Isn't that exactly the right place for declarative personal preferences?
>
> Yes, but if a keymap were a defcustom, then the whole keymap would be
> in your .emacs, and you would not receive any updates if the keymap
> definition changed, since that affects the *default* defcustom value.

True that, and I had not thought of it, but now that I have, I still
don't see it as necessarily confounding. Doesn't the same objection
(if it is one) apply to *every* defcustom? Is that not the risk that
the user takes when they change any custom option, and the risk that
every dev takes when they introduce a defcustom?

> Now if you wanted to define a defcustom type for changing bindings in an
> existing keymap, thatʼs a different proposition (and we already have
> define-key, so Iʼm not so sure of the utility).

That is exactly what I (think I) want. The utility is admittedly
marginal but perhaps not trivial. It's the difference between a
declarative approach, which I take to be intrinsically more accessible
and intuitive, especially to non-programmers, versus an imperative
one. It's essentially the case for custom options in general.

I suppose my maximalist claim would be that mode-defined keymaps are
self-evidently customize options that have somehow historically been
accidentally overlooked. I'm not entirely convinced myself, though.
Maybe we should just let it sit for a while. There's obviously
something about it that doesn't *feel* right to people with deeper
insight than I have.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Tue, 17 May 2022 16:04:01 GMT) Full text and rfc822 format available.

Message #47 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Tue, 17 May 2022 17:03:07 +0100
So after a week, can I get a clear yes or no on this? Either is fine.

On Mon, 9 May 2022 at 16:04, Phil Hudson <phil.hudson <at> iname.com> wrote:
>
> On Mon, 9 May 2022 at 14:39, Robert Pluim <rpluim <at> gmail.com> wrote:
> >
> > >>>>> On Mon, 9 May 2022 11:02:20 +0100, Phil Hudson <phil.hudson <at> iname.com> said:
> >
> >     Phil> Isn't that exactly the right place for declarative personal preferences?
> >
> > Yes, but if a keymap were a defcustom, then the whole keymap would be
> > in your .emacs, and you would not receive any updates if the keymap
> > definition changed, since that affects the *default* defcustom value.
>
> True that, and I had not thought of it, but now that I have, I still
> don't see it as necessarily confounding. Doesn't the same objection
> (if it is one) apply to *every* defcustom? Is that not the risk that
> the user takes when they change any custom option, and the risk that
> every dev takes when they introduce a defcustom?
>
> > Now if you wanted to define a defcustom type for changing bindings in an
> > existing keymap, thatʼs a different proposition (and we already have
> > define-key, so Iʼm not so sure of the utility).
>
> That is exactly what I (think I) want. The utility is admittedly
> marginal but perhaps not trivial. It's the difference between a
> declarative approach, which I take to be intrinsically more accessible
> and intuitive, especially to non-programmers, versus an imperative
> one. It's essentially the case for custom options in general.
>
> I suppose my maximalist claim would be that mode-defined keymaps are
> self-evidently customize options that have somehow historically been
> accidentally overlooked. I'm not entirely convinced myself, though.
> Maybe we should just let it sit for a while. There's obviously
> something about it that doesn't *feel* right to people with deeper
> insight than I have.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Tue, 17 May 2022 16:14:02 GMT) Full text and rfc822 format available.

Message #50 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Phil Hudson <phil.hudson <at> iname.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Tue, 17 May 2022 18:13:36 +0200
>>>>> On Tue, 17 May 2022 17:03:07 +0100, Phil Hudson <phil.hudson <at> iname.com> said:

    Phil> So after a week, can I get a clear yes or no on this? Either is fine.

You mean using customize for keymaps? Iʼd say 'no', but Iʼm not an
Emacs maintainer.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Tue, 17 May 2022 17:28:02 GMT) Full text and rfc822 format available.

Message #53 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 55301 <at> debbugs.gnu.org, Phil Hudson <phil.hudson <at> iname.com>
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Tue, 17 May 2022 19:27:14 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> You mean using customize for keymaps? Iʼd say 'no', but Iʼm not an
> Emacs maintainer.

Yes, adding a defcustom now for keymaps would be pointless.

But it'd be nice if a defcustom interface for keymaps existed.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Wed, 18 May 2022 07:14:01 GMT) Full text and rfc822 format available.

Message #56 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55301 <at> debbugs.gnu.org, Phil Hudson <phil.hudson <at> iname.com>
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Wed, 18 May 2022 09:13:26 +0200
>>>>> On Tue, 17 May 2022 19:27:14 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:

    Lars> Robert Pluim <rpluim <at> gmail.com> writes:
    >> You mean using customize for keymaps? Iʼd say 'no', but Iʼm not an
    >> Emacs maintainer.

    Lars> Yes, adding a defcustom now for keymaps would be pointless.

    Lars> But it'd be nice if a defcustom interface for keymaps existed.

Something like this?

(defcustom keymap-additions nil
"Alist of bindings to add to keymaps at startup.
Keys are keymap symbols, values are lists of conses, format
(key-binding . command)

Where KEY-BINDING is a kbd format key specification, and COMMAND is an
Emacs command.")

So you could have that be

'((fundamental-mode-map . (("C-a" . mark-whole-buffer)
                           ("C-b" . backward-word)))
  (elisp-mode-map . (("C-a" . mark-defun))))

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Wed, 18 May 2022 11:00:02 GMT) Full text and rfc822 format available.

Message #59 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Wed, 18 May 2022 11:59:12 +0100
On Wed, 18 May 2022 at 08:13, Robert Pluim <rpluim <at> gmail.com> wrote:
>
> >>>>> On Tue, 17 May 2022 19:27:14 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:
>
>     Lars> Robert Pluim <rpluim <at> gmail.com> writes:
>     >> You mean using customize for keymaps? Iʼd say 'no', but Iʼm not an
>     >> Emacs maintainer.
>
>     Lars> Yes, adding a defcustom now for keymaps would be pointless.
>
>     Lars> But it'd be nice if a defcustom interface for keymaps existed.
>
> Something like this?
>
> (defcustom keymap-additions nil
> "Alist of bindings to add to keymaps at startup.
> Keys are keymap symbols, values are lists of conses, format
> (key-binding . command)
>
> Where KEY-BINDING is a kbd format key specification, and COMMAND is an
> Emacs command.")
>
> So you could have that be
>
> '((fundamental-mode-map . (("C-a" . mark-whole-buffer)
>                            ("C-b" . backward-word)))
>   (elisp-mode-map . (("C-a" . mark-defun))))

Exactly. It should include

    :type '(alist :key-type key-sequence :value-type function)

as I suggested 9 days ago in this thread.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Wed, 18 May 2022 11:30:02 GMT) Full text and rfc822 format available.

Message #62 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 55301 <at> debbugs.gnu.org, Phil Hudson <phil.hudson <at> iname.com>
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Wed, 18 May 2022 13:29:11 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

>     Lars> But it'd be nice if a defcustom interface for keymaps existed.
>
> Something like this?
>
> (defcustom keymap-additions nil
> "Alist of bindings to add to keymaps at startup.
> Keys are keymap symbols, values are lists of conses, format
> (key-binding . command)
>
> Where KEY-BINDING is a kbd format key specification, and COMMAND is an
> Emacs command.")
>
> So you could have that be
>
> '((fundamental-mode-map . (("C-a" . mark-whole-buffer)
>                            ("C-b" . backward-word)))
>   (elisp-mode-map . (("C-a" . mark-defun))))

Yes, something like that.  But the major work would be to create a
sensible widget that allows people to customise the keymap in question.
It'd be nice if it displayed a graphical keyboard in a buffer, and you
could click on keys to specify what they should output.  😀

Or something simpler, for instance a widget where you ask the user to
enter a chord/key stroke, and then prompt what command to bind that to.
Or...  something else.  Many possibilities here.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Wed, 18 May 2022 13:40:02 GMT) Full text and rfc822 format available.

Message #65 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Phil Hudson <phil.hudson <at> iname.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Robert Pluim <rpluim <at> gmail.com>, 55301 <at> debbugs.gnu.org
Subject: Re: bug#55301: 27.2; RFE: Auto-create defcustom for declared minor
 mode keymap
Date: Wed, 18 May 2022 14:39:17 +0100
On Wed, 18 May 2022 at 12:29, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Yes, something like that.  But the major work would be to create a
> sensible widget that allows people to customise the keymap in question.
> It'd be nice if it displayed a graphical keyboard in a buffer, and you
> could click on keys to specify what they should output.  😀
>
> Or something simpler, for instance a widget where you ask the user to
> enter a chord/key stroke, and then prompt what command to bind that to.
> Or...  something else.  Many possibilities here.

What excellent ideas!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55301; Package emacs. (Fri, 20 May 2022 22:33:01 GMT) Full text and rfc822 format available.

Message #68 received at 55301 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: rpluim <at> gmail.com, 55301 <at> debbugs.gnu.org, phil.hudson <at> iname.com
Subject: Re: bug#55301: 27.2;
 RFE: Auto-create defcustom for declared minor mode keymap
Date: Fri, 20 May 2022 18:32:08 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Yes, something like that.  But the major work would be to create a
  > sensible widget that allows people to customise the keymap in question.
  > It'd be nice if it displayed a graphical keyboard in a buffer, and you
  > could click on keys to specify what they should output.  😀

  > Or something simpler, for instance a widget where you ask the user to
  > enter a chord/key stroke, and then prompt what command to bind that to.
  > Or...  something else.  Many possibilities here.

I like this idea too.
-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 19 Jun 2022 12:27:02 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.