all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* F2
@ 2011-03-01  2:21 TheFlyingDutchman
  2011-03-01  3:16 ` F2 despen
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: TheFlyingDutchman @ 2011-03-01  2:21 UTC (permalink / raw)
  To: help-gnu-emacs

If I do "ctrl-h k <f2>"   I get "f2-"  in the message area, as if
Emacs is waiting for me to press another key. If I set a command to
<f2> with global-set-key and then hit the <f2> key, nothing happens.
If I again hit <f2> it tells me that "<f2> <f2> is undefined". It is
like <f2> is set to be used in a key combination. How can I get rid of
that and just assign a single keypress to <f2>?


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

* Re: F2
  2011-03-01  2:21 F2 TheFlyingDutchman
@ 2011-03-01  3:16 ` despen
  2011-03-01  3:39   ` F2 TheFlyingDutchman
  2011-03-01  9:31   ` F2 Peter Dyballa
  2011-03-01 12:51 ` F2 Sean Sieger
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 18+ messages in thread
From: despen @ 2011-03-01  3:16 UTC (permalink / raw)
  To: help-gnu-emacs

TheFlyingDutchman <zzbbaadd@aol.com> writes:

> If I do "ctrl-h k <f2>"   I get "f2-"  in the message area, as if
> Emacs is waiting for me to press another key. If I set a command to
> <f2> with global-set-key and then hit the <f2> key, nothing happens.
> If I again hit <f2> it tells me that "<f2> <f2> is undefined". It is
> like <f2> is set to be used in a key combination. How can I get rid of
> that and just assign a single keypress to <f2>?

I don't know that you have to get rid of anything.
This works as an override for me:

(define-key global-map [(f2)] 'next-error)

Emacs 23.2.1.


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

* Re: F2
  2011-03-01  3:16 ` F2 despen
@ 2011-03-01  3:39   ` TheFlyingDutchman
  2011-03-01  6:49     ` F2 PJ Weisberg
       [not found]     ` <mailman.1.1298962186.15292.help-gnu-emacs@gnu.org>
  2011-03-01  9:31   ` F2 Peter Dyballa
  1 sibling, 2 replies; 18+ messages in thread
From: TheFlyingDutchman @ 2011-03-01  3:39 UTC (permalink / raw)
  To: help-gnu-emacs

