comparison lisp/help.el @ 20060:36044c8b8aef

(help-mode-maybe): New function, on temp-buffer-show-hook. (describe-key, describe-mode): Don't call help-mode here. (view-lossage, describe-function, describe-variable): Likewise.
author Karl Heuer <kwzh@gnu.org>
date Wed, 15 Oct 1997 23:36:30 +0000
parents b0bd0bd48893
children 1f8e6121713d
comparison
equal deleted inserted replaced
20059:121625bee1c8 20060:36044c8b8aef
124 (setq font-lock-defaults '(help-font-lock-keywords)) 124 (setq font-lock-defaults '(help-font-lock-keywords))
125 (view-mode) 125 (view-mode)
126 (make-local-variable 'view-no-disable-on-exit) 126 (make-local-variable 'view-no-disable-on-exit)
127 (setq view-no-disable-on-exit t) 127 (setq view-no-disable-on-exit t)
128 (run-hooks 'help-mode-hook)) 128 (run-hooks 'help-mode-hook))
129
130 (defun help-mode-maybe ()
131 (if (eq major-mode 'fundamental-mode)
132 (help-mode)))
133
134 (add-hook 'temp-buffer-show-hook 'help-mode-maybe)
129 135
130 (defun help-quit () 136 (defun help-quit ()
131 (interactive) 137 (interactive)
132 nil) 138 nil)
133 139
287 (let ((doc (documentation defn))) 293 (let ((doc (documentation defn)))
288 (if doc 294 (if doc
289 (progn (terpri) 295 (progn (terpri)
290 (princ doc)) 296 (princ doc))
291 (princ "not documented"))) 297 (princ "not documented")))
292 (save-excursion
293 (set-buffer standard-output)
294 (help-mode))
295 (print-help-return-message))))))) 298 (print-help-return-message)))))))
296 299
297 (defun describe-mode () 300 (defun describe-mode ()
298 "Display documentation of current major mode and minor modes. 301 "Display documentation of current major mode and minor modes.
299 For this to work correctly for a minor mode, the mode's indicator variable 302 For this to work correctly for a minor mode, the mode's indicator variable
332 (princ "\n\f\n")))) 335 (princ "\n\f\n"))))
333 (setq minor-modes (cdr minor-modes)))) 336 (setq minor-modes (cdr minor-modes))))
334 (princ mode-name) 337 (princ mode-name)
335 (princ " mode:\n") 338 (princ " mode:\n")
336 (princ (documentation major-mode)) 339 (princ (documentation major-mode))
337 (save-excursion
338 (set-buffer standard-output)
339 (help-mode))
340 (print-help-return-message))) 340 (print-help-return-message)))
341 341
342 ;; So keyboard macro definitions are documented correctly 342 ;; So keyboard macro definitions are documented correctly
343 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro)) 343 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
344 344
414 (save-excursion 414 (save-excursion
415 (set-buffer standard-output) 415 (set-buffer standard-output)
416 (goto-char (point-min)) 416 (goto-char (point-min))
417 (while (progn (move-to-column 50) (not (eobp))) 417 (while (progn (move-to-column 50) (not (eobp)))
418 (search-forward " " nil t) 418 (search-forward " " nil t)
419 (insert "\n")) 419 (insert "\n")))
420 (help-mode))
421 (print-help-return-message))) 420 (print-help-return-message)))
422 421
423 (defalias 'help 'help-for-help) 422 (defalias 'help 'help-for-help)
424 (make-help-screen help-for-help 423 (make-help-screen help-for-help
425 "a b c C f F C-f i I k C-k l L m n p s t v w C-c C-d C-n C-p C-w; ? for help:" 424 "a b c C f F C-f i I k C-k l L m n p s t v w C-c C-d C-n C-p C-w; ? for help:"
581 (princ doc)) 580 (princ doc))
582 (princ "not documented")))) 581 (princ "not documented"))))
583 (print-help-return-message) 582 (print-help-return-message)
584 (save-excursion 583 (save-excursion
585 (set-buffer standard-output) 584 (set-buffer standard-output)
586 (help-mode)
587 ;; Return the text we displayed. 585 ;; Return the text we displayed.
588 (buffer-string))) 586 (buffer-string)))
589 (message "You didn't specify a function"))) 587 (message "You didn't specify a function")))
590 588
591 ;; We return 0 if we can't find a variable to return. 589 ;; We return 0 if we can't find a variable to return.
659 (let ((doc (documentation-property variable 'variable-documentation))) 657 (let ((doc (documentation-property variable 'variable-documentation)))
660 (princ (or doc "not documented as a variable."))) 658 (princ (or doc "not documented as a variable.")))
661 (print-help-return-message) 659 (print-help-return-message)
662 (save-excursion 660 (save-excursion
663 (set-buffer standard-output) 661 (set-buffer standard-output)
664 (help-mode)
665 ;; Return the text we displayed. 662 ;; Return the text we displayed.
666 (buffer-string)))) 663 (buffer-string))))
667 (message "You did not specify a variable"))) 664 (message "You did not specify a variable")))
668 665
669 (defun where-is (definition &optional insert) 666 (defun where-is (definition &optional insert)