diff options
| author | Richard M. Stallman | 2002-01-12 20:53:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-01-12 20:53:27 +0000 |
| commit | 9639be74eb4a08a72f8276adba4100a320be491e (patch) | |
| tree | 60eaaba06662adae05a6b1bbf8a8747417838dea | |
| parent | 8f3f2fe5f280f9352ccd507735e2752e0652c6a2 (diff) | |
| download | emacs-9639be74eb4a08a72f8276adba4100a320be491e.tar.gz emacs-9639be74eb4a08a72f8276adba4100a320be491e.zip | |
(describe-mode): Call help-setup-xref in the help buffer.
Switch buffers only after calling `help-buffer'.
| -rw-r--r-- | lisp/help.el | 78 |
1 files changed, 41 insertions, 37 deletions
diff --git a/lisp/help.el b/lisp/help.el index d4b5ceacb4d..8d27ce5a046 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -501,45 +501,49 @@ For this to work correctly for a minor mode, the mode's indicator variable | |||
| 501 | \(listed in `minor-mode-alist') must also be a function whose documentation | 501 | \(listed in `minor-mode-alist') must also be a function whose documentation |
| 502 | describes the minor mode." | 502 | describes the minor mode." |
| 503 | (interactive) | 503 | (interactive) |
| 504 | (when buffer (set-buffer buffer)) | 504 | (help-setup-xref (list #'describe-mode (or buffer (current-buffer))) |
| 505 | (help-setup-xref (list #'describe-mode (current-buffer)) (interactive-p)) | 505 | (interactive-p)) |
| 506 | ;; For the sake of help-do-xref and help-xref-go-back, | ||
| 507 | ;; don't switch buffers before calling `help-buffer'. | ||
| 506 | (with-output-to-temp-buffer (help-buffer) | 508 | (with-output-to-temp-buffer (help-buffer) |
| 507 | (when minor-mode-alist | 509 | (save-excursion |
| 508 | (princ "The major mode is described first. | 510 | (when buffer (set-buffer buffer)) |
| 511 | (when minor-mode-alist | ||
| 512 | (princ "The major mode is described first. | ||
| 509 | For minor modes, see following pages.\n\n")) | 513 | For minor modes, see following pages.\n\n")) |
| 510 | (princ mode-name) | 514 | (princ mode-name) |
| 511 | (princ " mode:\n") | 515 | (princ " mode:\n") |
| 512 | (princ (documentation major-mode)) | 516 | (princ (documentation major-mode)) |
| 513 | (let ((minor-modes minor-mode-alist)) | 517 | (let ((minor-modes minor-mode-alist)) |
| 514 | (while minor-modes | 518 | (while minor-modes |
| 515 | (let* ((minor-mode (car (car minor-modes))) | 519 | (let* ((minor-mode (car (car minor-modes))) |
| 516 | (indicator (car (cdr (car minor-modes))))) | 520 | (indicator (car (cdr (car minor-modes))))) |
| 517 | ;; Document a minor mode if it is listed in minor-mode-alist, | 521 | ;; Document a minor mode if it is listed in minor-mode-alist, |
| 518 | ;; bound locally in this buffer, non-nil, and has a function | 522 | ;; bound locally in this buffer, non-nil, and has a function |
| 519 | ;; definition. | 523 | ;; definition. |
| 520 | (if (and (boundp minor-mode) | 524 | (if (and (boundp minor-mode) |
| 521 | (symbol-value minor-mode) | 525 | (symbol-value minor-mode) |
| 522 | (fboundp minor-mode)) | 526 | (fboundp minor-mode)) |
| 523 | (let ((pretty-minor-mode minor-mode)) | 527 | (let ((pretty-minor-mode minor-mode)) |
| 524 | (if (string-match "\\(-minor\\)?-mode\\'" | 528 | (if (string-match "\\(-minor\\)?-mode\\'" |
| 525 | (symbol-name minor-mode)) | 529 | (symbol-name minor-mode)) |
| 526 | (setq pretty-minor-mode | 530 | (setq pretty-minor-mode |
| 527 | (capitalize | 531 | (capitalize |
| 528 | (substring (symbol-name minor-mode) | 532 | (substring (symbol-name minor-mode) |
| 529 | 0 (match-beginning 0))))) | 533 | 0 (match-beginning 0))))) |
| 530 | (while (and indicator (symbolp indicator) | 534 | (while (and indicator (symbolp indicator) |
| 531 | (boundp indicator) | 535 | (boundp indicator) |
| 532 | (not (eq indicator (symbol-value indicator)))) | 536 | (not (eq indicator (symbol-value indicator)))) |
| 533 | (setq indicator (symbol-value indicator))) | 537 | (setq indicator (symbol-value indicator))) |
| 534 | (princ "\n\f\n") | 538 | (princ "\n\f\n") |
| 535 | (princ (format "%s minor mode (%s):\n" | 539 | (princ (format "%s minor mode (%s):\n" |
| 536 | pretty-minor-mode | 540 | pretty-minor-mode |
| 537 | (if indicator | 541 | (if indicator |
| 538 | (format "indicator%s" indicator) | 542 | (format "indicator%s" indicator) |
| 539 | "no indicator"))) | 543 | "no indicator"))) |
| 540 | (princ (documentation minor-mode))))) | 544 | (princ (documentation minor-mode))))) |
| 541 | (setq minor-modes (cdr minor-modes)))) | 545 | (setq minor-modes (cdr minor-modes)))) |
| 542 | (print-help-return-message))) | 546 | (print-help-return-message)))) |
| 543 | 547 | ||
| 544 | 548 | ||
| 545 | ;;; Automatic resizing of temporary buffers. | 549 | ;;; Automatic resizing of temporary buffers. |