all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* global-bind a function key
@ 2013-02-20  8:29 Glen Stark
  2013-02-20 11:44 ` Óscar Fuentes
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Glen Stark @ 2013-02-20  8:29 UTC (permalink / raw
  To: help-gnu-emacs

Hi.  

I feel like this should be really simple but I'm having a hard time 
anyway.

I'm using emacs 24.2.1

Following the instructions here: http://www.delorie.com/gnu/docs/emacs/
emacs_497.html

I have the following line in my .emacs file:

	(global-set-key [f5] 'convert-include-type)

(convert-include-type is a function of my own definition).  

If I evaluate the above lisp expression I get no errors, but pressing the 
F5 key produces the message "<SunOpen> is undefined", which is apparently 
the default keybinding for F5.  

If I run "global-set-key, f5, convert-include-type" from the minibuffer, 
everything works as expected.  

I tried a couple other syntaxes for keybinding an f5 key that I found on 
the web, but so far I have had no luck.  Can someone help me out?  

Thanks,

Glen


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

* Re: global-bind a function key
  2013-02-20  8:29 global-bind a function key Glen Stark
@ 2013-02-20 11:44 ` Óscar Fuentes
  2013-02-20 12:27 ` Jambunathan K
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Óscar Fuentes @ 2013-02-20 11:44 UTC (permalink / raw
  To: help-gnu-emacs

Glen Stark <mail@glenstarkREMOVEME.net> writes:

> I feel like this should be really simple but I'm having a hard time 
> anyway.
>
> I'm using emacs 24.2.1
>
> Following the instructions here: http://www.delorie.com/gnu/docs/emacs/
> emacs_497.html
>
> I have the following line in my .emacs file:
>
> 	(global-set-key [f5] 'convert-include-type)
>
> (convert-include-type is a function of my own definition).  
>
> If I evaluate the above lisp expression I get no errors, but pressing the 
> F5 key produces the message "<SunOpen> is undefined", which is apparently 
> the default keybinding for F5.  

It seems that your desktop environment (the equivalent to
KDE/Gnome/whatever you are using) translates F5 to the virtual key
<SunOpen>, which is what Emacs sees. This means that Emacs never sees
the F5 key as pressed, so it is no surprise that your global-set-key
doesn't work.

> If I run "global-set-key, f5, convert-include-type" from the minibuffer, 
> everything works as expected.  

Here, when you interactively press F5, <SunOpen> is sent to Emacs, which
in practice means that you are binding <SunOpen>.

> I tried a couple other syntaxes for keybinding an f5 key that I found on 
> the web, but so far I have had no luck.  Can someone help me out?  

If I'm correct there is no syntax for F5 that works for your setup
because the desktop environment is translating the F5 press event to
<SunOpen>.

Maybe your desktop environment allows to remove the F5 -> <SunOpen>
mapping with some configuration tool.




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

* Re: global-bind a function key
  2013-02-20  8:29 global-bind a function key Glen Stark
  2013-02-20 11:44 ` Óscar Fuentes
