From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schroeder Newsgroups: gmane.emacs.devel Subject: Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..) Date: Mon, 02 Sep 2002 23:55:16 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <87sn0scb0b.fsf@emacswiki.org> References: <200208271621.g7RGLNm30516@rum.cs.yale.edu> <5xhehfe3aj.fsf@kfs2.cua.dk> <874rdfaytt.fsf@pot.cnuce.cnr.it> <5xvg5sh06u.fsf@kfs2.cua.dk> <20020830235528.GA13207@gnu.org> <87ofbji88u.fsf@emacswiki.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1031003663 28047 127.0.0.1 (2 Sep 2002 21:54:23 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 2 Sep 2002 21:54:23 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17lz9J-0007IG-00 for ; Mon, 02 Sep 2002 23:54:21 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17lzhi-000290-00 for ; Tue, 03 Sep 2002 00:29:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17lzAl-0005GH-00; Mon, 02 Sep 2002 17:55:51 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17lz8F-0004KN-00 for emacs-devel@gnu.org; Mon, 02 Sep 2002 17:53:15 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17lz8B-0004Ay-00 for emacs-devel@gnu.org; Mon, 02 Sep 2002 17:53:13 -0400 Original-Received: from relay01.cablecom.net ([62.2.33.101]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17lz8A-00047V-00 for emacs-devel@gnu.org; Mon, 02 Sep 2002 17:53:10 -0400 Original-Received: from smtp.swissonline.ch (mail-4.swissonline.ch [62.2.32.85]) by relay01.cablecom.net (8.12.5/8.12.5/SOL/AWF/MXRELAY/20020820) with ESMTP id g82Lr820045735 for ; Mon, 2 Sep 2002 23:53:08 +0200 (CEST) (envelope-from alex@emacswiki.org) Original-Received: from confusibombus (dclient217-162-239-43.hispeed.ch [217.162.239.43]) by smtp.swissonline.ch (8.11.6/8.11.6/SMTPSOL/AWF/2002040101) with ESMTP id g82Lr8H06337 for ; Mon, 2 Sep 2002 23:53:08 +0200 (MEST) Original-Received: from alex by confusibombus with local (Exim 3.35 #1 (Debian)) id 17lzAC-0000Bh-00 for ; Mon, 02 Sep 2002 23:55:16 +0200 Original-To: emacs-devel@gnu.org X-Face: ^BC$`[IcggstLPyen&dqF+b2'zyK#r.mU*'Nms}@&4zw%SJ#5!/7SMVjBS7'lb;QK)|IPU5U'o1'522W4TyzB3Ab*IBo^iw]l4|kUbdZuUDO6=Um-.4IzhNiV'B"@K#jy_(wW|Zbk[34flKY^|PrQ?$u2\fKg^]AY>wOX#H32i In-Reply-To: (Per Abrahamsen's message of "Mon, 02 Sep 2002 18:40:03 +0200") Original-Lines: 51 User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:7345 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:7345 Per Abrahamsen writes: > (defcustom global-key-bindings nil ... Cool, it works (after adding a paren at the right place). How about this addition. A side note: Why is the default value for function types the string "ignore"? Alex. (defvar custom-global-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map global-map) map) "Global keymap for use by customize.") (defcustom global-key-bindings nil "Global keybindings defined through customize. While entering the name of a key, you can either type keys yourself just as they appear in the manual, as in C-c a. You must use angle brackets for function keys, as in . The easiest thing is probably to hit C-q and then just type the key. C-q will insert the correct string representation for you. While entering the name of a command, you can use M-TAB to comlete the function name." ;; Note that we cannot use \\[quoted-key-insert] because the keymap ;; is not the same. :type '(repeat (group (string :tag "Key") (function))) :set (lambda (sym val) (set-default sym val) (setq custom-global-keymap (make-sparse-keymap)) (set-keymap-parent custom-global-keymap global-map) (mapc (lambda (bind) (define-key custom-global-keymap (read-kbd-macro (car bind)) (cadr bind))) val) (use-global-map custom-global-keymap) val)) (defun quoted-key-insert (key) "Insert a string representation of the next key typed. The string representation is a representation understood by `read-kbd-macro'." (interactive "KPress a key: ") (insert (edmacro-format-keys key))) (define-key custom-global-keymap (kbd "C-q") 'quoted-key-insert) Alex.