]> code.delx.au - gnu-emacs/blobdiff - lisp/novice.el
Wrap around error in coreutil's ls
[gnu-emacs] / lisp / novice.el
index fa41b2bbc1e5f7c8adee9e961676255fefc55368..1600d14d5fc32206641c8bdb01d0a8c9703d6a25 100644 (file)
@@ -1,8 +1,9 @@
 ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs
 
-;; Copyright (C) 1985-1987, 1994, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1994, 2001-2016 Free Software Foundation,
+;; Inc.
 
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: internal, help
 
 ;; This file is part of GNU Emacs.
@@ -33,8 +34,6 @@
 ;; The command is found in this-command
 ;; and the keys are returned by (this-command-keys).
 
-(eval-when-compile (require 'cl))
-
 ;;;###autoload
 (define-obsolete-variable-alias 'disabled-command-hook
   'disabled-command-function "22.1")
@@ -51,7 +50,6 @@ If nil, the feature is disabled, i.e., all commands work normally.")
   (unless keys (setq keys (this-command-keys)))
   (let (char)
     (save-window-excursion
-      (help-setup-xref (list 'disabled-command-function cmd keys) nil)
       (with-output-to-temp-buffer "*Disabled Command*" ;; (help-buffer)
         (if (or (eq (aref keys 0)
                     (if (stringp keys)
@@ -67,7 +65,8 @@ If nil, the feature is disabled, i.e., all commands work normally.")
        (if (stringp (get cmd 'disabled))
            (princ (get cmd 'disabled))
         (princ "It is disabled because new users often find it confusing.\n")
-        (princ "Here's the first part of its description:\n\n")
+        (princ (substitute-command-keys
+                "Here's the first part of its description:\n\n"))
         ;; Keep only the first paragraph of the documentation.
           (with-current-buffer "*Disabled Command*" ;; standard-output
           (goto-char (point-max))
@@ -82,11 +81,11 @@ If nil, the feature is disabled, i.e., all commands work normally.")
             (goto-char (point-max))
             (indent-rigidly start (point) 3))))
        (princ "\n\nDo you want to use this command anyway?\n\n")
-       (princ "You can now type
+       (princ (substitute-command-keys "You can now type
 y   to try it and enable it (no questions if you use it again).
 n   to cancel--don't try the command, and it remains disabled.
 SPC to try the command just this once, but leave it disabled.
-!   to try it, and enable all disabled commands for this session only.")
+!   to try it, and enable all disabled commands for this session only."))
         ;; Redundant since with-output-to-temp-buffer will do it anyway.
         ;; (with-current-buffer standard-output
         ;;   (help-mode))
@@ -101,7 +100,7 @@ SPC to try the command just this once, but leave it disabled.
         (ding)
         (message "Please type y, n, ! or SPC (the space bar): "))))
     (setq char (downcase char))
-    (case char
+    (pcase char
      (?\C-g (setq quit-flag t))
      (?! (setq disabled-command-function nil))
      (?y
@@ -161,8 +160,8 @@ to future sessions."
 (defun disable-command (command)
   "Require special confirmation to execute COMMAND from now on.
 COMMAND must be a symbol.
-This command alters the user's .emacs file so that this will apply
-to future sessions."
+This command alters your init file so that this choice applies to
+future sessions."
   (interactive "CDisable command: ")
   (en/disable-command command t))