[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-z (Re: Two GTK related feature requests)

From: Kevin Rodgers
Subject: Re: C-z (Re: Two GTK related feature requests)
Date: Mon, 27 Oct 2003 12:44:10 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv: Gecko/20020406 Netscape6/6.2.2

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)

(define-key my-map "t" ...)

Or maybe there's even a better way, using define-prefix-command.
Kevin Rodgers

reply via email to

[Prev in Thread] Current Thread [Next in Thread]