From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: C-z (Re: Two GTK related feature requests) Date: Mon, 27 Oct 2003 12:44:10 -0700 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <3F9D758A.1030802@yahoo.com> References: <87oew8so3g.fsf@cs.cmu.edu> <87brs2prhi.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1067284229 13117 80.91.224.253 (27 Oct 2003 19:50:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 27 Oct 2003 19:50:29 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Oct 27 20:50:26 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AEDNi-0005JF-00 for ; Mon, 27 Oct 2003 20:50:26 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AEDNh-0003J8-00 for ; Mon, 27 Oct 2003 20:50:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AEDJZ-0002UE-DF for emacs-devel@quimby.gnus.org; Mon, 27 Oct 2003 14:46:09 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AEDIF-0002S7-Ur for emacs-devel@gnu.org; Mon, 27 Oct 2003 14:44:47 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AEDHj-00022I-4A for emacs-devel@gnu.org; Mon, 27 Oct 2003 14:44:46 -0500 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AEDHg-0001yA-Rw for emacs-devel@gnu.org; Mon, 27 Oct 2003 14:44:13 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AEDHf-0003AC-00 for ; Mon, 27 Oct 2003 20:44:11 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AEDHe-0003A4-00 for ; Mon, 27 Oct 2003 20:44:10 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AEDHd-00035R-00 for ; Mon, 27 Oct 2003 20:44:09 +0100 Original-Lines: 35 Original-X-Complaints-To: usenet@sea.gmane.org User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:17470 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17470 Juri Linkov wrote: > Here is what I have in .emacs: > > (defvar my-map nil) > (if (not my-map) > (let ((c-z (global-key-binding "\C-z"))) > (global-unset-key "\C-z") > (setq my-map (make-sparse-keymap)) > (define-key global-map "\C-z" my-map) > (define-key my-map "\C-z" c-z))) > (define-key my-map "t" ...) > ... > > BTW, I once had one problem with this code. Before I added `if' condition, > this code was called twice on the Emacs startup and created the cyclic > keymap. The double loading was caused by the bug in the function > `command-line' in lisp/startup.el: I can't argue about the bug, but the recommended way to do that is: (defvar my-map (let ((map (make-sparse-keymap)) (c-z (global-key-binding "\C-z"))) (global-unset-key "\C-z") (define-key global-map "\C-z" my-map) (define-key map "\C-z" c-z) map)) (define-key my-map "t" ...) Or maybe there's even a better way, using define-prefix-command. -- Kevin Rodgers