all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Deniz Dogan <deniz.a.m.dogan@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Making C-t act like C-x sometimes
Date: Thu, 22 Jul 2010 13:54:52 +0300	[thread overview]
Message-ID: <87y6d3yef7.fsf@mithlond.arda> (raw)
In-Reply-To: <AANLkTik0JhjGNQ8zIYJMtF0rk57BUL0OtnnpikX4SWlx@mail.gmail.com> (Deniz Dogan's message of "Thu, 22 Jul 2010 12:37:13 +0200")

* 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!")))



  reply	other threads:[~2010-07-22 10:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 10:37 Making C-t act like C-x sometimes Deniz Dogan
2010-07-22 10:54 ` Teemu Likonen [this message]
2010-07-22 12:57   ` Deniz Dogan

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=87y6d3yef7.fsf@mithlond.arda \
    --to=tlikonen@iki.fi \
    --cc=deniz.a.m.dogan@gmail.com \
    --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.