unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24236: 25.1.50; `substitute-command-keys', \{...}: optionally show menu items
@ 2016-08-15 17:15 Drew Adams
  2022-05-13 13:54 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2016-08-15 17:15 UTC (permalink / raw)
  To: 24236

Enhancement request.

Add an optional arg to `substitute-command-keys'.  When present
(non-nil) it would cause \{...} to include menu items.

IOW, when `substitute-command-keys' makes use of `describe-bindings' (or
equivalent), if the optional arg is non-nil then it would use
`describe-buffer-bindings', in effect, passing it a non-nil MENUS
argument.

This gives callers of `substitute-command-keys' the possibility of
including menu items in a listing of keymap bindings.

In particular, it lets them show keys that are conditionally bound to
commands in a given map - bindings that are defined using `menu-item'
with a :filter - keys, such as this:

(define-key some-map (kbd "some-keys")
  '(menu-item "" nil
    :filter (lambda (&rest _)
              (and (some-condition) #'some-command))))

Such conditional bindings are typically made for keyboard keys.  But the
fact that they make use of an Emacs-Lisp idiom that defines them using
`menu-item' means that `substitute-command-keys' always filters them
out.  It should be possible to prevent filtering them out.

(If things like `substitute-command-keys', `describe-bindings', and
`describe-buffer-bindings' were defined in Lisp and not C, Lisp users
could themselves take care of such a request.  Please consider moving
such things to Lisp, unless there is a real reason they need to be in C.
I don't imagine that performance is a real reason in this case,
nowadays.)

In GNU Emacs 25.1.50.1 (i686-pc-mingw32)
 of 2015-12-10
Repository revision: 6148555ee5a3d0139ae517803718b3e0357933c7
Windowing system distributor 'Microsoft Corp.', version 6.1.7601
Configured using:
 'configure --prefix=/c/Devel/emacs/snapshot/trunk --enable-checking=yes
 --enable-check-lisp-object-type --without-compress-install 'CFLAGS=-Og
 -ggdb3' LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
 -Ic:/Devel/emacs/include''





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#24236: 25.1.50; `substitute-command-keys', \{...}: optionally show menu items
  2016-08-15 17:15 bug#24236: 25.1.50; `substitute-command-keys', \{...}: optionally show menu items Drew Adams
@ 2022-05-13 13:54 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 13:54 UTC (permalink / raw)
  To: Drew Adams; +Cc: 24236

Drew Adams <drew.adams@oracle.com> writes:

> Add an optional arg to `substitute-command-keys'.  When present
> (non-nil) it would cause \{...} to include menu items.

I've now added this to Emacs 29.

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-13 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-15 17:15 bug#24236: 25.1.50; `substitute-command-keys', \{...}: optionally show menu items Drew Adams
2022-05-13 13:54 ` Lars Ingebrigtsen

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).