* Help mode keybindings
@ 2013-05-23 21:05 Emanuel Berg
2013-05-24 20:02 ` Emanuel Berg
0 siblings, 1 reply; 8+ messages in thread
From: Emanuel Berg @ 2013-05-23 21:05 UTC (permalink / raw)
To: help-gnu-emacs
How do I bind C-j to "jump-to-register" in help mode?
I'd like that globally, so I bound it so in .emacs. But, in some modes
it was bound locally. For example, in "Lisp Interaction" mode, I had to
locally unset C-j to clear the path to the global binding, and this
worked with no problems:
(add-hook 'lisp-interaction-mode-hook
(lambda () (local-unset-key (kbd "C-j"))) )
But, that didn't work for Help mode: the local binding wasn't
dropped. Not even setting it explicitly work, as in the below
code. Strangely, the "j" (not C-j) version worked!
(add-hook 'help-mode-hook
(lambda ()
; ...
(define-key help-mode-map (kbd "j") 'jump-to-register) ; works
(define-key help-mode-map (kbd "C-j") 'jump-to-register) )) ; not so
Are the Help mode keybindings set in stone?
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Help mode keybindings
2013-05-23 21:05 Help mode keybindings Emanuel Berg
@ 2013-05-24 20:02 ` Emanuel Berg
2013-05-24 21:58 ` Emanuel Berg
2013-05-24 23:36 ` Michael Heerdegen
0 siblings, 2 replies; 8+ messages in thread
From: Emanuel Berg @ 2013-05-24 20:02 UTC (permalink / raw)
To: help-gnu-emacs
(I got this by mail, and can't find it on the list. Anyway, I suppose
it was intended for the list as well.)
> Works for me in Emacs 24. Not in Emacs 23, however. The cause seems
> to be that in Emacs 23, *Help* is in `view-mode', which has a binding
> for C-j.
> Note that minor mode bindings take precedence over local (major-mode)
> bindings.
Aha, I see. Perhaps I should upgrade to Emacs 24.
> Probably there is no trivial way to achieve what you want. You could
> use a minor mode yourself - or find a key that is not already used at
> multiple places.
Hm, to write a minor mode to shadow the view-mode sounds like
overkill. Wouldn't it be simpler to change the view minor mode? Or is
there something making that more difficult than I thought, as well?
> I myself try to avoid re-binding such pre-defined keys. Often you
> later find a mode where, to keep the example, the original binding of
> C-j is something you really want, and you have to find another key
> for that one or give up that your own binding is available everywhere
> etc.
In general, I agree, but, no rule without an exception... That key
works for all the zillion modes I use, it is in my muscle memory, and
it is a "close" shortcut (my index finger already at 'J'). I use
registers to navigate my entire file system, and any project I
currently work on, so I'm not giving it up.
> Or make a binding in `key-translation-map'.
How would I do that?
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Help mode keybindings
2013-05-24 20:02 ` Emanuel Berg
@ 2013-05-24 21:58 ` Emanuel Berg
2013-05-24 23:39 ` Michael Heerdegen
[not found] ` <mailman.346.1369438775.22516.help-gnu-emacs@gnu.org>
2013-05-24 23:36 ` Michael Heerdegen
1 sibling, 2 replies; 8+ messages in thread
From: Emanuel Berg @ 2013-05-24 21:58 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Works for me in Emacs 24. Not in Emacs 23, however. The cause seems
> to be that in Emacs 23, *Help* is in `view-mode', which has a binding
> for C-j.
I think I just solved it (thanks to your identification of the
problem), simply by disabling the blocking minor mode. I don't know if
there are any side effects to it; time will tell.
(add-hook 'help-mode-hook
(lambda ()
(set-help-mode-line)
(view-mode -1) ))
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Help mode keybindings
2013-05-24 20:02 ` Emanuel Berg
2013-05-24 21:58 ` Emanuel Berg
@ 2013-05-24 23:36 ` Michael Heerdegen
1 sibling, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2013-05-24 23:36 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
Emanuel Berg <embe8573@student.uu.se> writes:
> (I got this by mail, and can't find it on the list. Anyway, I suppose
> it was intended for the list as well.)
Thanks for the hint - my mistake.
> > Probably there is no trivial way to achieve what you want. You could
> > use a minor mode yourself - or find a key that is not already used at
> > multiple places.
>
> Hm, to write a minor mode to shadow the view-mode sounds like
> overkill.
It would have the advantage that you would not have to treat any mode
that binds C-j individually.
But it would have the disadvantage that you would have to ensure that
your new minor mode has a higher priority than any other minor mode it
should "shadow".
> Wouldn't it be simpler to change the view minor mode? Or is
> there something making that more difficult than I thought, as well?
No, it's easy - just do
(define-key view-mode-map [?\C-j] nil)
> > Or make a binding in `key-translation-map'.
>
> How would I do that?
Better don't - it's possible, but only the last solution one should
think about. Let's try to do without.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-05-26 1:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-23 21:05 Help mode keybindings Emanuel Berg
2013-05-24 20:02 ` Emanuel Berg
2013-05-24 21:58 ` Emanuel Berg
2013-05-24 23:39 ` Michael Heerdegen
[not found] ` <mailman.346.1369438775.22516.help-gnu-emacs@gnu.org>
2013-05-25 2:21 ` Emanuel Berg
2013-05-25 23:27 ` Michael Heerdegen
[not found] ` <mailman.386.1369524496.22516.help-gnu-emacs@gnu.org>
2013-05-26 1:14 ` Emanuel Berg
2013-05-24 23:36 ` Michael Heerdegen
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).