From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: Looking for the "best" notation for key-binding Date: Mon, 01 Oct 2012 20:01:49 +0530 Message-ID: <87626u1cx6.fsf@gmail.com> References: <505BA2B4.7090906@me.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1349101857 29777 80.91.229.3 (1 Oct 2012 14:30:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Oct 2012 14:30:57 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: clh@pobox.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 01 16:31:02 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TIh1P-0008D9-Ko for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Oct 2012 16:30:59 +0200 Original-Received: from localhost ([::1]:35459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIh1K-0006bf-3a for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Oct 2012 10:30:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIh1A-0006bY-S4 for help-gnu-emacs@gnu.org; Mon, 01 Oct 2012 10:30:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIh0z-0002Lw-7z for help-gnu-emacs@gnu.org; Mon, 01 Oct 2012 10:30:44 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:35309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIh0z-0002Jw-0p for help-gnu-emacs@gnu.org; Mon, 01 Oct 2012 10:30:33 -0400 Original-Received: by pbbrq2 with SMTP id rq2so8400416pbb.0 for ; Mon, 01 Oct 2012 07:30:31 -0700 (PDT) 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== Original-Received: by 10.66.81.103 with SMTP id z7mr10772594pax.57.1349101831412; Mon, 01 Oct 2012 07:30:31 -0700 (PDT) Original-Received: from debian-6.05 ([101.62.114.180]) by mx.google.com with ESMTPS id sa2sm7644394pbc.4.2012.10.01.07.30.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Oct 2012 07:30:29 -0700 (PDT) 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-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87020 Archived-At: Chap Harrison 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 "") '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 > > --