Mercurial > emacs
comparison lisp/help-fns.el @ 86012:494608f8dd24
(describe-function, describe-variable)
(describe-syntax, describe-categories):
Use with-help-window instead of with-output-to-temp-buffer.
author | Martin Rudalics <rudalics@gmx.at> |
---|---|
date | Sat, 10 Nov 2007 09:58:35 +0000 |
parents | b8519672d451 |
children | 22dc0bc9daf8 880960b70474 |
comparison
equal
deleted
inserted
replaced
86011:474f44ceee97 | 86012:494608f8dd24 |
---|---|
53 fn (intern val))))) | 53 fn (intern val))))) |
54 (if (null function) | 54 (if (null function) |
55 (message "You didn't specify a function") | 55 (message "You didn't specify a function") |
56 (help-setup-xref (list #'describe-function function) (interactive-p)) | 56 (help-setup-xref (list #'describe-function function) (interactive-p)) |
57 (save-excursion | 57 (save-excursion |
58 (with-output-to-temp-buffer (help-buffer) | 58 (with-help-window (help-buffer) |
59 (prin1 function) | 59 (prin1 function) |
60 ;; Use " is " instead of a colon so that | 60 ;; Use " is " instead of a colon so that |
61 ;; it is easier to get out the function name using forward-sexp. | 61 ;; it is easier to get out the function name using forward-sexp. |
62 (princ " is ") | 62 (princ " is ") |
63 (describe-function-1 function) | 63 (describe-function-1 function) |
64 (print-help-return-message) | |
65 (with-current-buffer standard-output | 64 (with-current-buffer standard-output |
66 ;; Return the text we displayed. | 65 ;; Return the text we displayed. |
67 (buffer-string)))))) | 66 (buffer-string)))))) |
68 | 67 |
69 (defun help-split-fundoc (docstring def) | 68 (defun help-split-fundoc (docstring def) |
515 (with-current-buffer buffer | 514 (with-current-buffer buffer |
516 (setq val (symbol-value variable) | 515 (setq val (symbol-value variable) |
517 locus (variable-binding-locus variable))))) | 516 locus (variable-binding-locus variable))))) |
518 (help-setup-xref (list #'describe-variable variable buffer) | 517 (help-setup-xref (list #'describe-variable variable buffer) |
519 (interactive-p)) | 518 (interactive-p)) |
520 (with-output-to-temp-buffer (help-buffer) | 519 (with-help-window (help-buffer) |
521 (with-current-buffer buffer | 520 (with-current-buffer buffer |
522 (prin1 variable) | 521 (prin1 variable) |
523 ;; Make a hyperlink to the library if appropriate. (Don't | 522 ;; Make a hyperlink to the library if appropriate. (Don't |
524 ;; change the format of the buffer's initial line in case | 523 ;; change the format of the buffer's initial line in case |
525 ;; anything expects the current format.) | 524 ;; anything expects the current format.) |
683 (when output | 682 (when output |
684 (terpri) | 683 (terpri) |
685 (terpri) | 684 (terpri) |
686 (princ output)))) | 685 (princ output)))) |
687 | 686 |
688 (print-help-return-message) | |
689 (save-excursion | 687 (save-excursion |
690 (set-buffer standard-output) | 688 (set-buffer standard-output) |
691 ;; Return the text we displayed. | 689 ;; Return the text we displayed. |
692 (buffer-string)))))))) | 690 (buffer-string)))))))) |
693 | 691 |
698 The descriptions are inserted in a help buffer, which is then displayed. | 696 The descriptions are inserted in a help buffer, which is then displayed. |
699 BUFFER defaults to the current buffer." | 697 BUFFER defaults to the current buffer." |
700 (interactive) | 698 (interactive) |
701 (setq buffer (or buffer (current-buffer))) | 699 (setq buffer (or buffer (current-buffer))) |
702 (help-setup-xref (list #'describe-syntax buffer) (interactive-p)) | 700 (help-setup-xref (list #'describe-syntax buffer) (interactive-p)) |
703 (with-output-to-temp-buffer (help-buffer) | 701 (with-help-window (help-buffer) |
704 (let ((table (with-current-buffer buffer (syntax-table)))) | 702 (let ((table (with-current-buffer buffer (syntax-table)))) |
705 (with-current-buffer standard-output | 703 (with-current-buffer standard-output |
706 (describe-vector table 'internal-describe-syntax-value) | 704 (describe-vector table 'internal-describe-syntax-value) |
707 (while (setq table (char-table-parent table)) | 705 (while (setq table (char-table-parent table)) |
708 (insert "\nThe parent syntax table is:") | 706 (insert "\nThe parent syntax table is:") |
723 If BUFFER is non-nil, then describe BUFFER's category table instead. | 721 If BUFFER is non-nil, then describe BUFFER's category table instead. |
724 BUFFER should be a buffer or a buffer name." | 722 BUFFER should be a buffer or a buffer name." |
725 (interactive) | 723 (interactive) |
726 (setq buffer (or buffer (current-buffer))) | 724 (setq buffer (or buffer (current-buffer))) |
727 (help-setup-xref (list #'describe-categories buffer) (interactive-p)) | 725 (help-setup-xref (list #'describe-categories buffer) (interactive-p)) |
728 (with-output-to-temp-buffer (help-buffer) | 726 (with-help-window (help-buffer) |
729 (let ((table (with-current-buffer buffer (category-table)))) | 727 (let ((table (with-current-buffer buffer (category-table)))) |
730 (with-current-buffer standard-output | 728 (with-current-buffer standard-output |
731 (describe-vector table 'help-describe-category-set) | 729 (describe-vector table 'help-describe-category-set) |
732 (let ((docs (char-table-extra-slot table 0))) | 730 (let ((docs (char-table-extra-slot table 0))) |
733 (if (or (not (vectorp docs)) (/= (length docs) 95)) | 731 (if (or (not (vectorp docs)) (/= (length docs) 95)) |