GNU bug report logs - #9898
24.0.90; doc of :key-sequence

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Fri, 28 Oct 2011 18:52:01 UTC

Severity: minor

Found in version 24.0.90

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9898 in the body.
You can then email your comments to 9898 AT debbugs.gnu.org in the normal way.

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#9898; Package emacs. (Fri, 28 Oct 2011 18:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 28 Oct 2011 18:52:03 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.90; doc of :key-sequence
Date: Fri, 28 Oct 2011 11:48:51 -0700
(elisp) Extended Menu Items
 
"`:key-sequence nil'
 This property indicates that there is normally no key binding
 which is equivalent to this menu item.  Using this property saves
 time in preparing the menu for display, because Emacs does not
 need to search the keymaps for a keyboard equivalent for this menu
 item.
 
 However, if the user has rebound this item's definition to a key
 sequence, Emacs ignores the `:keys' property and finds the keyboard
 equivalent anyway."
 
Should that `:keys' be `:key-sequence'?  Since when do we override :keys
with whatever the command is bound to?
 

In GNU Emacs 24.0.90.1 (i386-mingw-nt5.1.2600) of 2011-10-24 on MARVIN
 Windowing system distributor `Microsoft Corp.', version 5.1.2600
 configured using `configure --with-gcc (4.6) --no-opt --cflags
 -I"D:/devel/emacs/libs/libXpm-3.5.8/include"
 -I"D:/devel/emacs/libs/libXpm-3.5.8/src"
 -I"D:/devel/emacs/libs/libpng-dev_1.4.3-1/include"
 -I"D:/devel/emacs/libs/zlib-dev_1.2.5-2/include"
 -I"D:/devel/emacs/libs/giflib-4.1.4-1/include"
 -I"D:/devel/emacs/libs/jpeg-6b-4/include"
 -I"D:/devel/emacs/libs/tiff-3.8.2-1/include"
 -I"D:/devel/emacs/libs/gnutls-2.10.1/include" --ldflags
 -L"D:/devel/emacs/libs/gnutls-2.10.1/lib"'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9898; Package emacs. (Sun, 09 Feb 2014 06:01:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 9898 <at> debbugs.gnu.org
Subject: Re: bug#9898: 24.0.90; doc of :key-sequence
Date: Sat, 08 Feb 2014 21:58:41 -0800
"Drew Adams" <drew.adams <at> oracle.com> writes:

> (elisp) Extended Menu Items
>
> "`:key-sequence nil'
>  This property indicates that there is normally no key binding
>  which is equivalent to this menu item.  Using this property saves
>  time in preparing the menu for display, because Emacs does not
>  need to search the keymaps for a keyboard equivalent for this menu
>  item.
>
>  However, if the user has rebound this item's definition to a key
>  sequence, Emacs ignores the `:keys' property and finds the keyboard
>  equivalent anyway."
>
> Should that `:keys' be `:key-sequence'?  Since when do we override :keys
> with whatever the command is bound to?

Looking at the code, it looks to me that the documentation is wrong
here.  But I might be wrong.  The function in question that uses this
stuff is `easy-menu-convert-item-1'.  Somebody should take a look and
decide.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9898; Package emacs. (Sat, 25 Mar 2017 03:22:02 GMT) Full text and rfc822 format available.

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

From: npostavs <at> users.sourceforge.net
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 9898 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#9898: 24.0.90; doc of :key-sequence
Date: Fri, 24 Mar 2017 23:22:56 -0400
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> "Drew Adams" <drew.adams <at> oracle.com> writes:
>
>> (elisp) Extended Menu Items
>>
>> "`:key-sequence nil'
>>  This property indicates that there is normally no key binding
>>  which is equivalent to this menu item.  Using this property saves
>>  time in preparing the menu for display, because Emacs does not
>>  need to search the keymaps for a keyboard equivalent for this menu
>>  item.
>>
>>  However, if the user has rebound this item's definition to a key
>>  sequence, Emacs ignores the `:keys' property and finds the keyboard
>>  equivalent anyway."
>>
>> Should that `:keys' be `:key-sequence'?  Since when do we override :keys
>> with whatever the command is bound to?
>
> Looking at the code, it looks to me that the documentation is wrong
> here.  But I might be wrong.  The function in question that uses this
> stuff is `easy-menu-convert-item-1'.  Somebody should take a look and
> decide.

I think the relevant code is in `parse_menu_item' of keyboard.c,
`easy-menu-convert-item-1' is only constructing menu items, not
interpreting them.

As far as I can tell, `:key-sequence nil' doesn't actually do anything
different from just not specifying `:key-sequence' at all (with the
minor exception that passing both `:keys STRING' and `:key-sequence nil'
causes the `:keys STRING' to be ignored).  So I propose just removing
both `:key-sequence nil' paragraphs.

parse_menu_item (Lisp_Object item, int inmenubar)
{
  Lisp_Object def, tem, item_string, start;
  Lisp_Object filter;
  Lisp_Object keyhint;
  int i;

  filter = Qnil;
  keyhint = Qnil;
  [...]
          /* Parse properties.  */
          while (CONSP (item) && CONSP (XCDR (item)))
            {
              tem = XCAR (item);
              item = XCDR (item);
        [...]
              else if (EQ (tem, QCkey_sequence))
                {
                  tem = XCAR (item);
                  if (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem))
                    /* Be GC protected. Set keyhint to item instead of tem.  */
                    keyhint = item;
                }
        [...]
    /* The previous code preferred :key-sequence to :keys, so we
       preserve this behavior.  */
    if (STRINGP (keyeq) && !CONSP (keyhint))
      keyeq = concat2 (space_space, Fsubstitute_command_keys (keyeq));
    else
      {
      [...]
        if (CONSP (keyhint) && !NILP (XCAR (keyhint)))
          {
            keys = XCAR (keyhint);
            [...]
          }

        if (NILP (keys))
          keys = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qnil);




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9898; Package emacs. (Fri, 16 Jul 2021 13:53:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: npostavs <at> users.sourceforge.net
Cc: Drew Adams <drew.adams <at> oracle.com>, 9898 <at> debbugs.gnu.org
Subject: Re: bug#9898: 24.0.90; doc of :key-sequence
Date: Fri, 16 Jul 2021 15:52:37 +0200
npostavs <at> users.sourceforge.net writes:

> As far as I can tell, `:key-sequence nil' doesn't actually do anything
> different from just not specifying `:key-sequence' at all (with the
> minor exception that passing both `:keys STRING' and `:key-sequence nil'
> causes the `:keys STRING' to be ignored).  So I propose just removing
> both `:key-sequence nil' paragraphs.

Looks like Stefan did something along those lines last year:

commit 5734339f4017836a2b171071056a320899a7c8e5
Author:     Stefan Monnier <monnier <at> iro.umontreal.ca>
AuthorDate: Sun Apr 19 11:19:03 2020 -0400

    * doc/lispref/keymaps.texi (Extended Menu Items, Easy Menu) <:key-sequence>:
    
    Clarify the documentation further

So I'm closing this bug report.

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




bug marked as fixed in version 28.1, send any further explanations to 9898 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 16 Jul 2021 13:53:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 14 Aug 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 249 days ago.

Previous Next


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