help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : bookmark+ keybinding question


From: Drew Adams
Subject: RE: [External] : bookmark+ keybinding question
Date: Thu, 24 Oct 2024 02:19:44 +0000

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]