From: Drew Adams <drew.adams@oracle.com>
To: Christopher Howard <christopher@librehacker.com>
Cc: Help Gnu Emacs Mailing List <help-gnu-emacs@gnu.org>
Subject: RE: [External] : bookmark+ keybinding question
Date: Thu, 24 Oct 2024 02:19:44 +0000 [thread overview]
Message-ID: <DS7PR10MB52329AF98C2CE2655E977E45F34E2@DS7PR10MB5232.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87bjzav5lo.fsf@librehacker.com>
> > The first step is finding out what keymap to use.
> > In this case, it's `bookmark-bmenu-mode-map'.
>
> Thank you. Is there an automated way to figure out what the correct
> keymap is? I find that C-h k does not provide any information regarding
> that.
Not really, that I'm aware of. But often it's a
map for the current major mode, and in that case
its name is conventionally similar. (But there
are also minor modes, with their own maps.)
`C-h v major-mode' gives you the name of the major
mode. For the bookmark-list display that's
`bookmark-bmenu-mode'. And its main keymap is ...
`bookmark-bmenu-mode-map'.
`M-x describe-keymap' shows you all of the bindings
in a given keymap.
I say "main keymap" because there can be others.
For example, the menu-bar menus for mode
`bookmark-bmenu-mode' are on keymap
`bmkp-bmenu-menubar-menu'. (Menu keymaps often
end in `-menu' - they don't even contain the word
"keymap".)
As always, the source code is your friend. There
you find keymap `bmkp-bmenu-menubar-menu' defined
on the pseudo-key sequence [menu-bar bmkp] in
keymap `bookmark-bmenu-mode-map':
(defvar bmkp-bmenu-menubar-menu
(make-sparse-keymap "Bookmark+")
"`Boomark+' menu-bar menu.")
(define-key bookmark-bmenu-mode-map [menu-bar bmkp]
(cons "Bookmark+" bmkp-bmenu-menubar-menu))
And there are submaps off of that menu keymap.
Here's one:
(defvar bmkp-bmenu-bookmark-file-menu
(make-sparse-keymap "Bookmark File")
"`Bookmark File' submenu for menu-bar `Bookmark+' menu.")
(define-key bmkp-bmenu-menubar-menu [bookmark-file]
(cons "Bookmark File" bmkp-bmenu-bookmark-file-menu))
HTH. Maybe someone else has some better help for
keymap discovery.
(You can also use completion (`TAB') with command
`describe-keymap', to see the names of available maps,
and if you use a completion framework that lets you
filter/narrow then that might help you find maps.)
next prev parent reply other threads:[~2024-10-24 2:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 17:47 bookmark+ keybinding question Christopher Howard
2024-10-23 20:09 ` [External] : " Drew Adams
2024-10-23 22:04 ` Christopher Howard
2024-10-24 2:19 ` Drew Adams [this message]
2024-10-24 2:23 ` Drew Adams
2024-10-26 10:16 ` Robert Pluim
2024-10-28 16:55 ` Christopher Howard
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DS7PR10MB52329AF98C2CE2655E977E45F34E2@DS7PR10MB5232.namprd10.prod.outlook.com \
--to=drew.adams@oracle.com \
--cc=christopher@librehacker.com \
--cc=help-gnu-emacs@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.
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).