all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bookmark+ keybinding question
@ 2024-10-23 17:47 Christopher Howard
  2024-10-23 20:09 ` [External] : " Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Christopher Howard @ 2024-10-23 17:47 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs Mailing List

Hi Drew, could you give me a little guidance on something: I'm wanting, while viewing the bookmark list, to unbind "\M-o" from the bmkp-bmenu-w32-jump-to-marked, because I have a global M-o binding that I use very frequently, and this is causing me some inconvenience. I was thinking I could do something like this in my init.el:

```
(add-hook ???
          (lambda ()
            (unbind-key "\M-o")))
```

But I can't seem to figure out the correct hook. I'd rather not edit the bookmark+ code itself if I can avoid that.

-- 
📛 Christopher Howard
🚀 gemini://gem.librehacker.com
🌐 http://gem.librehacker.com

בראשית ברא אלהים את השמים ואת הארץ



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

* RE: [External] : bookmark+ keybinding question
  2024-10-23 17:47 bookmark+ keybinding question Christopher Howard
@ 2024-10-23 20:09 ` Drew Adams
  2024-10-23 22:04   ` Christopher Howard
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2024-10-23 20:09 UTC (permalink / raw)
  To: Christopher Howard; +Cc: Help Gnu Emacs Mailing List

> Hi Drew, could you give me a little guidance on something: I'm wanting,
> while viewing the bookmark list, to unbind "\M-o" from the bmkp-bmenu-
> w32-jump-to-marked, because I have a global M-o binding that I use very
> frequently, and this is causing me some inconvenience. I was thinking I
> could do something like this in my init.el:
> 
> (add-hook ??? (lambda () (unbind-key "\M-o")))
> 
> But I can't seem to figure out the correct hook. I'd rather not edit the
> bookmark+ code itself if I can avoid that.

The first step is finding out what keymap to use.
In this case, it's `bookmark-bmenu-mode-map'.

This is the traditional way to remove a key binding:
bind the key to nil in the particular map.

(define-key bookmark-bmenu-mode-map "\M-o" nil)

(In recent Emacs versions there are also `unbind-key'
and `keymap-unset'.)


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

* Re: [External] : bookmark+ keybinding question
  2024-10-23 20:09 ` [External] : " Drew Adams
@ 2024-10-23 22:04   ` Christopher Howard
  2024-10-24  2:19     ` Drew Adams
  2024-10-26 10:16     ` Robert Pluim
  0 siblings, 2 replies; 7+ messages in thread
From: Christopher Howard @ 2024-10-23 22:04 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs Mailing List

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

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

-- 
Christopher Howard



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

* RE: [External] : bookmark+ keybinding question
  2024-10-23 22:04   ` Christopher Howard
@ 2024-10-24  2:19     ` Drew Adams
  2024-10-24  2:23       ` Drew Adams
  2024-10-26 10:16     ` Robert Pluim
  1 sibling, 1 reply; 7+ messages in thread
From: Drew Adams @ 2024-10-24  2:19 UTC (permalink / raw)
  To: Christopher Howard; +Cc: Help Gnu Emacs Mailing List

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



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

* RE: [External] : bookmark+ keybinding question
  2024-10-24  2:19     ` Drew Adams
@ 2024-10-24  2:23       ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2024-10-24  2:23 UTC (permalink / raw)
  To: Drew Adams, Christopher Howard; +Cc: Help Gnu Emacs Mailing List

> (defvar bmkp-bmenu-menubar-menu
>   (make-sparse-keymap "Bookmark+")
>   "`Boomark+' menu-bar menu.")
         ^

And I see now there's a typo.
Weeding the garden never ends...



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

* Re: [External] : bookmark+ keybinding question
  2024-10-23 22:04   ` Christopher Howard
  2024-10-24  2:19     ` Drew Adams
@ 2024-10-26 10:16     ` Robert Pluim
  2024-10-28 16:55       ` Christopher Howard
  1 sibling, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2024-10-26 10:16 UTC (permalink / raw)
  To: Christopher Howard; +Cc: Drew Adams, Help Gnu Emacs Mailing List

>>>>> On Wed, 23 Oct 2024 14:04:19 -0800, Christopher Howard <christopher@librehacker.com> said:

    Christopher> Drew Adams <drew.adams@oracle.com> writes:
    >> The first step is finding out what keymap to use.
    >> In this case, it's `bookmark-bmenu-mode-map'.
    >> 

    Christopher> Thank you. Is there an automated way to figure out what the correct
    Christopher> keymap is? I find that C-h k does not provide any information
    Christopher> regarding that.

Which version of Emacs is that? The following type of output goes back
to at least emacs-25:

C-h k C-c C-a RET

=>

C-c C-a runs the command mml-attach-file (found in message-mode-map),

Robert
-- 



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

* Re: [External] : bookmark+ keybinding question
  2024-10-26 10:16     ` Robert Pluim
@ 2024-10-28 16:55       ` Christopher Howard
  0 siblings, 0 replies; 7+ messages in thread
From: Christopher Howard @ 2024-10-28 16:55 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Drew Adams, Help Gnu Emacs Mailing List

Robert Pluim <rpluim@gmail.com> writes:

> Which version of Emacs is that? The following type of output goes back
> to at least emacs-25:
>
> C-h k C-c C-a RET
>
> =>
>
> C-c C-a runs the command mml-attach-file (found in message-mode-map),
>
> Robert

Thank you, I see it now. I use describe-key often, but somehow I never noticed the information inside the parentheses.

-- 
Christopher Howard



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

end of thread, other threads:[~2024-10-28 16:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-10-24  2:23       ` Drew Adams
2024-10-26 10:16     ` Robert Pluim
2024-10-28 16:55       ` Christopher Howard

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.