Key binding in local keymap problem
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
Key binding in local keymap problem         


Author: etay.meiri
Date: Sep 9, 2008 13:18

Hi,

I have the following line in my .emacs:

(define-key gud-mode-map [f9] 'gud-break)

and I get an error that the value of gud-mode-map is void.

Here's the full log:

("/usr/bin/emacs-22.2")
Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el
(source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/igrep-init.el
(source)...done
Loading /usr/share/emacs/site...
Show full article (2.42Kb)
3 Comments
RE: Key binding in local keymap problem         


Author: Drew Adams
Date: Sep 9, 2008 13:45

> I have the following line in my .emacs:
> (define-key gud-mode-map [f9] 'gud-break)
> and I get an error that the value of gud-mode-map is void.

You need to load library `gud' before you do that.
It defines variable `gud-mode-map' and gives it a value.
no comments
Re: Key binding in local keymap problem         


Author: Juanma
Date: Sep 9, 2008 14:02

On Tuesday 09 September 2008, Drew Adams wrote:
>> I have the following line in my .emacs:
>> (define-key gud-mode-map [f9] 'gud-break)
>> and I get an error that the value of gud-mode-map is void.
>
> You need to load library `gud' before you do that.
> It defines variable `gud-mode-map' and gives it a value.

So, if you don't want to load `gud' on Emacs start-up, use `add-hook':

(add-hook 'gud-mode-hook
(lambda () (define-key gud-mode-map [f9] 'gud-break)))
--
Juanma

"Having a smoking section in a restaurant is like
having a peeing section in a swimming pool."
-- Edward Burr
no comments
Re: Key binding in local keymap problem         


Author: Nikolaj Schumacher
Date: Sep 11, 2008 01:41

Juanma wrote:
> On Tuesday 09 September 2008, Drew Adams wrote:
> (add-hook 'gud-mode-hook
> (lambda () (define-key gud-mode-map [f9] 'gud-break)))

I think it's cleaner to do the customizations like this:

(eval-after-load 'gud '(define-key gud-mode-map [f9] 'gud-break))

So they aren't executed every time the mode is started.

regards,
Nikolaj Schumacher
no comments