diff options
author | Richard M. Stallman <rms@gnu.org> | 1998-09-27 21:17:00 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1998-09-27 21:17:00 +0000 |
commit | 527a0902ee10ae3733a10fed6b6c6ec0b13c22e2 (patch) | |
tree | a3f79b3490b2a19a7f843c7a9236c0cc7a28bb8a /lisp/help-macro.el | |
parent | 8c10f3e47479c083930de7abe9347b22c764d475 (diff) | |
download | emacs-527a0902ee10ae3733a10fed6b6c6ec0b13c22e2.tar.gz |
(make-help-screen): Keep HELP-TEXT
in a separate function definition, not in the help command FNAME.
Replace %THIS-KEY% with the key sequence that ran FNAME.
Diffstat (limited to 'lisp/help-macro.el')
-rw-r--r-- | lisp/help-macro.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/help-macro.el b/lisp/help-macro.el index 366466142de..3a04fa65b2b 100644 --- a/lisp/help-macro.el +++ b/lisp/help-macro.el @@ -84,16 +84,21 @@ A value of nil means skip the middle step, so that When invoked, FNAME shows HELP-LINE and reads a command using HELPED-MAP. If the command is the help character, FNAME displays HELP-TEXT and continues trying to read a command using HELPED-MAP. +If HELP-TEXT contains the sequence `%THIS-KEY%', that is replaced +with the key sequence that invoked FNAME. When FNAME finally does get a command, it executes that command and then returns." - (` (defun (, fname) () - (, help-text) + (let ((doc-fn (intern (concat (symbol-name fname) "-doc")))) + `(progn + (defun ,doc-fn () ,help-text) + (defun ,fname () + "Help command." (interactive) (let ((line-prompt - (substitute-command-keys (, help-line)))) + (substitute-command-keys ,help-line))) (if three-step-help (message "%s" line-prompt)) - (let* ((help-screen (documentation (quote (, fname)))) + (let* ((help-screen (documentation (quote ,doc-fn))) ;; We bind overriding-local-map for very small ;; sections, *excluding* where we switch buffers ;; and where we execute the chosen help command. @@ -101,9 +106,13 @@ and then returns." (minor-mode-map-alist nil) (prev-frame (selected-frame)) config new-frame key char) + (if (string-match "%THIS-KEY%" help-screen) + (setq help-screen + (replace-match (key-description (substring (this-command-keys) 0 -1)) + t t help-screen))) (unwind-protect (progn - (setcdr local-map (, helped-map)) + (setcdr local-map ,helped-map) (define-key local-map [t] 'undefined) ;; Make the scroll bar keep working normally. (define-key local-map [vertical-scroll-bar] @@ -182,7 +191,7 @@ and then returns." (if new-frame (iconify-frame new-frame)) (if config (set-window-configuration config)))))) - )) + ))) ;;; help-macro.el |