unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: poppyer <poppyer@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: swapping the bindings of TAB and M-i ?
Date: 17 May 2007 13:33:15 +0100	[thread overview]
Message-ID: <bbsl9veik4.fsf@clpc78.comlab> (raw)
In-Reply-To: 87k5v7bvov.fsf@orme.bigwalter.net

Thanks daniel, that is exactly what I want.

However, is there something like any-major-mode-hook? That would be a
perfect solution adding to this.

daniel@bigwalter.net (Daniel Jensen) writes:

> poppyer <poppyer@gmail.com> writes:
> 
> > 	I would like to swap TAB and M-i, i.e.
> > use TAB to do tab-to-tab-stop; and M-i to indent codes.
> > However, the "indent" of current TAB binding is mode-specific.
> > Is there any easy way to do such kind of swap without re-bind the keys
> > mode by mode?
> 
> You can add the following function to the hooks for the major modes you
> want to change. There are ways to do this for every mode, but you
> probably don't want to do that.
> 
> (defun swap-indent-bindings ()
>   (let ((tab-binding (key-binding "\C-i")))
>     (local-set-key "\C-i" (key-binding "\M-i"))
>     (local-set-key "\M-i" tab-binding)))
> 
> (add-hook 'text-mode-hook 'swap-indent-bindings) ; and so on

-- 

  reply	other threads:[~2007-05-17 12:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16 22:21 swapping the bindings of TAB and M-i ? poppyer
2007-05-17 10:17 ` Daniel Jensen
2007-05-17 12:33   ` poppyer [this message]
2007-05-18  8:49     ` Daniel Jensen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bbsl9veik4.fsf@clpc78.comlab \
    --to=poppyer@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.
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).