GNU bug report logs - #34080
27.0.50, 26.1; undocumented key bindings for *vc-diff*

Previous Next

Package: emacs;

Reported by: Van L <van <at> scratch.space>

Date: Tue, 15 Jan 2019 05:31:01 UTC

Severity: wishlist

Found in version 27.0.50

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Full log


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

From: Juri Linkov <juri <at> linkov.net>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 34080 <at> debbugs.gnu.org
Subject: Re: bug#34080: 27.0.50, 26.1; undocumented key bindings for *vc-diff*
Date: Mon, 19 May 2025 09:30:20 +0300
>>> Searching the code base, :advertised-binding is meant to affect
>>> where-is-internal, and only that function, I think.
>>> But it does seem to be broken:
>>>
>>>     (progn (put 'diff-hunk-next :advertised-binding "n") ; or '("n")
>>>            (with-current-buffer "*vc-diff*"
>>>              (mapcar #'key-description
>>>                      (where-is-internal 'diff-hunk-next))))
>>>
>>>     => ("TAB" "n" "C-M-i" "M-n" "<menu-bar> <diff> <Next Hunk>")
>>>
>>> i.e. there is no prioritisation for the "n" binding.
>>> Indeed, TAB comes first.
>>>
>>> Then it seems like a separate issue why the "TAB" binding is not
>>> appearing in 'M-x describe-mode'.  So there are two problems here.
>>
>> There is no 'n' binding in 'diff-mode-map'.  'n' inherited
>> from 'diff-mode-shared-map' becomes 'M-n' (via the ESC prefix).
>> And its advertised-binding works correctly:
>>
>>   (put 'diff-hunk-next :advertised-binding "\M-n")
>>   (substitute-command-keys "Type `\\<diff-mode-map>\\[diff-hunk-next]'.")
>>   => #("Type ‘M-n’." 6 9 (font-lock-face help-key-binding face help-key-binding))
>
> If you change "n" and "\M-n" in my example the return value of
> where-is-internal does not change.  Therefore I think your example is
> working accidentally and there is still a problem here.

The Info node (info "(elisp) Standard Properties") says:

  ‘:advertised-binding’
       This property value specifies the preferred key binding, when
       showing documentation, for the named function.  *Note Keys in
       Documentation::.

Then the referred node (info "(elisp) Keys in Documentation")
mentions 'substitute-command-keys' that I used in my example.
OTOH, I can't find any reference to 'where-is-internal'.




This bug report was last modified 21 days ago.

Previous Next


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