all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: gnus: how to redefine a keymap
Date: Sat, 24 Oct 2009 13:16:11 +0200	[thread overview]
Message-ID: <87pr8dhwjo.fsf@fh-trier.de> (raw)
In-Reply-To: ma6dnfq-5oysKn_XnZ2dnUVZ_tednZ2d@sysmatrix.net

"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	other threads:[~2009-10-24 11:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23 20:41 gnus: how to redefine a keymap Francis Moreau
2009-10-24  8:13 ` B. T. Raven
2009-10-24 11:16   ` Andreas Politz [this message]
     [not found]   ` <mailman.9394.1256383005.2239.help-gnu-emacs@gnu.org>
2009-10-24 12:16     ` Francis Moreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pr8dhwjo.fsf@fh-trier.de \
    --to=politza@fh-trier.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.