Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Looking for the "best" notation for key-binding

Received: by 10.66.75.39 with SMTP id z7mr4793814pav.26.1349101852499;
        Mon, 01 Oct 2012 07:30:52 -0700 (PDT)
Path: g9ni10824pbh.1!nntp.google.com!news.glorb.com!usenet.stanford.edu!not-for-mail
From: Jambunathan K <kjambunat...@gmail.com>
Newsgroups: gnu.emacs.help
Subject: Re: Looking for the "best" notation for key-binding
Date: Mon, 01 Oct 2012 20:01:49 +0530
Lines: 55
Approved: help-gnu-em...@gnu.org
Message-ID: <mailman.10073.1349101851.855.help-gnu-emacs@gnu.org>
References: <505BA2B4.7090906@me.com>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
X-Trace: usenet.stanford.edu 1349101852 32054 208.118.235.17 (1 Oct 2012 14:30:52 GMT)
X-Complaints-To: action@cs.stanford.edu
Cc: help-gnu-em...@gnu.org
To: c...@pobox.com
Envelope-to: help-gnu-em...@gnu.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:cc:subject:in-reply-to:references:user-agent:date
	:message-id:mime-version:content-type;
	bh=fJpXmSeO1i2GoV12i2puhMpIlaAcGwUHuCck7OVDmvA=;
	b=q82v+Aku3tL1rkdI+O5PibxYtl73sjhqS2wOU8cOqe2V6DISAgmQN7P0sRLECCZ+Nv
	wGAj6bPUimngOw75DUc+WE7XMGaiImJUBY4+ZBrQhUD6BupRuaf1pIVu1L5HMlV6hRKE
	nli6U2utLl4NUSgVFt8jDSnPE1mpKoAYg7KTowxLnq+EwAucLiboJvhr33oQTM6KvRuh
	0EJ+YyrSHf5icTZ54PBLd5XmKqECAgBXjTkL2JIw/o2Dzd6Ten22+NmvDucxuhRNqKAQ
	cQyV0bPwAIZszda8E6ufgqcfwcpE6Fu/tF5butpZG4K+G3b9ZtfIr2xG0x6kgLvkHjRb
	TTHg==
In-Reply-To: <505BA2B4.7090906@me.com> (Chap Harrison's message of "Thu, 20
	Sep 2012 17:11:48 -0600")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.160.41
X-BeenThere: help-gnu-em...@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
	<mailto:help-gnu-emacs-requ...@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-em...@gnu.org>
List-Help: <mailto:help-gnu-emacs-requ...@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-requ...@gnu.org?subject=subscribe>
Content-Type: text/plain

Chap Harrison <chap.harri...@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
>
>

--