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

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

Re: Enabling and disabling my own keymap


From: TheLonelyStar
Subject: Re: Enabling and disabling my own keymap
Date: Thu, 22 May 2008 06:57:34 -0700 (PDT)

Hi,

Thanks for you answer! But I still have trouble. The code now looks like
this:
(setq my-keymap (make-sparse-keymap))
(defvar my-keymap-enabled)
(setq minor-mode-map-alist `(cons '(my-keymap-enabled . ,my-keymap)
minor-mode-map-alist))
(setq my-keymap-enabled t)
(defun delete-with-closing-bracket (arg)
  (interactive "*p")
  ...
))
(define-key my-keymap (kbd "C-d") 'delete-with-closing-bracket)

Pressing C-d does not call the delete-with-closing-bracket function :(.

Thanks!
Nathan


Kevin Rodgers-2 wrote:
> 
> TheLonelyStar wrote:
>> Hi,
>> 
>> I feel like I posted this question a few days ago... but I can not find
>> it
>> in the forum. I hope I am not double posting.
>> 
>> I want to create a keymap, set some keys in it and enable/disable it "on
>> the
>> fly".
>> I tried:
>> (setq my-keymap (make-sparse-keymap))
>> (defvar my-keymap-enabled)
>> (setq minor-mode-map-alist (cons '(my-keymap-enabled . my-keymap)
>> minor-mode-map-alist))
>> (setq my-keymap-enabled t)
>> 
>> But when I set a key using
>> (define-key my-keymap (kbd "{") 'curly-bracket)
>> 
>> The { key is not bound to "curly-bracket".
>> What am I doing wrong?
> 
> The symbol my-keymap is not a keymap, its value is a keymap:
> 
> (setq minor-mode-map-alist
>        (cons `(my-keymap-enabled . ,my-keymap) minor-mode-map-alist))
> 
> -- 
> Kevin Rodgers
> Denver, Colorado, USA
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Enabling-and-disabling-my-own-keymap-tp17401325p17404824.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





reply via email to

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