unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Use of 'pause' as key prefix
@ 2007-11-05 12:49 Kenneth Jacker
  2007-11-05 13:08 ` Stefan Kamphausen
  2007-11-05 13:39 ` Johan Bockgård
  0 siblings, 2 replies; 11+ messages in thread
From: Kenneth Jacker @ 2007-11-05 12:49 UTC (permalink / raw)
  To: help-gnu-emacs

I'm trying to use the 'pause' key as a prefix "character" so that I
can bind functions to key sequences like "pause a", "pause b", etc.

My efforts so far have failed (mainly elisp syntax errors).
I could find no help in 'info' and/or "searching the web" ...

Is this possible?  Suggestions on how to so define?

Thanks,

  -Kenneth
-- 
Prof Kenneth H Jacker       khj@cs.appstate.edu
Computer Science Dept       www.cs.appstate.edu/~khj
Appalachian State Univ
Boone, NC  28608  USA        

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

* Re: Use of 'pause' as key prefix
  2007-11-05 12:49 Use of 'pause' as key prefix Kenneth Jacker
@ 2007-11-05 13:08 ` Stefan Kamphausen
  2007-11-05 13:39   ` Kenneth Jacker
  2007-11-08 12:33   ` Kenneth Jacker
  2007-11-05 13:39 ` Johan Bockgård
  1 sibling, 2 replies; 11+ messages in thread
From: Stefan Kamphausen @ 2007-11-05 13:08 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Kenneth,

Kenneth Jacker <khj@be.cs.appstate.edu> writes:

> I'm trying to use the 'pause' key as a prefix "character" so that I
> can bind functions to key sequences like "pause a", "pause b", etc.
>
> My efforts so far have failed (mainly elisp syntax errors).
> I could find no help in 'info' and/or "searching the web" ...
>
> Is this possible?  Suggestions on how to so define?

