aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-09-27 21:17:00 +0000
committerRichard M. Stallman1998-09-27 21:17:00 +0000
commit527a0902ee10ae3733a10fed6b6c6ec0b13c22e2 (patch)
treea3f79b3490b2a19a7f843c7a9236c0cc7a28bb8a
parent8c10f3e47479c083930de7abe9347b22c764d475 (diff)
downloademacs-527a0902ee10ae3733a10fed6b6c6ec0b13c22e2.tar.gz
emacs-527a0902ee10ae3733a10fed6b6c6ec0b13c22e2.zip
(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.
-rw-r--r--lisp/help-macro.el21
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
84When invoked, FNAME shows HELP-LINE and reads a command using HELPED-MAP. 84When invoked, FNAME shows HELP-LINE and reads a command using HELPED-MAP.
85If the command is the help character, FNAME displays HELP-TEXT 85If the command is the help character, FNAME displays HELP-TEXT
86and continues trying to read a command using HELPED-MAP. 86and continues trying to read a command using HELPED-MAP.
87If HELP-TEXT contains the sequence `%THIS-KEY%', that is replaced
88with the key sequence that invoked FNAME.
87When FNAME finally does get a command, it executes that command 89When FNAME finally does get a command, it executes that command
88and then returns." 90and then returns."
89 (` (defun (, fname) () 91 (let ((doc-fn (intern (concat (symbol-name fname) "-doc"))))
90 (, help-text) 92 `(progn
93 (defun ,doc-fn () ,help-text)
94 (defun ,fname ()
95 "Help command."
91 (interactive) 96 (interactive)
92 (let ((line-prompt 97 (let ((line-prompt
93 (substitute-command-keys (, help-line)))) 98 (substitute-command-keys ,help-line)))
94 (if three-step-help 99 (if three-step-help
95 (message "%s" line-prompt)) 100 (message "%s" line-prompt))
96 (let* ((help-screen (documentation (quote (, fname)))) 101 (let* ((help-screen (documentation (quote ,doc-fn)))
97 ;; We bind overriding-local-map for very small 102 ;; We bind overriding-local-map for very small
98 ;; sections, *excluding* where we switch buffers 103 ;; sections, *excluding* where we switch buffers
99 ;; and where we execute the chosen help command. 104 ;; and where we execute the chosen help command.
@@ -101,9 +106,13 @@ and then returns."
101 (minor-mode-map-alist nil) 106 (minor-mode-map-alist nil)
102 (prev-frame (selected-frame)) 107 (prev-frame (selected-frame))
103 config new-frame key char) 108 config new-frame key char)
109 (if (string-match "%THIS-KEY%" help-screen)
110 (setq help-screen
111 (replace-match (key-description (substring (this-command-keys) 0 -1))
112 t t help-screen)))
104 (unwind-protect 113 (unwind-protect
105 (progn 114 (progn
106 (setcdr local-map (, helped-map)) 115 (setcdr local-map ,helped-map)
107 (define-key local-map [t] 'undefined) 116 (define-key local-map [t] 'undefined)
108 ;; Make the scroll bar keep working normally. 117 ;; Make the scroll bar keep working normally.
109 (define-key local-map [vertical-scroll-bar] 118 (define-key local-map [vertical-scroll-bar]
@@ -182,7 +191,7 @@ and then returns."
182 (if new-frame (iconify-frame new-frame)) 191 (if new-frame (iconify-frame new-frame))
183 (if config 192 (if config
184 (set-window-configuration config)))))) 193 (set-window-configuration config))))))
185 )) 194 )))
186 195
187;;; help-macro.el 196;;; help-macro.el
188 197