;;; help.el --- help commands for Emacs
-;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002,
-;; 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2011
+;; Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: help, internal
+;; Package: emacs
;; This file is part of GNU Emacs.
;; invoking `with-output-to-temp-buffer'. If and only if `help-window'
;; is eq to t, `help-mode-finish' (called by `temp-buffer-setup-hook')
;; sets `help-window' to the window selected by `display-buffer'.
-;; Exiting `with-help-window' and calling `print-help-return-message'
+;; Exiting `with-help-window' and calling `help-print-return-message'
;; reset `help-window' to nil.
(defvar help-window nil
"Window chosen for displaying help.")
(define-key map "m" 'describe-mode)
(define-key map "n" 'view-emacs-news)
(define-key map "p" 'finder-by-keyword)
+ (define-key map "P" 'describe-package)
(define-key map "r" 'info-emacs-manual)
(define-key map "s" 'describe-syntax)
(define-key map "t" 'help-with-tutorial)
(define-key global-map [f1] 'help-command)
(fset 'help-command help-map)
-(autoload 'finder-by-keyword "finder"
- "Find packages matching a given keyword." t)
-
;; insert-button makes the action nil if it is not store somewhere
(defvar help-button-cache nil)
(WINDOW . quit-window) do quit-window, then select WINDOW.
(WINDOW BUF START POINT) display BUF at START, POINT, then select WINDOW.")
-(defun print-help-return-message (&optional function)
+(define-obsolete-function-alias 'print-help-return-message 'help-print-return-message "23.2")
+(defun help-print-return-message (&optional function)
"Display or return message saying how to restore windows after help command.
This function assumes that `standard-output' is the help buffer.
It computes a message, and applies the optional argument FUNCTION to it.
(defalias 'help-for-help 'help-for-help-internal)
;; It can't find this, but nobody will look.
(make-help-screen help-for-help-internal
- "Type a help option: [abcCdefFgiIkKlLmnprstvw.] C-[cdefmnoptw] or ?"
+ (purecopy "Type a help option: [abcCdefFgiIkKlLmnprstvw.] C-[cdefmnoptw] or ?")
+ ;; Don't purecopy this one, because it's not evaluated (it's
+ ;; directly used as a docstring in a function definition, so it'll
+ ;; be moved to the DOC file anyway: no need for purecopying it).
"You have typed %THIS-KEY%, the help character. Type a Help option:
\(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.)
I METHOD Describe a specific input method, or RET for current.
k KEYS Display the full documentation for the key sequence.
K KEYS Show the on-line manual's section for the command bound to KEYS.
-l Show last 100 characters you typed (lossage).
+l Show last 300 input keystrokes (lossage).
L LANG-ENV Describes a specific language environment, or RET for current.
m Display documentation of current minor modes and current major mode,
including their special commands.
(defun view-help-file (file &optional dir)
(view-file (expand-file-name file (or dir data-directory)))
- (goto-address)
+ (goto-address-mode 1)
(goto-char (point-min)))
(defun describe-distribution ()
(interactive)
(describe-copying)
(let (case-fold-search)
- (search-forward "NO WARRANTY")
+ (search-forward "Disclaimer of Warranty")
+ (forward-line 0)
(recenter 0)))
(defun describe-prefix-bindings ()
(view-help-file "MORE.STUFF"))
(defun view-lossage ()
- "Display last 100 input keystrokes.
+ "Display last 300 input keystrokes.
To record all your input on a file, use `open-dribble-file'."
(interactive)
- (help-setup-xref (list #'view-lossage) (interactive-p))
+ (help-setup-xref (list #'view-lossage)
+ (called-interactively-p 'interactive))
(with-help-window (help-buffer)
(princ (mapconcat (lambda (key)
(if (or (integerp key) (symbolp key) (listp key))
or a buffer name."
(interactive)
(or buffer (setq buffer (current-buffer)))
- (help-setup-xref (list #'describe-bindings prefix buffer) (interactive-p))
+ (help-setup-xref (list #'describe-bindings prefix buffer)
+ (called-interactively-p 'interactive))
(with-current-buffer buffer
(describe-bindings-internal nil prefix)))
\(Ordinarily these are omitted from the output.)
The optional argument PREFIX, if non-nil, should be a key sequence;
then we display only bindings that start with that prefix."
- (interactive)
(let ((buf (current-buffer)))
(with-help-window "*Help*"
(with-current-buffer standard-output
(if (or (null defn) (integerp defn) (equal defn 'undefined))
(message "%s%s is undefined"
(help-key-description key untranslated) mouse-msg)
- (help-setup-xref (list #'describe-function defn) (interactive-p))
+ (help-setup-xref (list #'describe-function defn)
+ (called-interactively-p 'interactive))
;; Don't bother user with strings from (e.g.) the select-paste menu.
(when (stringp (aref key (1- (length key))))
(aset key (1- (length key)) "(any string)"))
----------------- up-event %s----------------
-<%S>%s%s runs the command %S, which is "
+%s%s%s runs the command %S, which is "
(if mouse-1-tricky "(short click) " "")
- ev-type mouse-msg
+ (key-description (vector up-event))
+ mouse-msg
(if mouse-1-remapped
" is remapped to <mouse-2>, which" "")
defn-up))
(interactive "@")
(unless buffer (setq buffer (current-buffer)))
(help-setup-xref (list #'describe-mode buffer)
- (interactive-p))
+ (called-interactively-p 'interactive))
;; For the sake of help-do-xref and help-xref-go-back,
;; don't switch buffers before calling `help-buffer'.
(with-help-window (help-buffer)
(let ((start (point)))
(insert (format-mode-line mode nil nil buffer))
(add-text-properties start (point) '(face bold)))))
- (princ " mode:\n")
- (princ (documentation major-mode))))))
+ (princ " mode")
+ (let* ((mode major-mode)
+ (file-name (find-lisp-object-file-name mode nil)))
+ (when file-name
+ (princ (concat " defined in `" (file-name-nondirectory file-name) "'"))
+ ;; Make a hyperlink to the library.
+ (with-current-buffer standard-output
+ (save-excursion
+ (re-search-backward "`\\([^`']+\\)'" nil t)
+ (help-xref-button 1 'help-function-def mode file-name)))))
+ (princ ":\n")
+ (princ (documentation major-mode)))))
+ ;; For the sake of IELM and maybe others
+ nil)
(defun describe-minor-mode (minor-mode)
Select WINDOW according to the value of `help-window-select'.
Display message telling how to scroll and eventually quit WINDOW.
-Optional argument REUSE non-nil means WINDOW has been reused \(by
-`display-buffer'\) for displaying help. Optional argument
-KEEP-FRAME non-nil means that quitting must no delete the frame
-of WINDOW."
+Optional argument REUSE non-nil means WINDOW has been reused by
+`display-buffer'. Optional argument KEEP-FRAME non-nil means
+that quitting should not delete WINDOW's frame."
(let ((number-of-windows
(length (window-list (window-frame window) 'no-mini window))))
(cond
(help-window-display-message
(if reuse
;; Offer `display-buffer' for consistency with
- ;; `print-help-return-message'. This is hardly TRT when
+ ;; `help-print-return-message'. This is hardly TRT when
;; the other window and the selected window display the
;; same buffer but has been handled this way ever since.
"Type \\[display-buffer] RET to restore the other window"
;; (4) A marker (`help-window-point-marker') to move point in the help
;; window to an arbitrary buffer position.
-;; Note: It's usually always wrong to use `print-help-return-message' in
+;; Note: It's usually always wrong to use `help-print-return-message' in
;; the body of `with-help-window'.
(defmacro with-help-window (buffer-name &rest body)
"Display buffer BUFFER-NAME in a help window evaluating BODY.
;; Reset `help-window' to nil to avoid confusing future calls of
;; `help-mode-finish' with plain `with-output-to-temp-buffer'.
(setq help-window nil))))
+
+;; Called from C, on encountering `help-char' when reading a char.
+;; Don't print to *Help*; that would clobber Help history.
+(defun help-form-show ()
+ "Display the output of a non-nil `help-form'."
+ (let ((msg (eval help-form)))
+ (if (stringp msg)
+ (with-output-to-temp-buffer " *Char Help*"
+ (princ msg)))))
\f
(provide 'help)
-;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423
;;; help.el ends here