unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 2-key prefix and Invalid Prefix keys in sequence
@ 2005-03-05  3:38 Tim Johnson
  2005-03-06  2:45 ` John Paul Wallington
       [not found] ` <mailman.2729.1110078204.32256.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Johnson @ 2005-03-05  3:38 UTC (permalink / raw)


Hello:
I'd like to map out a series of 3-key commands, with
control-c control-; as the prefix.
Initially I am attempting the following:
(global-set-key [(control \c\;) (b)] 'isearch-forward)
;; evaluation gives me the "Invalid Prefix Keys in sequence"
;; error message
1)How can I make this simple sequence work?
2)There is extensive info docs on keymapping, and I've seen
   it briefly, but can't find it again. :-( What's the command
   to get to it?
3)And the *bigger* picture is: I ultimately want to set up a
   global (or local) keymap with a 2-key prefix (such as C-c C-;).
   I've found numerous examples of how to *add* a key to an existing
   keymap, but no examples of how to create a new keymap and
   new prefix key.

All help and pointers to docs are greatly appreciated.
TIA
tim

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

* Re: 2-key prefix and Invalid Prefix keys in sequence
  2005-03-05  3:38 2-key prefix and Invalid Prefix keys in sequence Tim Johnson
@ 2005-03-06  2:45 ` John Paul Wallington
       [not found] ` <mailman.2729.1110078204.32256.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: John Paul Wallington @ 2005-03-06  2:45 UTC (permalink / raw)


Tim Johnson wrote:

> I'd like to map out a series of 3-key commands, with
> control-c control-; as the prefix.
> Initially I am attempting the following:
> (global-set-key [(control \c\;) (b)] 'isearch-forward)
> ;; evaluation gives me the "Invalid Prefix Keys in sequence"
> ;; error message

How about:

(defvar foo-map (make-sparse-keymap)
  "Foo keymap.")
(define-prefix-command 'foo-map)
(global-set-key [(control c) (control \;)] 'foo-map)
(define-key foo-map "b" 'isearch-forward)

[FWIW, C-; may not be a good choice because many terminals won't pass
it to Emacs -- on my main desktop machine at home the Linux console
ignores C-; and the xterm program passes on a bare semi-colon]

The section on Keymaps in the elisp info manual talks about defining
Prefix Keymaps.  Perhaps the emacs info manual should too.

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

* Re: 2-key prefix and Invalid Prefix keys in sequence
       [not found] ` <mailman.2729.1110078204.32256.help-gnu-emacs@gnu.org>
@ 2005-03-06 17:22   ` Tim Johnson
  2005-03-06 20:10     ` John Paul Wallington
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Johnson @ 2005-03-06 17:22 UTC (permalink / raw)


John Paul Wallington wrote:
> Tim Johnson wrote:

>>I'd like to map out a series of 3-key commands, with
>>control-c control-; as the prefix.
>>Initially I am attempting the following:
>>(global-set-key [(control \c\;) (b)] 'isearch-forward)
>>;; evaluation gives me the "Invalid Prefix Keys in sequence"
>>;; error message
> 
Hi John:

> (defvar foo-map (make-sparse-keymap)
>   "Foo keymap.")
> (define-prefix-command 'foo-map)
> (global-set-key [(control c) (control \;)] 'foo-map)
> (define-key foo-map "b" 'isearch-forward)

Great! Just what I was looking for! FYI I did find some examples
in keydefs.el, but haven't had time to try them. Your example is
very good and easy to implement. Thanks!

> [FWIW, C-; may not be a good choice because many terminals won't pass
> it to Emacs -- on my main desktop machine at home the Linux console
> ignores C-; and the xterm program passes on a bare semi-colon]

Good point. My linux machine (RH 9.0) with xemacs handles both C-; and 
C-'. On this windows XP machine emacs and xemacs process this
code correctly.
But the whole idea of haveing a keymap bound to a prefix key (in my 
mind), is that you can change the mapping to suit the OS (or the 
keyboard) by altering code in just once place....

> The section on Keymaps in the elisp info manual talks about defining
> Prefix Keymaps.  Perhaps the emacs info manual should too.

I agree. I find the appropos regex service wonderful for looking up
documentation. I haven't found a similar regex feature for 'info.
Is there one?

Best Regards
tim
> 
> 

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

* Re: 2-key prefix and Invalid Prefix keys in sequence
  2005-03-06 17:22   ` Tim Johnson
@ 2005-03-06 20:10     ` John Paul Wallington
  0 siblings, 0 replies; 4+ messages in thread
From: John Paul Wallington @ 2005-03-06 20:10 UTC (permalink / raw)


Tim Johnson wrote:

> I agree. I find the appropos regex service wonderful for looking up
> documentation. I haven't found a similar regex feature for 'info.
> Is there one?

There is i runs the command `Info-index' which looks up a string topic
in the index.  Although it doesn't take a regexp it does fuzzy
matching if there isn't an exact match.  There is also s runs the
command `Info-search' which searches for a regexp.

Also, there is a new command in the development sources called
`info-apropos' that searches the indices of all the Info files on
your system for a string and builds a menu of matches.

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

end of thread, other threads:[~2005-03-06 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-05  3:38 2-key prefix and Invalid Prefix keys in sequence Tim Johnson
2005-03-06  2:45 ` John Paul Wallington
     [not found] ` <mailman.2729.1110078204.32256.help-gnu-emacs@gnu.org>
2005-03-06 17:22   ` Tim Johnson
2005-03-06 20:10     ` John Paul Wallington

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