[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why can't unset C-j in help mode like other modes?
From: |
Xah Lee |
Subject: |
Re: Why can't unset C-j in help mode like other modes? |
Date: |
Wed, 17 Dec 2008 04:28:50 -0800 (PST) |
User-agent: |
G2/1.0 |
On Dec 15, 2:12 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > I successfully unset C-j in other modes but the same trick doesn't
> > work in help mode?!? Why is that?...
>
> > (add-hook 'help-mode-hook
> > (lambda () (define-key help-mode-map [?\C-j] nil)))
>
> In *Help*, do `C-h k C-j'. You'll see this:
>
> ,----
> | C-j runs the command View-scroll-line-forward
> | which is an interactive compiled Lisp function in `view.el'.
> | It is bound to RET, C-j.
> `----
>
> Or do `C-h m' and look for LFD (which is `C-j'). You'll see that it is not
> listed in the description of Help mode. You'll find it under the description
> of
> View minor mode:
>
> ,----
> | RET, LFD scroll forward one line. With prefix scroll forward prefix
> line(s).
> `----
>
> IOW, the `C-j' binding is not in help-mode-map; it is in view-mode-map.
Adding to what Drew said...
Emacs does not have a mechanically enforced relation of mode name and
its key map name. So, xyz-mode's keymap can be anything. By
convention, it's usually “-map” appended to the value of “major-mode”.
“shell” is a example of exceptions to this. It uses comint-mode-map.
in practice, to find the map used in a major mode, you just look at
the source code and search for “-map”. The mode may be derived from
other mode, so you will look at the parent mode's source code. Also, a
mode may share keymap used by other modes.
Xah
∑ http://xahlee.org/
☄