emacs-devel
[Top][All Lists]
Advanced

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

setting to allow C-g to quit in C-h k


From: Karl Chen
Subject: setting to allow C-g to quit in C-h k
Date: Fri, 27 Sep 2002 23:53:50 -0700 (PDT)

Please consider this patch which adds a customizable variable to allow
quitting `describe-key' (C-h k) with `keyboard-quit' (C-g) at the
interactive prompt.  The default behavior is unchanged.

Index: help.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help.el,v
retrieving revision 1.252
diff -u -u -r1.252 help.el
--- help.el     16 Jul 2002 16:08:44 -0000      1.252
+++ help.el     28 Sep 2002 06:48:18 -0000
@@ -506,6 +506,17 @@
                         (if (symbolp defn) defn (prin1-to-string defn)))))))))


+(defcustom help-keyboard-quit-quits nil
+  "*If non-nil, hitting \\[keyboard-quit] in `describe-key' quits.
+
+If nil (default), hitting \\[keyboard-quit] describes `keyboard-quit'.
+`describe-key' is not affected when called non-interactively with a key
+binding for `keyboard-quit'.  `describe-key-briefly' is never affected and
+always briefly describes `keyboard-quit'."
+  :group 'help
+  :version "21.3"
+  :type 'boolean)
+
 (defun describe-key (key &optional untranslated)
   "Display documentation of the function invoked by KEY.
 KEY should be a key sequence--when calling from a program,
@@ -532,6 +543,10 @@
       (let ((defn (or (string-key-binding key) (key-binding key))))
        (if (or (null defn) (integerp defn) (equal defn 'undefined))
            (message "%s is undefined" (help-key-description key untranslated))
+          (if (and (interactive-p)
+                   help-keyboard-quit-quits
+                   (eq defn 'keyboard-quit))
+              (keyboard-quit))
          (help-setup-xref (list #'describe-function defn) (interactive-p))
          (with-output-to-temp-buffer (help-buffer)
            (princ (help-key-description key untranslated))

-- 
Karl Chen / address@hidden






reply via email to

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