[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Looking for the "best" notation for key-binding
From: |
Jambunathan K |
Subject: |
Re: Looking for the "best" notation for key-binding |
Date: |
Mon, 01 Oct 2012 20:01:49 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
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
>
>
--
- Re: Looking for the "best" notation for key-binding,
Jambunathan K <=