@ 2013-02-20 12:27 ` Jambunathan K
  2013-02-20 12:28 ` Jambunathan K
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2013-02-20 12:27 UTC (permalink / raw
  To: Glen Stark; +Cc: help-gnu-emacs

Glen Stark <mail@glenstarkREMOVEME.net> writes:

> If I run "global-set-key, f5, convert-include-type" from the minibuffer, 
> everything works as expected.  

Try 
        M-x command-history RET 

right after 

        M-x global-set-key RET 

or 
        M-x local-set-key RET

It is possible that the mystery be revealed to you.

-- 



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

* Re: global-bind a function key
  2013-02-20  8:29 global-bind a function key Glen Stark
  2013-02-20 11:44 ` Óscar Fuentes
  2013-02-20 12:27 ` Jambunathan K
@ 2013-02-20 12:28 ` Jambunathan K
  2013-02-20 12:56 ` Glen Stark
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2013-02-20 12:28 UTC (permalink / raw
  To: Glen Stark; +Cc: help-gnu-emacs

Glen Stark <mail@glenstarkREMOVEME.net> writes:

> If I run "global-set-key, f5, convert-include-type" from the minibuffer, 
> everything works as expected.  

Try 
        M-x list-command-history RET 

right after 

        M-x global-set-key RET 

or 
        M-x local-set-key RET

It is possible that the mystery be revealed to you.
-- 



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

* Re: global-bind a function key
  2013-02-20  8:29 global-bind a function key Glen Stark
                   ` (2 preceding siblings ...)
  2013-02-20 12:28 ` Jambunathan K
@ 2013-02-20 12:56 ` Glen Stark
  2013-02-20 15:00 ` Drew Adams
  2013-02-20 15:52 ` Stefan Monnier
  5 siblings, 0 replies; 7+ messages in thread
From: Glen Stark @ 2013-02-20 12:56 UTC (permalink / raw
  To: help-gnu-emacs

On Wed, 20 Feb 2013 08:29:16 +0000, Glen Stark wrote:

> Hi.
> 
> I feel like this should be really simple but I'm having a hard time
> anyway.
> 
> I'm using emacs 24.2.1
> 
> Following the instructions here: http://www.delorie.com/gnu/docs/emacs/
> emacs_497.html
> 
> I have the following line in my .emacs file:
> 
> 	(global-set-key [f5] 'convert-include-type)
> 
> (convert-include-type is a function of my own definition).
> 
> If I evaluate the above lisp expression I get no errors, but pressing
> the F5 key produces the message "<SunOpen> is undefined", which is
> apparently the default keybinding for F5.
> 
> If I run "global-set-key, f5, convert-include-type" from the minibuffer,
> everything works as expected.
> 
> I tried a couple other syntaxes for keybinding an f5 key that I found on
> the web, but so far I have had no luck.  Can someone help me out?
> 
> Thanks,
> 
> Glen

First, thanks for everyone who took the time to reply.  I read them.

Second, I apologize for wasting your time.  I had the Flock key on my 
keyboard disabled, which I didn't discover until I tried to use f3 to 
define a macro.  

I feel quite silly now, it's unbelievable how much time I wasted on that.


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

* RE: global-bind a function key
  2013-02-20  8:29 global-bind a function key Glen Stark
                   ` (3 preceding siblings ...)
  2013-02-20 12:56 ` Glen Stark
@ 2013-02-20 15:00 ` Drew Adams
  2013-02-20 15:52 ` Stefan Monnier
  5 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2013-02-20 15:00 UTC (permalink / raw
  To: 'Glen Stark', help-gnu-emacs

> 	(global-set-key [f5] 'convert-include-type)
> 
> pressing the F5 key produces the message "<SunOpen> is undefined",

Others have explained the problem: Emacs does not see <f5> when you press that
key.  It sees <SunOpen>.

Does this help?

(global-set-key (kbd "<SunOpen>") 'convert-include-type)




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

* Re: global-bind a function key
  2013-02-20  8:29 global-bind a function key Glen Stark
                   ` (4 preceding siblings ...)
  2013-02-20 15:00 ` Drew Adams
@ 2013-02-20 15:52 ` Stefan Monnier
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-02-20 15:52 UTC (permalink / raw
  To: help-gnu-emacs

> If I evaluate the above lisp expression I get no errors, but pressing the 
> F5 key produces the message "<SunOpen> is undefined", which is apparently 
> the default keybinding for F5.  

No, what it means is that your F5 key does not generate an `f5' event
but a `SunOpen' event instead.
Maybe you want

   (define-key function-key-map [SunOpen] [f5])


-- Stefan




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

end of thread, other threads:[~2013-02-20 15:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20  8:29 global-bind a function key Glen Stark
2013-02-20 11:44 ` Óscar Fuentes
2013-02-20 12:27 ` Jambunathan K
2013-02-20 12:28 ` Jambunathan K
2013-02-20 12:56 ` Glen Stark
2013-02-20 15:00 ` Drew Adams
2013-02-20 15:52 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.