[Top][All Lists]

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

Re: Making C-t act like C-x sometimes

From: Deniz Dogan
Subject: Re: Making C-t act like C-x sometimes
Date: Thu, 22 Jul 2010 14:57:18 +0200

2010/7/22 Teemu Likonen <address@hidden>:
> * 2010-07-22 12:37 (+0200), Deniz Dogan wrote:
>> I'm struggling trying to make my C-t act like the C-x prefix in all
>> cases but C-t C-n (C-x C-n is set-goal-column).
>> (global-unset-key (kbd "C-t"))
>> (global-set-key (kbd "C-t") ctl-x-map)
>> (global-set-key (kbd "C-t C-n") nil)
>> (global-set-key (kbd "C-x C-n") 'set-goal-column)
>> This does not work. Both C-t C-n and C-x C-n are now bound to
>> set-goal-column. It seems that I can only have C-t C-n AND C-x C-n,
>> not only C-x C-n.
> That's how it works. :-) In your examples both C-x and C-t are prefix
> keys to the same keymap: ctl-x-map. To make them different keymaps you
> need to copy the map:
>    ;; Copy ctl-x-map
>    (setq my-ctl-t-map (copy-keymap ctl-x-map))
>    ;; Make global C-t the prefix for the new map
>    (global-set-key (kbd "C-t") my-ctl-t-map)
> Now keys in those two maps can be defined separately:
>    (define-key my-ctl-t-map (kbd "C-n")
>      #'(lambda () (interactive)
>          (message "Pling!")))
>    (define-key ctl-x-map (kbd "C-n")
>      #'(lambda () (interactive)
>          (message "Plong!")))

Derr, of course.


reply via email to

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