> I don't know that you have to get rid of anything.
> This works as an override for me:
>
> (define-key global-map [(f2)] 'next-error)
>
> Emacs 23.2.1.

Thanks for the reply.

I was using
(global-set-key (kbd "<f2>") 'my-elisp-command)

I don't know if that works differently than define-key.

Anyway, I used your command and it worked as desired - pressing F2
executed "next-error".
Then I used global-set-key to set F2 to "previous-error" and it also
worked.
Then I executed the initial command I was using and couldn't get to
work with 1 F2 press and it also worked??? Oh well, case solved, at
least for this instantiation of Emacs (also 23.2.1).


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

* Re: F2
  2011-03-01  3:39   ` F2 TheFlyingDutchman
@ 2011-03-01  6:49     ` PJ Weisberg
       [not found]     ` <mailman.1.1298962186.15292.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 18+ messages in thread
From: PJ Weisberg @ 2011-03-01  6:49 UTC (permalink / raw)
  To: help-gnu-emacs

On 2/28/11, TheFlyingDutchman <zzbbaadd@aol.com> wrote:
> I was using
> (global-set-key (kbd "<f2>") 'my-elisp-command)
>
> I don't know if that works differently than define-key.

For the record,

(global-set-key (kbd "<f2>") (lambda() (interactive) (message "Hello, world!")))

works perfectly well over here (Emacs 23.2.1 via Debian).

-PJ



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

* Re: F2
       [not found]     ` <mailman.1.1298962186.15292.help-gnu-emacs@gnu.org>
@ 2011-03-01  7:14       ` Tim X
  2011-03-01 19:18         ` F2 TheFlyingDutchman
  0 siblings, 1 reply; 18+ messages in thread
From: Tim X @ 2011-03-01  7:14 UTC (permalink / raw)
  To: help-gnu-emacs

PJ Weisberg <pj@irregularexpressions.net> writes:

> On 2/28/11, TheFlyingDutchman <zzbbaadd@aol.com> wrote:
>> I was using
>> (global-set-key (kbd "<f2>") 'my-elisp-command)
>>
>> I don't know if that works differently than define-key.
>
> For the record,
>
> (global-set-key (kbd "<f2>") (lambda() (interactive) (message "Hello, world!")))
>
> works perfectly well over here (Emacs 23.2.1 via Debian).
>

Note that you can see if a key is 'free' by using C-h b to list all
current key bindings. 

,----[ C-h k  control h b  ]
|  control h b runs the command describe-bindings, which is an interactive
|  compiled Lisp function in `help.el'.
| 
| It is bound to control h b , <f1> b , <help> b , <menu-bar> <help-menu>
| <describe> <list-keybindings> .
| 
| (describe-bindings &optional PREFIX BUFFER)
| 
| Show a list of all defined keys, and their definitions.
| We put that list in a buffer, and display the buffer.
| 
| The optional argument PREFIX, if non-nil, should be a key sequence;
| then we display only bindings that start with that prefix.
| The optional argument BUFFER specifies which buffer's bindings
| to display (default, the current buffer).  BUFFER can be a buffer
| or a buffer name.
| 
| [back]
`----

If I do this in now, on my system I see 

<f1>		help-command
<f10>		menu-bar-open
<f13>		kmacro-start-macro-or-insert-counter
<f14>		kmacro-end-or-call-macro
<f16>		clipboard-kill-ring-save
<f18>		clipboard-yank
<f2>		2C-command
<f20>		clipboard-kill-region
<f3>		kmacro-start-macro-or-insert-counter
<f4>		kmacro-end-or-call-macro
<f5>		tempo-template-generic-header

If you find, after defining a key using either define-key global-map or
global-set-key, that the key doesn't seem to work, it is likely that
your global key binding is being over shadowed by a local key binding.
Using C-h b can help to show what maybe going on.  It is important to
remember that key maps work in aa sort of hierarchy and that global
definitions can be overridden (including cleared) by local key maps. 

This could also explain why the definition works for some and not
others. Unless everyone is defining and testing the binding from wihtin
the same mode, with the same global and local key maps, you may see what
appears to be inconsistent results. It can also explain what is going on
if you define a global key definition, test it and find it works and
then later, try to use it while in a different mode and find it doesn'
work. 

Tim

-- 
tcross (at) rapttech dot com dot au


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

* Re: F2
  2011-03-01  3:16 ` F2 despen
  2011-03-01  3:39   ` F2 TheFlyingDutchman
@ 2011-03-01  9:31   ` Peter Dyballa
  1 sibling, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2011-03-01  9:31 UTC (permalink / raw)
  To: zzbbaadd; +Cc: help-gnu-emacs


TheFlyingDutchman writes:

> If I do "ctrl-h k <f2>"   I get "f2-"  in the message area, as if
> Emacs is waiting for me to press another key.


F2 introduces 2C, two-column-mode.

--
Greetings

   Pete

Life is the only flaw in an otherwise perfect nonexistence
				– Schopenhauer




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

* Re: F2
  2011-03-01  2:21 F2 TheFlyingDutchman
  2011-03-01  3:16 ` F2 despen
@ 2011-03-01 12:51 ` Sean Sieger
  2011-03-01 12:52 ` F2 Sean Sieger
  2011-03-01 18:16 ` F2 Glenn Morris
  3 siblings, 0 replies; 18+ messages in thread
From: Sean Sieger @ 2011-03-01 12:51 UTC (permalink / raw)
  To: help-gnu-emacs

TheFlyingDutchman <zzbbaadd@aol.com> writes:

    If I do "ctrl-h k <f2>"   I get "f2-"  in the message area, as if
    Emacs is waiting for me to press another key. If I set a command to
    <f2> with global-set-key and then hit the <f2> key, nothing happens.
    If I again hit <f2> it tells me that "<f2> <f2> is undefined". It is
    like <f2> is set to be used in a key combination. How can I get rid of
    that and just assign a single keypress to <f2>?

I thought we are in agreement on the unexpected nature of F2 and
further, of ending up doing F2 F2 and turning on 2C mode.  (A single F2
ought to turn 2C mode on before any rebinding.)




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

* Re: F2
  2011-03-01  2:21 F2 TheFlyingDutchman
  2011-03-01  3:16 ` F2 despen
  2011-03-01 12:51 ` F2 Sean Sieger
@ 2011-03-01 12:52 ` Sean Sieger
  2011-03-01 18:16 ` F2 Glenn Morris
  3 siblings, 0 replies; 18+ messages in thread
From: Sean Sieger @ 2011-03-01 12:52 UTC (permalink / raw)
  To: help-gnu-emacs

... so I reported it as a bug.




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

* Re: F2
  2011-03-01  2:21 F2 TheFlyingDutchman
                   ` (2 preceding siblings ...)
  2011-03-01 12:52 ` F2 Sean Sieger
@ 2011-03-01 18:16 ` Glenn Morris
  3 siblings, 0 replies; 18+ messages in thread
From: Glenn Morris @ 2011-03-01 18:16 UTC (permalink / raw)
  To: help-gnu-emacs

TheFlyingDutchman wrote:

> If I do "ctrl-h k <f2>"   I get "f2-"  in the message area, as if
> Emacs is waiting for me to press another key.

It is waiting. F2 is a prefix key - see "Prefix Keymaps" in the manual.


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

* Re: F2
  2011-03-01  7:14       ` F2 Tim X
@ 2011-03-01 19:18         ` TheFlyingDutchman
  2011-03-01 20:05           ` F2 despen
                             ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: TheFlyingDutchman @ 2011-03-01 19:18 UTC (permalink / raw)
  To: help-gnu-emacs

>
> Note that you can see if a key is 'free' by using C-h b to list all
> current key bindings.
>
> If you find, after defining a key using either define-key global-map or
> global-set-key, that the key doesn't seem to work, it is likely that
> your global key binding is being over shadowed by a local key binding.
> Using C-h b can help to show what maybe going on.  It is important to
> remember that key maps work in aa sort of hierarchy and that global
> definitions can be overridden (including cleared) by local key maps.

Yes, thanks, that appears to be my problem. I am editing an html file
and I see bindings for F2 as:


`2C-mode' Minor Mode Bindings:

key             binding
---             -------

C-x	Prefix Command
<f2>	Prefix Command

<f2> RET	2C-newline
<f2> 1	2C-merge
<f2> d	2C-dissociate
<f2> o	2C-associated-buffer
<f2> {	2C-shrink-window-horizontally
<f2> |	2C-toggle-autoscroll
<f2> }	2C-enlarge-window-horizontally


In the *scratch* buffer, the global binding I have set for F2 shows
up, which I guess is why I thought the problem had disappeared (and
later returned). The key works in *scratch* as I want but not in the
html file buffer.


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

* Re: F2
  2011-03-01 19:18         ` F2 TheFlyingDutchman
@ 2011-03-01 20:05           ` despen
  2011-03-01 20:35           ` F2 PJ Weisberg
       [not found]           ` <mailman.8.1299011724.12270.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 18+ messages in thread
From: despen @ 2011-03-01 20:05 UTC (permalink / raw)
  To: help-gnu-emacs

TheFlyingDutchman <zzbbaadd@aol.com> writes:

>>
>> Note that you can see if a key is 'free' by using C-h b to list all
>> current key bindings.
>>
>> If you find, after defining a key using either define-key global-map or
>> global-set-key, that the key doesn't seem to work, it is likely that
>> your global key binding is being over shadowed by a local key binding.
>> Using C-h b can help to show what maybe going on.  It is important to
>> remember that key maps work in aa sort of hierarchy and that global
>> definitions can be overridden (including cleared) by local key maps.
>
> Yes, thanks, that appears to be my problem. I am editing an html file
> and I see bindings for F2 as:
>
>
> `2C-mode' Minor Mode Bindings:
>
> key             binding
> ---             -------
>
> C-x	Prefix Command
> <f2>	Prefix Command
>
> <f2> RET	2C-newline
> <f2> 1	2C-merge
> <f2> d	2C-dissociate
> <f2> o	2C-associated-buffer
> <f2> {	2C-shrink-window-horizontally
> <f2> |	2C-toggle-autoscroll
> <f2> }	2C-enlarge-window-horizontally
>
>
> In the *scratch* buffer, the global binding I have set for F2 shows
> up, which I guess is why I thought the problem had disappeared (and
> later returned). The key works in *scratch* as I want but not in the
> html file buffer.

My F2 key in an HTML buffer continues to try to find the next error.
Maybe you are using a different HTML mode?

Anyway, find the keymap the HTML buffer is using and change that.

It's a bit confusing, Emacs has these commands that change GLOBAL
things, but that doesn't change GLOBAL behavior.  The global bindings
really just set defaults.


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

* Re: F2
  2011-03-01 19:18         ` F2 TheFlyingDutchman
  2011-03-01 20:05           ` F2 despen
@ 2011-03-01 20:35           ` PJ Weisberg
       [not found]           ` <mailman.8.1299011724.12270.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 18+ messages in thread
From: PJ Weisberg @ 2011-03-01 20:35 UTC (permalink / raw)
  To: help-gnu-emacs

On 3/1/11, TheFlyingDutchman <zzbbaadd@aol.com> wrote:
> Yes, thanks, that appears to be my problem. I am editing an html file
> and I see bindings for F2 as:

In general something like this should get rid of any local binding you
don't want to override your global binding:

(define-key 'foo-mode-map "key" nil)

-PJ



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

* Re: F2
       [not found]           ` <mailman.8.1299011724.12270.help-gnu-emacs@gnu.org>
@ 2011-03-01 21:18             ` TheFlyingDutchman
  2011-03-02 22:43               ` F2 PJ Weisberg
       [not found]               ` <mailman.0.1299105817.15358.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 18+ messages in thread
From: TheFlyingDutchman @ 2011-03-01 21:18 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 1, 12:35 pm, PJ Weisberg <p...@irregularexpressions.net> wrote:
> On 3/1/11, TheFlyingDutchman <zzbba...@aol.com> wrote:
>
> > Yes, thanks, that appears to be my problem. I am editing an html file
> > and I see bindings for F2 as:
>
> In general something like this should get rid of any local binding you
> don't want to override your global binding:
>
> (define-key 'foo-mode-map "key" nil)
>
> -PJ

How would I determine the value of "foo-mode-map" to use. I tried
'html-mode and 'html-mode-map and 'c2-mode and 'c2-mode-map and define-
key puts up a *Backtrace* window -> Debugger entered--Lisp error:
(wrong-type-argument keymapp html-mode-map)


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

* Re: F2
  2011-03-01 21:18             ` F2 TheFlyingDutchman
@ 2011-03-02 22:43               ` PJ Weisberg
  2011-03-02 22:56                 ` F2 Drew Adams
       [not found]               ` <mailman.0.1299105817.15358.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 18+ messages in thread
From: PJ Weisberg @ 2011-03-02 22:43 UTC (permalink / raw)
  To: help-gnu-emacs

On 3/1/11, TheFlyingDutchman <zzbbaadd@aol.com> wrote:
> On Mar 1, 12:35 pm, PJ Weisberg <p...@irregularexpressions.net> wrote:
>> On 3/1/11, TheFlyingDutchman <zzbba...@aol.com> wrote:
>>
>> > Yes, thanks, that appears to be my problem. I am editing an html file
>> > and I see bindings for F2 as:
>>
>> In general something like this should get rid of any local binding you
>> don't want to override your global binding:
>>
>> (define-key 'foo-mode-map "key" nil)
>>
>> -PJ
>
> How would I determine the value of "foo-mode-map" to use. I tried
> 'html-mode and 'html-mode-map and 'c2-mode and 'c2-mode-map and define-
> key puts up a *Backtrace* window -> Debugger entered--Lisp error:
> (wrong-type-argument keymapp html-mode-map)
>

I was hoping someone more knowledgable would pipe up with a better
answer, but here's my suggestion:  The variable "major-mode" has the
name of the current major mode, and "minor-mode-list" has all possible
minor modes.  A minor mode is active if a variable with that name is
defined and non-nill.  The map name should be the name of one of these
modes with "-map" at the end of it.  You might have to guess which one
is binding the key you don't like.

-PJ



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

* RE: F2
  2011-03-02 22:43               ` F2 PJ Weisberg
@ 2011-03-02 22:56                 ` Drew Adams
  0 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2011-03-02 22:56 UTC (permalink / raw)
  To: 'PJ Weisberg', help-gnu-emacs

> > How would I determine the value of "foo-mode-map" to use.
> 
> I was hoping someone more knowledgable would pipe up with a better
> answer, but here's my suggestion:  The variable "major-mode" has the
> name of the current major mode, and "minor-mode-list" has all possible
> minor modes.  A minor mode is active if a variable with that name is
> defined and non-nill.  The map name should be the name of one of these
> modes with "-map" at the end of it.  You might have to guess which one
> is binding the key you don't like.

For a human-readable list of the key bindings provided by a given keymap
variable, use `describe-keymap', defined in library `help-fns+.el'.
http://www.emacswiki.org/emacs/download/help-fns%2b.el




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

* Re: F2
       [not found]               ` <mailman.0.1299105817.15358.help-gnu-emacs@gnu.org>
@ 2011-03-02 23:51                 ` TheFlyingDutchman
  2011-03-03  0:57                   ` F2 Drew Adams
  0 siblings, 1 reply; 18+ messages in thread
From: TheFlyingDutchman @ 2011-03-02 23:51 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 2, 2:43 pm, PJ Weisberg <p...@irregularexpressions.net> wrote:
> On 3/1/11, TheFlyingDutchman <zzbba...@aol.com> wrote:
>
>
>
>
>
> > On Mar 1, 12:35 pm, PJ Weisberg <p...@irregularexpressions.net> wrote:
> >> On 3/1/11, TheFlyingDutchman <zzbba...@aol.com> wrote:
>
> >> > Yes, thanks, that appears to be my problem. I am editing an html file
> >> > and I see bindings for F2 as:
>
> >> In general something like this should get rid of any local binding you
> >> don't want to override your global binding:
>
> >> (define-key 'foo-mode-map "key" nil)
>
> >> -PJ
>
> > How would I determine the value of "foo-mode-map" to use. I tried
> > 'html-mode and 'html-mode-map and 'c2-mode and 'c2-mode-map and define-
> > key puts up a *Backtrace* window -> Debugger entered--Lisp error:
> > (wrong-type-argument keymapp html-mode-map)
>
> I was hoping someone more knowledgable would pipe up with a better
> answer, but here's my suggestion:  The variable "major-mode" has the
> name of the current major mode, and "minor-mode-list" has all possible
> minor modes.  A minor mode is active if a variable with that name is
> defined and non-nill.  The map name should be the name of one of these
> modes with "-map" at the end of it.  You might have to guess which one
> is binding the key you don't like.
>

Thanks for the reply.

One thing I just realized that it doesn't seem to want the symbol name
in define-key, but it's value:

(define-key foo-mode-map "key" nil)
instead of
(define-key 'foo-mode-map "key" nil)

When I executed
(define-key 2C-mode-map (kbd "<f2>") nil)
or
(define-key html-mode-map (kbd "<f2>") nil)
I didn't get an error.

But I don't know how to interactively execute that for the current
buffer (as opposed to doing it the *scratch* buffer). Or how to turn
off 2C mode. I ended up getting out of the html file, and when I
reedited it, the 2C mode was off and my global setting for F2 was
active. Someone posted about hitting F2 twice to turn on 2C mode and
that must have been what I did, which gave it a local value, before I
assigned it a global setting.


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

* RE: F2
  2011-03-02 23:51                 ` F2 TheFlyingDutchman
@ 2011-03-03  0:57                   ` Drew Adams
  2011-03-03  2:05                     ` F2 PJ Weisberg
  0 siblings, 1 reply; 18+ messages in thread
From: Drew Adams @ 2011-03-03  0:57 UTC (permalink / raw)
  To: 'TheFlyingDutchman', help-gnu-emacs

> But I don't know how to interactively execute that for the current
> buffer (as opposed to doing it the *scratch* buffer).

`M-:' prompts you for a Lisp sexp to evaluate.




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

* Re: F2
  2011-03-03  0:57                   ` F2 Drew Adams
@ 2011-03-03  2:05                     ` PJ Weisberg
  0 siblings, 0 replies; 18+ messages in thread
From: PJ Weisberg @ 2011-03-03  2:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, Mar 2, 2011 at 4:57 PM, Drew Adams <drew.adams@oracle.com> wrote:
>> But I don't know how to interactively execute that for the current
>> buffer (as opposed to doing it the *scratch* buffer).
>
> `M-:' prompts you for a Lisp sexp to evaluate.

Though I had assumed this was something you would want in your .emacs file.

-PJ



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

end of thread, other threads:[~2011-03-03  2:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01  2:21 F2 TheFlyingDutchman
2011-03-01  3:16 ` F2 despen
2011-03-01  3:39   ` F2 TheFlyingDutchman
2011-03-01  6:49     ` F2 PJ Weisberg
     [not found]     ` <mailman.1.1298962186.15292.help-gnu-emacs@gnu.org>
2011-03-01  7:14       ` F2 Tim X
2011-03-01 19:18         ` F2 TheFlyingDutchman
2011-03-01 20:05           ` F2 despen
2011-03-01 20:35           ` F2 PJ Weisberg
     [not found]           ` <mailman.8.1299011724.12270.help-gnu-emacs@gnu.org>
2011-03-01 21:18             ` F2 TheFlyingDutchman
2011-03-02 22:43               ` F2 PJ Weisberg
2011-03-02 22:56                 ` F2 Drew Adams
     [not found]               ` <mailman.0.1299105817.15358.help-gnu-emacs@gnu.org>
2011-03-02 23:51                 ` F2 TheFlyingDutchman
2011-03-03  0:57                   ` F2 Drew Adams
2011-03-03  2:05                     ` F2 PJ Weisberg
2011-03-01  9:31   ` F2 Peter Dyballa
2011-03-01 12:51 ` F2 Sean Sieger
2011-03-01 12:52 ` F2 Sean Sieger
2011-03-01 18:16 ` F2 Glenn Morris

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.