all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 26428@debbugs.gnu.org
Subject: bug#26428: 24.5; (elisp) Extended Menu Items: document same features for menus
Date: Sun, 9 Apr 2017 14:23:02 -0700 (PDT)	[thread overview]
Message-ID: <ae862d9c-8611-4490-8431-f0ea070f10ed@default> (raw)

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'





             reply	other threads:[~2017-04-09 21:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09 21:23 Drew Adams [this message]
2020-12-12 19:50 ` bug#26428: 24.5; (elisp) Extended Menu Items: document same features for menus Lars Ingebrigtsen
2020-12-12 22:01   ` Drew Adams
2020-12-13 12:49     ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae862d9c-8611-4490-8431-f0ea070f10ed@default \
    --to=drew.adams@oracle.com \
    --cc=26428@debbugs.gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.