GNU bug report logs - #26428
24.5; (elisp) Extended Menu Items: document same features for menus

Previous Next

Package: emacs;

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

Date: Sun, 9 Apr 2017 21:24:01 UTC

Severity: minor

Tags: fixed

Found in version 24.5

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 26428 in the body.
You can then email your comments to 26428 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#26428; Package emacs. (Sun, 09 Apr 2017 21:24:01 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. (Sun, 09 Apr 2017 21:24:01 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.5; (elisp) Extended Menu Items: document same features for menus
Date: Sun, 9 Apr 2017 14:23:02 -0700 (PDT)
I filed a bug a few years back to get the use of keywords documented for
separator lines.  That was done: in (elisp) `Menu Separators' we now
have this:

   You can use a longer form to specify keywords such as `:enable'
   and `:visible=' for a menu separator:

   (menu-item SEPARATOR-TYPE nil . ITEM-PROPERTY-LIST)

   For example:

     (menu-item "--" nil :visible (boundp 'foo))

After some fiddling, I found that the same is true for menus
(e.g. submenus).  This too should be documented - it is not obvious.

What is needed is to pass the keymap itself, not a variable whose value
is the keymap, as the REAL-BINDING.  E.g.:

(define-key diredp-menu-bar-operate-menu [multiple-dired]
  `(menu-item "Dired" ,diredp-multiple-dired-menu
    :visible (save-excursion
               (goto-char (point-min))
               (and (re-search-forward (dired-marker-regexp) nil t)
                    (re-search-forward (dired-marker-regexp) nil t)))))

It's not enough to use `diredp-multiple-dired-menu' as the second arg to
`menu-item'.  Its value needs to be passed as the second arg.

The way (elisp) Extended Menu Items is written, it seems to apply only
to menu items that are leaves, not to those that are submenu names.
Even the description of REAL-BINDING suggests this limitation ("the
command to execute").

Please document how to use :enable, :visible etc. with a (sub)menu.

In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=3D/c/usr --host=3Di686-pc-mingw32'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26428; Package emacs. (Sat, 12 Dec 2020 19:51:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 26428 <at> debbugs.gnu.org
Subject: Re: bug#26428: 24.5; (elisp) Extended Menu Items: document same
 features for menus
Date: Sat, 12 Dec 2020 20:50:14 +0100
Drew Adams <drew.adams <at> oracle.com> writes:

> I filed a bug a few years back to get the use of keywords documented for
> separator lines.  That was done: in (elisp) `Menu Separators' we now
> have this:
>
>    You can use a longer form to specify keywords such as `:enable'
>    and `:visible=' for a menu separator:
>
>    (menu-item SEPARATOR-TYPE nil . ITEM-PROPERTY-LIST)
>
>    For example:
>
>      (menu-item "--" nil :visible (boundp 'foo))
>
> After some fiddling, I found that the same is true for menus
> (e.g. submenus).  This too should be documented - it is not obvious.

Could you suggest a text for the manual to document this?

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26428; Package emacs. (Sat, 12 Dec 2020 22:02:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 26428 <at> debbugs.gnu.org
Subject: RE: bug#26428: 24.5; (elisp) Extended Menu Items: document same
 features for menus
Date: Sat, 12 Dec 2020 14:01:38 -0800 (PST)
> Could you suggest a text for the manual to document this?

Doing this quickly.  Modify as you see fit.

In node `Extended Menu Items' we say:

 To define a real menu item which can be selected,
 the extended format binding looks like this:

     (menu-item ITEM-NAME REAL-BINDING
         . ITEM-PROPERTY-LIST)

 Here, ITEM-NAME is an expression which evaluates to
 the menu item string.  Thus, the string need not be
 a constant.  The third element, REAL-BINDING, is the
 command to execute.  The tail of the list,
 ITEM-PROPERTY-LIST, has the form of a property list
 which contains other information.

The last paragraph could be changed to indicate that
REAL-BINDING can be a command or a menu keymap (but
not a keymap-variable symbol).  Something like this
perhaps:

 Here, ITEM-NAME is an expression which evaluates to
 the menu item string.  Thus, the string need not be
 a constant.

 The third element, REAL-BINDING, is the command to
 execute or a menu keymap (but not a keymap-variable
 symbol).  If it is a menu keymap, that is, a keymap
 that has a prompt string, then ITEM-NAME is the
 name that appears for the submenu in its parent menu.
 
 The tail of the list, ITEM-PROPERTY-LIST, has the
 form of a property list that contains other information.

If you don't think that's clear enough (I do) then you
can add an example such as what I provided in the bug
report.

One thing I'm not clear on (haven't investigated): I'm
guessing that the keymap you provide here needs to be
a menu keymap, that is, a keymap with a prompt string.
Dunno whether that's true.  If not, remove mention of
that.

Whether that's actually needed or just possible, when
it happens what's the relation between the prompt
string and ITEM-NAME?  I'm guessing that ITEM-NAME is
used for the submenu name that appears, and the prompt
string is not used in this context.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26428; Package emacs. (Sun, 13 Dec 2020 12:51:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 26428 <at> debbugs.gnu.org
Subject: Re: bug#26428: 24.5; (elisp) Extended Menu Items: document same
 features for menus
Date: Sun, 13 Dec 2020 13:49:49 +0100
Drew Adams <drew.adams <at> oracle.com> writes:

> Doing this quickly.  Modify as you see fit.

Thanks; I've now expanded the section a bit along the lines you suggest.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 13 Dec 2020 12:51:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 26428 <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. (Sun, 13 Dec 2020 12:51: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. (Mon, 11 Jan 2021 12:24:06 GMT) Full text and rfc822 format available.

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

Previous Next


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