From: Jambunathan K <kjambunathan@gmail.com>
To: clh@pobox.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Looking for the "best" notation for key-binding
Date: Mon, 01 Oct 2012 20:01:49 +0530 [thread overview]
Message-ID: <87626u1cx6.fsf@gmail.com> (raw)
In-Reply-To: <505BA2B4.7090906@me.com> (Chap Harrison's message of "Thu, 20 Sep 2012 17:11:48 -0600")
Chap Harrison <chap.harrison@me.com> writes:
> Here are examples of key bindings culled from the Emacs FAQ and
> emacswiki. Each one seems to use a slightly different notation to
> identify the keystroke.
>
> (global-set-key (quote [f1]) (quote help-for-help))
> (global-unset-key [?\e?{] )
> (global-set-key [f10] [?\C-x?\e?\e?\C-a?\C-k?\C-g])
> (global-unset-key "\e[" )
> (global-set-key "\C-h" 'delete-backward-char)
> (keyboard-translate ?\C-h ?\C-?)
> (global-set-key (kbd "C-V") 'somefunction)
> (global-set-key (kbd "<f3>") 'comment-dwim)
>
> It's maddening. I've so far been unsuccessful in getting this binding
> to work:
>
> (global-set-key (kbd "C-;") 'comment-indent)
>
> It seems to bind the command to the *unmodified* ';'.
>
> Isn't there a single, simple, consistent way to create key bindings
> that will always work?
>
Use M-x global-set-key RET (or M-x local-set-key RET) and follow the
prompt.
Then M-x list-command-history. You will see the required elisp.
Here is what I get:
,----
| (global-set-key [67108923] (quote comment-indent))
`----
Will above representation work across different platforms or different
invocations of Emacs (terminal/gui/remote). I don't know and I would
like to know.
I can assure you that it will get the job done.
Likewise for local-set-key.
That said, in the long-run, it is better to not meddle with
Emacs-provided bindings.
> Thanks,
> Chap
>
>
--
prev parent reply other threads:[~2012-10-01 14:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-20 23:11 Looking for the "best" notation for key-binding Chap Harrison
2012-09-21 0:30 ` John Wiegley
[not found] ` <mailman.9409.1348187445.855.help-gnu-emacs@gnu.org>
2012-09-21 0:45 ` B. T. Raven
2012-09-21 9:24 ` Peter Dyballa
2012-09-21 15:27 ` Chap Harrison
2012-10-19 3:39 ` Kevin Rodgers
[not found] ` <mailman.9433.1348219496.855.help-gnu-emacs@gnu.org>
2012-09-21 13:29 ` Stefan Monnier
2012-09-21 14:59 ` Peter Dyballa
2012-09-21 16:29 ` Stefan Monnier
2012-09-21 20:37 ` Peter Dyballa
2012-10-01 14:31 ` Jambunathan K [this message]
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=87626u1cx6.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=clh@pobox.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.