[Top][All Lists]

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

Re: trouble binding to <next> & <prior>

From: Lennart Borgman (gmail)
Subject: Re: trouble binding to <next> & <prior>
Date: Tue, 08 Jul 2008 19:26:07 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Mirko wrote:
On Jul 7, 4:04 pm, "Lennart Borgman (gmail)"
<address@hidden> wrote:
Mirko wrote:
On Jul 7, 2:09 pm, "Lennart Borgman (gmail)"
<address@hidden> wrote:
Mirko wrote:
On Jul 7, 12:59 pm, address@hidden (Pascal J. Bourguignon)
Mirko <address@hidden> writes:
I have a following keybinding, parts of which do not work.  In
particular I am trying to bind view-previous-entry to the page-up key
on the standard PC keyboard (using Emacs 22.1).  I used both h-k and h-
l to determine that this key is identified with "<prior>" & <next>".
(defvar iop-alert-mode-map nil
  "Keymap for IOP-alert mode")
(unless iop-alert-mode-map
  (setq iop-alert-mode-map (copy-keymap text-mode-map))
  (define-key iop-alert-mode-map (kbd "<prior>") 'view-previous-entry)
  (define-key iop-alert-mode-map (kbd "<next>") 'view-next-entry)
  (define-key iop-alert-mode-map (kbd "d") 'mark-entry-for-deletion)
  (define-key iop-alert-mode-map "m" 'mark-entry-for-save))
When in a buffer with iop-alert mode, doing h-m gives me the following
output on keybindings:
... stuff skipped
< n e           Prefix Command
< p r           Prefix Command
< n e x         Prefix Command
< p r i         Prefix Command
< n e x t       Prefix Command
< p r i o       Prefix Command
< n e x t >  view-next-entry
< p r i o r     Prefix Command
< p r i o r >        view-previous-entry
It seems <prior> and <next> are bound to the character sequence
"<prior>" and "<next>".  Pressing those characters will invoke the
commands.  But pressing the Page-up/down keys will not.
Indeed, doing a h-k shows that page-up/down are still bound to scroll
What am I doing wrong?
emacs-version   --> "22.2.1"
(kbd "<prior>") --> [prior]
if you don't get this vector with one symbol for (kbd "<prior>"),
indeed you have a problem.
__Pascal Bourguignon__          
WARNING: This product warps space and time in its vicinity.
I tried that, and I get exactly as you suggested.
(kbd "<prior>") --> [prior]
It looks like you have been doing
  (define-key iop-alert-mode-map "<prior>" 'view-previous-entry)
instead of
  (define-key iop-alert-mode-map (kbd "<prior>") 'view-previous-entry)
Nope.  This is what I have
 (define-key iop-alert-mode-map (kbd "<prior>") 'view-previous-entry)
Could you try to re-evaluate the code. Place point inside the defvar and
do C-M-x (this will just set iop-alert-mode-map to nil again). Then
place point inside the unless form and do C-M-x again.

Does this correct the keymap?

Yes and no.

Following your instructions to the keystroke, I first set the map to
nil, and then re-assigned it.  And now h-m gives a much saner
<next>            view-next-entry
<prior>           view-previous-entry

That is good.

Just a short note to avoid confusing other readers: I think you mean `C-h m' here when you write `h-m'. And below you probably mean `C-h k'.

(In my defense, I did try restarting emacs and reloading the file,
before starting this topic).

Did you happen to compile the file? The compiled file takes precedence over the uncompiled. This is confusing and I have fallen in that trap myself. (There is a warning in the *Message* buffer but that is a bit to shy in my opinion.)

However, h-k on page up and page down still gives:
<next> runs the command scroll-up
  which is an interactive built-in function in `C source code'.
It is bound to C-v, <next>.
(scroll-up &optional arg)


There are many keymaps involved. You can use `C-h b' to see all the key bindings.

There is rather much in the manual describing this, for example

  (info "(elisp) Searching the Active Keymaps")



reply via email to

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