aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-02-14 09:08:40 +0000
committerRichard M. Stallman1995-02-14 09:08:40 +0000
commite27ef4db6ea45b28d819622dd3334b3388c5b91a (patch)
tree4e62d1215a1b3aff616667293f9796cd04d9a977
parent0c0b6c79117558ce932f2c262aab686f50c306eb (diff)
downloademacs-e27ef4db6ea45b28d819622dd3334b3388c5b91a.tar.gz
emacs-e27ef4db6ea45b28d819622dd3334b3388c5b91a.zip
(electric-help-help, electric-help-command-loop):
Mention q and r, not Q and R. (electric-help-map): Use supress-keymap instead of filling keymap with undefined commands. Bind R like r. Substitute electric-command-apropos for command-apropos. (electric-apropos): New function. (electric-help-help, electric-help-command-loop): Mention Q and R in messages.
-rw-r--r--lisp/ehelp.el45
1 files changed, 24 insertions, 21 deletions
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index 1dc181e198e..e9cbcde3ba1 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -39,8 +39,8 @@
39(if electric-help-map 39(if electric-help-map
40 () 40 ()
41 (let ((map (make-keymap))) 41 (let ((map (make-keymap)))
42 (fillarray (car (cdr map)) 'electric-help-undefined) 42 ;; allow all non-self-inserting keys - search, scroll, etc
43 (define-key map (char-to-string meta-prefix-char) (copy-keymap map)) 43 (suppress-keymap map)
44 (define-key map (char-to-string help-char) 'electric-help-help) 44 (define-key map (char-to-string help-char) 'electric-help-help)
45 (define-key map "?" 'electric-help-help) 45 (define-key map "?" 'electric-help-help)
46 (define-key map " " 'scroll-up) 46 (define-key map " " 'scroll-up)
@@ -53,6 +53,7 @@
53 (define-key map "Q" 'electric-help-exit) 53 (define-key map "Q" 'electric-help-exit)
54 ;;a better key than this? 54 ;;a better key than this?
55 (define-key map "r" 'electric-help-retain) 55 (define-key map "r" 'electric-help-retain)
56 (define-key map "R" 'electric-help-retain)
56 57
57 (setq electric-help-map map))) 58 (setq electric-help-map map)))
58 59
@@ -126,7 +127,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit"
126(defun electric-help-command-loop () 127(defun electric-help-command-loop ()
127 (catch 'exit 128 (catch 'exit
128 (if (pos-visible-in-window-p (point-max)) 129 (if (pos-visible-in-window-p (point-max))
129 (progn (message "<<< Press Space to bury the help buffer >>>") 130 (progn (message (substitute-command-keys "<<< Press Space to bury the help buffer, Press \\[electric-help-retain] to retain it >>>"))
130 (if (equal (setq unread-command-events (list (read-event))) 131 (if (equal (setq unread-command-events (list (read-event)))
131 '(?\ )) 132 '(?\ ))
132 (progn (setq unread-command-events nil) 133 (progn (setq unread-command-events nil)
@@ -136,31 +137,31 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit"
136 'scroll-up) 137 'scroll-up)
137 (eq (key-binding "\^?") 138 (eq (key-binding "\^?")
138 'scroll-down) 139 'scroll-down)
139 (eq (key-binding "Q")
140 'electric-help-exit)
141 (eq (key-binding "q") 140 (eq (key-binding "q")
142 'electric-help-exit)))) 141 'electric-help-exit)
142 (eq (key-binding "r")
143 'electric-help-retain))))
143 (Electric-command-loop 144 (Electric-command-loop
144 'exit 145 'exit
145 (function (lambda () 146 (function (lambda ()
146 (let ((min (pos-visible-in-window-p (point-min))) 147 (let ((min (pos-visible-in-window-p (point-min)))
147 (max (pos-visible-in-window-p (point-max)))) 148 (max (pos-visible-in-window-p (point-max))))
148 (cond ((and min max) 149 (cond ((and min max)
149 (cond (standard "Press Q to exit ") 150 (cond (standard "Press q to exit, r to retain ")
150 (neither) 151 (neither)
151 (t (setq neither (substitute-command-keys "Press \\[scroll-up] to exit "))))) 152 (t (setq neither (substitute-command-keys "Press \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
152 (min 153 (min
153 (cond (standard "Press SPC to scroll, Q to exit ") 154 (cond (standard "Press SPC to scroll, q to exit, r to retain ")
154 (up) 155 (up)
155 (t (setq up (substitute-command-keys "Press \\[scroll-up] to scroll; \\[electric-help-exit] to exit "))))) 156 (t (setq up (substitute-command-keys "Press \\[scroll-up] to scroll, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
156 (max 157 (max
157 (cond (standard "Press DEL to scroll back, Q to exit ") 158 (cond (standard "Press DEL to scroll back, q to exit ")
158 (down) 159 (down)
159 (t (setq down (substitute-command-keys "Press \\[scroll-down] to scroll back, \\[scroll-up] to exit "))))) 160 (t (setq down (substitute-command-keys "Press \\[scroll-down] to scroll back, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))
160 (t 161 (t
161 (cond (standard "Press SPC to scroll, DEL to scroll back, Q to exit ") 162 (cond (standard "Press SPC to scroll, DEL to scroll back, q to exit ")
162 (both) 163 (both)
163 (t (setq both (substitute-command-keys "Press \\[scroll-up] to scroll, \\[scroll-down] to scroll back, \\[electric-help-exit] to exit "))))))))) 164 (t (setq both (substitute-command-keys "Press \\[scroll-up] to scroll, \\[scroll-down] to scroll back, \\[electric-help-exit] to exit, \\[electric-help-retain] to retain ")))))))))
164 t)))) 165 t))))
165 166
166 167
@@ -197,14 +198,12 @@ will select it.)"
197;>>> this needs to be hairified (recursive help, anybody?) 198;>>> this needs to be hairified (recursive help, anybody?)
198(defun electric-help-help () 199(defun electric-help-help ()
199 (interactive) 200 (interactive)
200 (if (and (eq (key-binding "Q") 'electric-help-exit) 201 (if (and (eq (key-binding "q") 'electric-help-exit)
201 (eq (key-binding " ") 'scroll-up) 202 (eq (key-binding " ") 'scroll-up)
202 (eq (key-binding "\^?") 'scroll-down)) 203 (eq (key-binding "\^?") 'scroll-down)
203 (message "SPC scrolls forward, DEL scrolls back, Q exits and burys help buffer") 204 (eq (key-binding "r") 'electric-help-retain))
204 ;; to give something for user to look at while slow substitute-cmd-keys 205 (message "SPC scrolls up, DEL scrolls down, q exits burying help buffer, r exits")
205 ;; grinds away 206 (message "%s" (substitute-command-keys "\\[scroll-up] scrolls up, \\[scroll-down] scrolls down, \\[electric-help-exit] exits burying help buffer, \\[electric-help-retain] exits")))
206 (message "Help...")
207 (message "%s" (substitute-command-keys "\\[scroll-up] scrolls forward, \\[scroll-down] scrolls back, \\[electric-help-exit] exits.")))
208 (sit-for 2)) 207 (sit-for 2))
209 208
210 209
@@ -299,6 +298,9 @@ will select it.)"
299 298
300;(define-key help-map "a" 'electric-command-apropos) 299;(define-key help-map "a" 'electric-command-apropos)
301 300
301(defun electric-apropos ()
302 (interactive)
303 (electric-helpify 'apropos))
302 304
303 305
304;;;; ehelp-map 306;;;; ehelp-map
@@ -307,6 +309,7 @@ will select it.)"
307(if ehelp-map 309(if ehelp-map
308 nil 310 nil
309 (let ((map (copy-keymap help-map))) 311 (let ((map (copy-keymap help-map)))
312 (substitute-key-definition 'command-apropos 'electric-command-apropos map)
310 (substitute-key-definition 'describe-key 'electric-describe-key map) 313 (substitute-key-definition 'describe-key 'electric-describe-key map)
311 (substitute-key-definition 'describe-mode 'electric-describe-mode map) 314 (substitute-key-definition 'describe-mode 'electric-describe-mode map)
312 (substitute-key-definition 'view-lossage 'electric-view-lossage map) 315 (substitute-key-definition 'view-lossage 'electric-view-lossage map)