* Enabling and disabling my own keymap
@ 2008-05-22 10:18 TheLonelyStar
2008-05-22 12:17 ` Kevin Rodgers
0 siblings, 1 reply; 4+ messages in thread
From: TheLonelyStar @ 2008-05-22 10:18 UTC (permalink / raw)
To: Help-gnu-emacs
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?
Thanks!
Nathan
--
View this message in context: http://www.nabble.com/Enabling-and-disabling-my-own-keymap-tp17401325p17401325.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Enabling and disabling my own keymap
2008-05-22 10:18 Enabling and disabling my own keymap TheLonelyStar
@ 2008-05-22 12:17 ` Kevin Rodgers
2008-05-22 13:57 ` TheLonelyStar
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2008-05-22 12:17 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Enabling and disabling my own keymap
2008-05-22 12:17 ` Kevin Rodgers
@ 2008-05-22 13:57 ` TheLonelyStar
2008-05-23 4:27 ` Kevin Rodgers
0 siblings, 1 reply; 4+ messages in thread
From: TheLonelyStar @ 2008-05-22 13:57 UTC (permalink / raw)
To: Help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Enabling and disabling my own keymap
2008-05-22 13:57 ` TheLonelyStar
@ 2008-05-23 4:27 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2008-05-23 4:27 UTC (permalink / raw)
To: help-gnu-emacs
[Please don't top-post.]
TheLonelyStar wrote:
> 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 :(.
Perhaps because you changed the code I posted:
(setq minor-mode-map-alist
(cons `(my-keymap-enabled . ,my-keymap) minor-mode-map-alist))
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-23 4:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22 10:18 Enabling and disabling my own keymap TheLonelyStar
2008-05-22 12:17 ` Kevin Rodgers
2008-05-22 13:57 ` TheLonelyStar
2008-05-23 4:27 ` Kevin Rodgers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).