unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Rebinding Escape
@ 2005-03-05  6:53 PT
  2005-03-07  7:51 ` Mathias Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: PT @ 2005-03-05  6:53 UTC (permalink / raw)


In a special minor mode I want to allow the user to dismiss a popup help  
window quickly with the Escape key. I know it's prefix character, I only  
want to rebind it temporarily while the help window is shown.

I searched for a solution to override the default behavior, but found only  
an XEmacs-specific solution (setting meta-prefix-char to negative), but it  
didn't work. Esc still retains its old behavior.

Anyone has a better idea?

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

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

* Re: Rebinding Escape
  2005-03-05  6:53 Rebinding Escape PT
@ 2005-03-07  7:51 ` Mathias Dahl
  2005-03-07 14:59   ` PT
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Dahl @ 2005-03-07  7:51 UTC (permalink / raw)


PT <mailshield.gg@mailnull.com> writes:

> In a special minor mode I want to allow the user to dismiss a popup
> help window quickly with the Escape key. I know it's prefix
> character, I only want to rebind it temporarily while the help
> window is shown.

> I searched for a solution to override the default behavior, but
> found only an XEmacs-specific solution (setting meta-prefix-char to
> negative), but it didn't work. Esc still retains its old behavior.

This works for me:

 (local-set-key [escape] (lambda ()
                           (interactive)
                           (message "Escape test")))

Of course you want to do something else then sending a message, maybe
something like (delete-frame) or (bury-buffer).

Also, you probably want to add the key to a certain key map. This is
what I do for my jabber client:

 (define-key jabber-chat-mode-map [escape] 
   'my-jabber-chat-delete-or-bury)

/Mathias

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

* Re: Rebinding Escape
  2005-03-07  7:51 ` Mathias Dahl
@ 2005-03-07 14:59   ` PT
  0 siblings, 0 replies; 3+ messages in thread
From: PT @ 2005-03-07 14:59 UTC (permalink / raw)


On Mon, 07 Mar 2005 08:51:17 +0100, Mathias Dahl <brakjoller@gmail.com>  
wrote:
>
> This works for me:
>
>  (local-set-key [escape] (lambda ()
>                            (interactive)
>                            (message "Escape test")))
>

My mistake.

I tried

	(local-set-key (kbd "<esc>") 'my-stuff)

instead of

	(local-set-key (kbd "<ESC>") 'my-stuff)

The latter works fine.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

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

end of thread, other threads:[~2005-03-07 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-05  6:53 Rebinding Escape PT
2005-03-07  7:51 ` Mathias Dahl
2005-03-07 14:59   ` PT

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