help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnus: how to redefine a keymap


From: Andreas Politz
Subject: Re: gnus: how to redefine a keymap
Date: Sat, 24 Oct 2009 13:16:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

"B. T. Raven" <nihil@nihilo.net> writes:

> Francis Moreau wrote:
>> hello,
>> 
>> I'd like to redefine the 'g' key in the group buffer so it queries
>> only groups with a specific level or lower.
>> 
>> To do that I tried this:
>> 
>> (defun my-gnus-group-get-new-news ()
>>   (interactive)
>>   (gnus-group-get-new-news 2))
>> 
>> (add-hook 'gnus-group-mode-hook
>>           (lambda ()
>>             (define-key gnus-group-mode-map
>>               [g] 'my-gnus-group-get-new-news)))
>> 
>> but it doesn't work.
>> 
>> If I map my-gnus-group-get-new-news function to 'F6' for example it
>> works.
>> 
>> Could anybody tell me why it doesn't work with 'g' key ?

Because `g' is a symbol, not a character.  On the other hand, function
keys are mapped by symbols (like 'F6).  

Anyway you should probablly stick to the `kbd' macro,  where you can
, in most cases, declare the key as you seem to expect.


(kbd "g")
(kbd "C-g")

Keys which are represented by symbols (e.g. function keys,Home,etc.)
need to be embraced.

(kbd "<f6>")
(kbd "C-<f6>")



>> 
>> Thanks
>
> How about:
>
> .... [(g)] .....
>
> or .... [?g]....
>
> or .... "g" .....
>
>
> ??

I vote for the 2nd option.


-ap





reply via email to

[Prev in Thread] Current Thread [Next in Thread]