comparison lisp/help.el @ 2237:2670a8f6a42e

Teach this to use help-screen.el.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Wed, 17 Mar 1993 22:20:57 +0000
parents b275e1b50542
children ad7b89a430df
comparison
equal deleted inserted replaced
2236:c26427fc12e2 2237:2670a8f6a42e
20 ;; You should have received a copy of the GNU General Public License 20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to 21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 23
24 ;;; Code: 24 ;;; Code:
25
26 (require 'help-screen)
25 27
26 (defvar help-map (make-sparse-keymap) 28 (defvar help-map (make-sparse-keymap)
27 "Keymap for characters following the Help key.") 29 "Keymap for characters following the Help key.")
28 30
29 (define-key global-map (char-to-string help-char) 'help-command) 31 (define-key global-map (char-to-string help-char) 'help-command)
200 (while (progn (move-to-column 50) (not (eobp))) 202 (while (progn (move-to-column 50) (not (eobp)))
201 (search-forward " " nil t) 203 (search-forward " " nil t)
202 (insert "\n"))) 204 (insert "\n")))
203 (print-help-return-message))) 205 (print-help-return-message)))
204 206
205 (defun help-for-help () 207 (make-help-screen help-for-help
208 "A B C F I K L M N P S T V W C-c C-d C-n C-w. Type \\[help-for-help] again for more help: "
206 "You have typed \\[help-for-help], the help character. Type a Help option: 209 "You have typed \\[help-for-help], the help character. Type a Help option:
207 210
208 A command-apropos. Give a substring, and see a list of commands 211 A command-apropos. Give a substring, and see a list of commands
209 (functions interactively callable) that contain 212 (functions interactively callable) that contain
210 that substring. See also the apropos command. 213 that substring. See also the apropos command.
228 invoke that command. 231 invoke that command.
229 C-c print Emacs copying permission (General Public License). 232 C-c print Emacs copying permission (General Public License).
230 C-d print Emacs ordering information. 233 C-d print Emacs ordering information.
231 C-n print news of recent Emacs changes. 234 C-n print news of recent Emacs changes.
232 C-w print information on absence of warranty for GNU Emacs." 235 C-w print information on absence of warranty for GNU Emacs."
233 (interactive) 236 help-map)
234 (message (substitute-command-keys
235 "A B C F I K L M N P S T V W C-c C-d C-n C-w. Type \\[help-for-help] again for more help: "))
236 (let ((char (read-char)))
237 (if (or (= char help-char) (= char ??))
238 (save-window-excursion
239 (switch-to-buffer "*Help*")
240 (delete-other-windows)
241 (erase-buffer)
242 (insert (documentation 'help-for-help))
243 (goto-char (point-min))
244 (while (memq char (cons help-char '(?? ?\C-v ?\ ?\177 ?\M-v)))
245 (if (memq char '(?\C-v ?\ ))
246 (scroll-up))
247 (if (memq char '(?\177 ?\M-v))
248 (scroll-down))
249 (message "A B C F I K L M N P S T V W C-c C-d C-n C-w%s: "
250 (if (pos-visible-in-window-p (point-max))
251 "" " or Space to scroll"))
252 (let ((cursor-in-echo-area t))
253 (setq char (read-char))))))
254 (let ((defn (cdr (assq (downcase char) (cdr help-map)))))
255 (if defn (call-interactively defn) (ding)))))
256
257 237
258 ;; Return a function which is called by the list containing point. 238 ;; Return a function which is called by the list containing point.
259 ;; If that gives no function, return a function whose name is around point. 239 ;; If that gives no function, return a function whose name is around point.
260 ;; If that doesn't give a function, return nil. 240 ;; If that doesn't give a function, return nil.
261 (defun function-called-at-point () 241 (defun function-called-at-point ()