[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: Juri Linkov
Subject: Re: C-z (Re: Two GTK related feature requests)
Date: 27 Oct 2003 18:36:41 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Robert J. Chassell" <address@hidden> writes:
> One possibility is to make it a prefix reserved for users,
> like C-c followed by a letter.

This is what I used for many years.  I use the prefix key `C-z' for my
additional keymap.  On qwerty-keyboards `C-z' is one of the most
accessible keys like `C-x' and `C-c', but the prefix key `C-c' is
reserved for mode-specific commands (both user-defined and standard
Emacs extensions).  I reassigned the previous binding of `C-z'
(`suspend-emacs' or `iconify-or-deiconify-frame') to double key
sequence `C-z C-z'.

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:

                      (when (stringp custom-file)
                        (unless (assoc custom-file load-history)
                          ;; If the .emacs file has set `custom-file' but hasn't
                          ;; loaded the file yet, let's load it.
                          (load custom-file t t)))

If .emacs contains the following code:

(setq custom-file "/home/full/path/dotemacs.el")
(add-to-list 'load-path "/home/full/path/)
(load "dotemacs")

then the above condition in the startup.el fails, because the variable
`custom-file' has the absolute file name, whereas `load-history'
has the file name without directory, i.e.

(assoc "/home/full/path/dotemacs.el" (("dotemacs.el" ...) ...))

I think that either this code should be fixed, or the documentation
of the variable `custom-file' should be improved to warn about this


reply via email to

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