unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "14084@debbugs.gnu.org" <14084@debbugs.gnu.org>
Subject: bug#14084: 24.3.50; `substitute-command-keys': allow for expansion of <remap>...
Date: Tue, 10 May 2022 15:30:47 +0000	[thread overview]
Message-ID: <SJ0PR10MB548869709F38920B24DE05AAF3C99@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87y1z9h6nh.fsf@gnus.org>

> This information is displayed in different ways in different contexts.
> With this test case:
> 
> (keymap-local-set "C-c c" #'foo)
> (keymap-local-set "<remap> <foo>" #'bar)
> 
> (defun foo ()
>   (interactive)
>   "Call with \\[foo]."
>   (message "foo"))
> 
> (defun bar ()
>   (interactive)
>   "Call with \\[foo]."
>   (message "bar"))
> 
> C-h b (for instance) says
> 
> <remap> <foo>	bar
> C-c c		foo
> 
> while C-h f foo RET says
> 
> Its keys are remapped to ‘bar’.  Without this remapping, it would be
> bound to C-c c.
> 
> I think the `C-h b' output could perhaps be reorganised, because bar
> and
> foo frequently are displayed far apart, so the person looking for the
> key for bar would have to look around.
> 
> We could, for instance, add an extra line here.
> 
> But did you have other contexts in mind?

1. Please reread the bug report.  It's specific about
   what behavior is requested - see below.

2. Please don't reply here using `keymap-*'.  If you
   want to communicate with me about key bindings,
   please use the standard, traditional functions.
   I don't have, and cannot use, Emacs 28, 29 etc.
   The bug/request was reported for Emacs 24.  It's
   still relevant, I believe.

Specific request, from the bug report - just please
modify `substitute-command' to add another arg that
provides for the behavior cited:

___
Please add an optional arg to `substitute-command-keys' that
changes the behavior.  Please allow for these 3 possibilities:
 
1. Follow the current behavior (it could be the default):
show only the <remap> entry.
 
2. Show instead a key binding entry for each actual-key binding caused
by the remapping.  IOW, expand <remap> into one or more actual-key
bindings.  Handle remap of remap the same way.  IOW, the output would
not show any <remap> entries, but would show only their expansions.
 
3. Show both the <remap> entries and their expansions, i.e., #1 + #2.
 
4. Alternatively, the <remap> entries could be links/buttons that when
followed expand to actual-key bindings (in place, within the same
overall list of bindings).  One difference (advantage & disadvantage)
with this approach would be the order of the keys in the buffer.
 
Note that with the introduction of things like <remap> we are now
farther afield from the claimed behavior (and the intention) of
`substitute-command-keys':
 
  \[COMMAND] is replaced by either a keystroke sequence that
  invokes COMMAND, or "M-x COMMAND"
 
<remap>... is technically a "keystroke sequence" in one sense (it is a
key binding, at least), but in another sense it is not what the user
expects.  When <remap> was added we more or less just punted wrt
`substitute-command-keys' - we didn't really finish the job.


  reply	other threads:[~2022-05-10 15:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29  5:17 bug#14084: 24.3.50; `substitute-command-keys': allow for expansion of <remap> Drew Adams
2022-05-10 13:13 ` Lars Ingebrigtsen
2022-05-10 15:30   ` Drew Adams [this message]
2022-05-10 15:50     ` Lars Ingebrigtsen
2022-05-10 16:03       ` Drew Adams
2022-05-10 16:06         ` Lars Ingebrigtsen
2022-05-10 16:28           ` Drew Adams
2022-06-09 14:41   ` Lars Ingebrigtsen
2022-06-09 15:36     ` Drew Adams

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=SJ0PR10MB548869709F38920B24DE05AAF3C99@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=14084@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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).