(defvar pause-map nil "Keybindings with Pause as prefix")
(define-prefix-command 'pause-map)

(global-set-key '[(pause)] 'pause-map)
(define-key pause-map '[(t)] '(lambda ()
				(interactive)
				(insert "Testing Pause Prefix")))


Note however, that I'm not really sure whether this is the supposed
way to do it. Maybe someone with deeper understanding of this could
enlighten us?

Regards
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

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

* Re: Use of 'pause' as key prefix
  2007-11-05 13:08 ` Stefan Kamphausen
@ 2007-11-05 13:39   ` Kenneth Jacker
  2007-11-05 14:40     ` Stefan Kamphausen
  2007-11-05 14:40     ` wbosse
  2007-11-08 12:33   ` Kenneth Jacker
  1 sibling, 2 replies; 11+ messages in thread
From: Kenneth Jacker @ 2007-11-05 13:39 UTC (permalink / raw)
  To: help-gnu-emacs

Wow, thanks Stefan, for the fast reply!

  sk> (defvar pause-map nil "Keybindings with Pause as prefix")
  sk> (define-prefix-command 'pause-map)

  sk> (global-set-key '[(pause)] 'pause-map)
  sk> (define-key pause-map '[(t)] '(lambda ()
  sk> 				(interactive)
  sk> 				(insert "Testing Pause Prefix")))


Sorry, but I don't understand how to use the above to define
additional associations using 'pause-map', e.g., "pause a", "pause b",
etc.  Maybe time for me to RTFM?  ;-)

Thanks again,

  -Kenneth

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

* Re: Use of 'pause' as key prefix
  2007-11-05 12:49 Use of 'pause' as key prefix Kenneth Jacker
  2007-11-05 13:08 ` Stefan Kamphausen
@ 2007-11-05 13:39 ` Johan Bockgård
  2007-11-05 13:49   ` Kenneth Jacker
  1 sibling, 1 reply; 11+ messages in thread
From: Johan Bockgård @ 2007-11-05 13:39 UTC (permalink / raw)
  To: help-gnu-emacs

Kenneth Jacker <khj@be.cs.appstate.edu> writes:

> I'm trying to use the 'pause' key as a prefix "character" so that I
> can bind functions to key sequences like "pause a", "pause b", etc.

(kbd "<pause> a") == [pause ?a]

-- 
Johan Bockgård

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

* Re: Use of 'pause' as key prefix
  2007-11-05 13:39 ` Johan Bockgård
@ 2007-11-05 13:49   ` Kenneth Jacker
  0 siblings, 0 replies; 11+ messages in thread
From: Kenneth Jacker @ 2007-11-05 13:49 UTC (permalink / raw)
  To: help-gnu-emacs

  jb> (kbd "<pause> a") == [pause ?a]

Ah, so I'd do something like this?

   (global-set-key  "[pause ?a]" 'f0)
   (global-set-key  "[pause ?b]" 'f1)

No need for a "map"?

Thanks, Johan!

  -Kenneth

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

* Re: Use of 'pause' as key prefix
  2007-11-05 13:39   ` Kenneth Jacker
@ 2007-11-05 14:40     ` Stefan Kamphausen
  2007-11-05 15:02       ` Kenneth Jacker
  2007-11-05 14:40     ` wbosse
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Kamphausen @ 2007-11-05 14:40 UTC (permalink / raw)
  To: help-gnu-emacs

Kenneth Jacker <khj@be.cs.appstate.edu> writes:

> Wow, thanks Stefan, for the fast reply!
>
>   sk> (defvar pause-map nil "Keybindings with Pause as prefix")
>   sk> (define-prefix-command 'pause-map)
>
>   sk> (global-set-key '[(pause)] 'pause-map)
>   sk> (define-key pause-map '[(t)] '(lambda ()
>   sk> 				(interactive)
>   sk> 				(insert "Testing Pause Prefix")))
>
>
> Sorry, but I don't understand how to use the above to define
> additional associations using 'pause-map', e.g., "pause a", "pause b",
> etc.  Maybe time for me to RTFM?  ;-)

Does

(define-key pause-map '[(a)] '(lambda ()
				(interactive)
				(insert "pause a pressed")))
(define-key pause-map '[(b)] '(lambda ()
				(interactive)
				(insert "pause b pressed")))


help?

Regards
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

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

* Re: Use of 'pause' as key prefix
  2007-11-05 13:39   ` Kenneth Jacker
  2007-11-05 14:40     ` Stefan Kamphausen
@ 2007-11-05 14:40     ` wbosse
  2007-11-05 15:05       ` Kenneth Jacker
  1 sibling, 1 reply; 11+ messages in thread
From: wbosse @ 2007-11-05 14:40 UTC (permalink / raw)
  To: help-gnu-emacs

On 5 Nov., 14:39, Kenneth Jacker <k...@be.cs.appstate.edu> wrote:
> Wow, thanks Stefan, for the fast reply!
>
>   sk> (defvar pause-map nil "Keybindings with Pause as prefix")
>   sk> (define-prefix-command 'pause-map)
>
>   sk> (global-set-key '[(pause)] 'pause-map)
>   sk> (define-key pause-map '[(t)] '(lambda ()
>   sk>                                (interactive)
>   sk>                                (insert "Testing Pause Prefix")))
>
> Sorry, but I don't understand how to use the above to define
> additional associations using 'pause-map', e.g., "pause a", "pause b",
> etc.  Maybe time for me to RTFM?  ;-)

The following snippet is from my ~/.emacs file

(defvar PauseMap nil "function keys with prefix [pause]")
(setq   PauseMap (make-keymap))
(define-key global-map [pause] PauseMap)
...
(define-key PauseMap "h" 'highlight-regexp-current-word)
...

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

* Re: Use of 'pause' as key prefix
  2007-11-05 14:40     ` Stefan Kamphausen
@ 2007-11-05 15:02       ` Kenneth Jacker
  0 siblings, 0 replies; 11+ messages in thread
From: Kenneth Jacker @ 2007-11-05 15:02 UTC (permalink / raw)
  To: help-gnu-emacs

  sk> (global-set-key '[(pause)] 'pause-map)
  sk> (define-key pause-map '[(t)] '(lambda ()
  sk>                              (interactive)
  sk>                              (insert "Testing Pause Prefix")))

I see, the `t' (for "Testing" I assume) is the character following
the "pause"  ...  duh, I feel like an idiot!

  sk> Does

  sk> (define-key pause-map '[(a)] '(lambda ()
  sk>                              (interactive)
  sk>                              (insert "pause a pressed")))

  sk> help?

Yes, very much.

Sorry I didn't "grok" your original example.

Thanks, Stefan!

  -Kenneth

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

* Re: Use of 'pause' as key prefix
  2007-11-05 14:40     ` wbosse
@ 2007-11-05 15:05       ` Kenneth Jacker
  0 siblings, 0 replies; 11+ messages in thread
From: Kenneth Jacker @ 2007-11-05 15:05 UTC (permalink / raw)
  To: help-gnu-emacs

  wbosse> The following snippet is from my ~/.emacs file

  wbosse> (defvar PauseMap nil "function keys with prefix [pause]")
  wbosse> (setq   PauseMap (make-keymap))
  wbosse> (define-key global-map [pause] PauseMap)
  wbosse> ...
  wbosse> (define-key PauseMap "h" 'highlight-regexp-current-word)
  wbosse> ...

OK, more useful example code ...

Thanks to you and all the others who helped!

  -Kenneth

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

* Re: Use of 'pause' as key prefix
  2007-11-05 13:08 ` Stefan Kamphausen
  2007-11-05 13:39   ` Kenneth Jacker
@ 2007-11-08 12:33   ` Kenneth Jacker
  2007-11-09  4:46     ` Kevin Rodgers
  1 sibling, 1 reply; 11+ messages in thread
From: Kenneth Jacker @ 2007-11-08 12:33 UTC (permalink / raw)
  To: help-gnu-emacs

One more question!

I have defined 'pause' as a prefix, and am able to bind to 
"pause pause" with this:

   (define-key pause-map '[pause] 'f0)

How can I bind a function to "pause pause pause"?

Again, I tried various syntax combination, but wasn't able
to do it in a way that worked.

  -Kenneth

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

* Re: Use of 'pause' as key prefix
  2007-11-08 12:33   ` Kenneth Jacker
@ 2007-11-09  4:46     ` Kevin Rodgers
  0 siblings, 0 replies; 11+ messages in thread
From: Kevin Rodgers @ 2007-11-09  4:46 UTC (permalink / raw)
  To: help-gnu-emacs

Kenneth Jacker wrote:
> One more question!
> 
> I have defined 'pause' as a prefix, and am able to bind to 
> "pause pause" with this:
> 
>    (define-key pause-map '[pause] 'f0)
> 
> How can I bind a function to "pause pause pause"?
> 
> Again, I tried various syntax combination, but wasn't able
> to do it in a way that worked.

(define-key pause-map '[pause pause] 'f1)

-- 
Kevin Rodgers
Denver, Colorado, USA

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

end of thread, other threads:[~2007-11-09  4:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-05 12:49 Use of 'pause' as key prefix Kenneth Jacker
2007-11-05 13:08 ` Stefan Kamphausen
2007-11-05 13:39   ` Kenneth Jacker
2007-11-05 14:40     ` Stefan Kamphausen
2007-11-05 15:02       ` Kenneth Jacker
2007-11-05 14:40     ` wbosse
2007-11-05 15:05       ` Kenneth Jacker
2007-11-08 12:33   ` Kenneth Jacker
2007-11-09  4:46     ` Kevin Rodgers
2007-11-05 13:39 ` Johan Bockgård
2007-11-05 13:49   ` Kenneth Jacker

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