1 |
;;; help.el --- help commands for Emacs |
;;; help.el --- help commands for Emacs |
2 |
|
|
3 |
;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2004 |
;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2004, |
4 |
;; Free Software Foundation, Inc. |
;; 2005 Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Maintainer: FSF |
;; Maintainer: FSF |
7 |
;; Keywords: help, internal |
;; Keywords: help, internal |
685 |
variable \(listed in `minor-mode-alist') must also be a function |
variable \(listed in `minor-mode-alist') must also be a function |
686 |
whose documentation describes the minor mode." |
whose documentation describes the minor mode." |
687 |
(interactive) |
(interactive) |
688 |
(help-setup-xref (list #'describe-mode (or buffer (current-buffer))) |
(unless buffer (setq buffer (current-buffer))) |
689 |
|
(help-setup-xref (list #'describe-mode buffer) |
690 |
(interactive-p)) |
(interactive-p)) |
691 |
;; For the sake of help-do-xref and help-xref-go-back, |
;; For the sake of help-do-xref and help-xref-go-back, |
692 |
;; don't switch buffers before calling `help-buffer'. |
;; don't switch buffers before calling `help-buffer'. |
693 |
(with-output-to-temp-buffer (help-buffer) |
(with-output-to-temp-buffer (help-buffer) |
694 |
(save-excursion |
(with-current-buffer buffer |
|
(when buffer (set-buffer buffer)) |
|
695 |
(let (minor-modes) |
(let (minor-modes) |
696 |
|
;; Older packages do not register in minor-mode-list but only in |
697 |
|
;; minor-mode-alist. |
698 |
|
(dolist (x minor-mode-alist) |
699 |
|
(setq x (car x)) |
700 |
|
(unless (memq x minor-mode-list) |
701 |
|
(push x minor-mode-list))) |
702 |
;; Find enabled minor mode we will want to mention. |
;; Find enabled minor mode we will want to mention. |
703 |
(dolist (mode minor-mode-list) |
(dolist (mode minor-mode-list) |
704 |
;; Document a minor mode if it is listed in minor-mode-alist, |
;; Document a minor mode if it is listed in minor-mode-alist, |
705 |
;; non-nil, and has a function definition. |
;; non-nil, and has a function definition. |
706 |
(and (boundp mode) (symbol-value mode) |
(and (boundp mode) (symbol-value mode) |
707 |
(fboundp mode) |
(fboundp mode) |
708 |
(let ((pretty-minor-mode mode) |
(let ((pretty-minor-mode mode)) |
|
indicator) |
|
709 |
(if (string-match "\\(-minor\\)?-mode\\'" |
(if (string-match "\\(-minor\\)?-mode\\'" |
710 |
(symbol-name mode)) |
(symbol-name mode)) |
711 |
(setq pretty-minor-mode |
(setq pretty-minor-mode |
712 |
(capitalize |
(capitalize |
713 |
(substring (symbol-name mode) |
(substring (symbol-name mode) |
714 |
0 (match-beginning 0))))) |
0 (match-beginning 0))))) |
715 |
(setq indicator (cadr (assq mode minor-mode-alist))) |
(push (list pretty-minor-mode mode |
716 |
(while (and indicator (symbolp indicator) |
(format-mode-line (assq mode minor-mode-alist))) |
|
(boundp indicator) |
|
|
(not (eq indicator (symbol-value indicator)))) |
|
|
(setq indicator (symbol-value indicator))) |
|
|
(push (list pretty-minor-mode mode indicator) |
|
717 |
minor-modes)))) |
minor-modes)))) |
718 |
(if auto-fill-function |
(if auto-fill-function |
719 |
;; copy pure string so we can add face property to it below. |
;; copy pure string so we can add face property to it below. |
730 |
(let ((pretty-minor-mode (nth 0 mode)) |
(let ((pretty-minor-mode (nth 0 mode)) |
731 |
(mode-function (nth 1 mode)) |
(mode-function (nth 1 mode)) |
732 |
(indicator (nth 2 mode))) |
(indicator (nth 2 mode))) |
733 |
|
(setq indicator (if (zerop (length indicator)) |
734 |
|
"no indicator" |
735 |
|
(format "indicator%s" indicator))) |
736 |
(add-text-properties 0 (length pretty-minor-mode) |
(add-text-properties 0 (length pretty-minor-mode) |
737 |
'(face bold) pretty-minor-mode) |
'(face bold) pretty-minor-mode) |
738 |
(save-excursion |
(save-excursion |
741 |
(push (point-marker) help-button-cache) |
(push (point-marker) help-button-cache) |
742 |
;; Document the minor modes fully. |
;; Document the minor modes fully. |
743 |
(insert pretty-minor-mode) |
(insert pretty-minor-mode) |
744 |
(princ (format " minor mode (%s):\n" |
(princ (format " minor mode (%s):\n" indicator)) |
|
(if indicator |
|
|
(format "indicator%s" indicator) |
|
|
"no indicator"))) |
|
745 |
(princ (documentation mode-function))) |
(princ (documentation mode-function))) |
746 |
(princ " ") |
(princ " ") |
747 |
(insert-button pretty-minor-mode |
(insert-button pretty-minor-mode |
748 |
'action (car help-button-cache) |
'action (car help-button-cache) |
749 |
'follow-link t |
'follow-link t |
750 |
'help-echo "mouse-2, RET: show full information") |
'help-echo "mouse-2, RET: show full information") |
751 |
(princ (format " minor mode (%s):\n" |
(princ (format " minor mode (%s):\n" indicator))))) |
|
(if indicator |
|
|
(format "indicator%s" indicator) |
|
|
"no indicator")))))) |
|
752 |
(princ "\n(Full information about these minor modes |
(princ "\n(Full information about these minor modes |
753 |
follows the description of the major mode.)\n\n")) |
follows the description of the major mode.)\n\n")) |
754 |
;; Document the major mode. |
;; Document the major mode. |
894 |
;; defcustoms which require 'help'. |
;; defcustoms which require 'help'. |
895 |
(provide 'help) |
(provide 'help) |
896 |
|
|
897 |
;;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423 |
;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423 |
898 |
;;; help.el ends here |
;;; help.el ends here |