1992-05-30 23:12:08 +00:00
|
|
|
|
;;; help.el --- help commands for Emacs
|
|
|
|
|
|
2005-08-06 22:13:43 +00:00
|
|
|
|
;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002,
|
2006-02-06 15:23:23 +00:00
|
|
|
|
;; 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
1992-07-22 04:22:42 +00:00
|
|
|
|
|
1992-07-16 21:47:34 +00:00
|
|
|
|
;; Maintainer: FSF
|
1992-07-17 08:15:29 +00:00
|
|
|
|
;; Keywords: help, internal
|
1992-07-16 21:47:34 +00:00
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
1992-07-16 21:47:34 +00:00
|
|
|
|
;; the Free Software Foundation; either version 2, or (at your option)
|
1991-08-25 21:47:10 +00:00
|
|
|
|
;; any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
2005-07-04 23:32:44 +00:00
|
|
|
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
;; Boston, MA 02110-1301, USA.
|
1991-08-25 21:47:10 +00:00
|
|
|
|
|
1993-03-22 16:53:22 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1996-10-06 16:27:39 +00:00
|
|
|
|
;; This code implements GNU Emacs' on-line help system, the one invoked by
|
1999-08-31 17:17:18 +00:00
|
|
|
|
;; `M-x help-for-help'.
|
1993-03-22 16:53:22 +00:00
|
|
|
|
|
1992-07-16 21:47:34 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
1993-03-22 06:59:54 +00:00
|
|
|
|
;; Get the macro make-help-screen when this is compiled,
|
|
|
|
|
;; or run interpreted, but not when the compiled code is loaded.
|
1993-05-08 22:38:37 +00:00
|
|
|
|
(eval-when-compile (require 'help-macro))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
|
|
|
|
|
;; This makes `with-output-to-temp-buffer' buffers use `help-mode'.
|
|
|
|
|
(add-hook 'temp-buffer-setup-hook 'help-mode-setup)
|
|
|
|
|
(add-hook 'temp-buffer-show-hook 'help-mode-finish)
|
1993-03-17 22:20:57 +00:00
|
|
|
|
|
2005-11-30 16:09:58 +00:00
|
|
|
|
(defvar help-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map (char-to-string help-char) 'help-for-help)
|
|
|
|
|
(define-key map [help] 'help-for-help)
|
|
|
|
|
(define-key map [f1] 'help-for-help)
|
|
|
|
|
(define-key map "." 'display-local-help)
|
|
|
|
|
(define-key map "?" 'help-for-help)
|
|
|
|
|
|
|
|
|
|
(define-key map "\C-c" 'describe-copying)
|
|
|
|
|
(define-key map "\C-d" 'describe-distribution)
|
|
|
|
|
(define-key map "\C-e" 'view-emacs-problems)
|
|
|
|
|
(define-key map "\C-f" 'view-emacs-FAQ)
|
|
|
|
|
(define-key map "\C-m" 'view-order-manuals)
|
|
|
|
|
(define-key map "\C-n" 'view-emacs-news)
|
|
|
|
|
(define-key map "\C-p" 'describe-project)
|
|
|
|
|
(define-key map "\C-t" 'view-todo)
|
|
|
|
|
(define-key map "\C-w" 'describe-no-warranty)
|
|
|
|
|
|
|
|
|
|
;; This does not fit the pattern, but it is natural given the C-\ command.
|
|
|
|
|
(define-key map "\C-\\" 'describe-input-method)
|
|
|
|
|
|
|
|
|
|
(define-key map "C" 'describe-coding-system)
|
|
|
|
|
(define-key map "F" 'Info-goto-emacs-command-node)
|
|
|
|
|
(define-key map "I" 'describe-input-method)
|
|
|
|
|
(define-key map "K" 'Info-goto-emacs-key-command-node)
|
|
|
|
|
(define-key map "L" 'describe-language-environment)
|
|
|
|
|
(define-key map "S" 'info-lookup-symbol)
|
|
|
|
|
|
|
|
|
|
(define-key map "a" 'apropos-command)
|
|
|
|
|
(define-key map "b" 'describe-bindings)
|
|
|
|
|
(define-key map "c" 'describe-key-briefly)
|
|
|
|
|
(define-key map "d" 'apropos-documentation)
|
|
|
|
|
(define-key map "e" 'view-echo-area-messages)
|
|
|
|
|
(define-key map "f" 'describe-function)
|
|
|
|
|
(define-key map "h" 'view-hello-file)
|
|
|
|
|
|
|
|
|
|
(define-key map "i" 'info)
|
|
|
|
|
(define-key map "4i" 'info-other-window)
|
|
|
|
|
|
|
|
|
|
(define-key map "k" 'describe-key)
|
|
|
|
|
(define-key map "l" 'view-lossage)
|
|
|
|
|
(define-key map "m" 'describe-mode)
|
|
|
|
|
(define-key map "n" 'view-emacs-news)
|
|
|
|
|
(define-key map "p" 'finder-by-keyword)
|
|
|
|
|
(define-key map "r" 'info-emacs-manual)
|
|
|
|
|
(define-key map "s" 'describe-syntax)
|
|
|
|
|
(define-key map "t" 'help-with-tutorial)
|
|
|
|
|
(define-key map "w" 'where-is)
|
|
|
|
|
(define-key map "v" 'describe-variable)
|
|
|
|
|
(define-key map "q" 'help-quit)
|
|
|
|
|
map)
|
1991-08-25 21:47:10 +00:00
|
|
|
|
"Keymap for characters following the Help key.")
|
|
|
|
|
|
1992-08-03 22:07:34 +00:00
|
|
|
|
(define-key global-map (char-to-string help-char) 'help-command)
|
1995-06-29 02:50:52 +00:00
|
|
|
|
(define-key global-map [help] 'help-command)
|
|
|
|
|
(define-key global-map [f1] 'help-command)
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(fset 'help-command help-map)
|
|
|
|
|
|
1994-06-20 20:34:22 +00:00
|
|
|
|
(autoload 'finder-by-keyword "finder"
|
|
|
|
|
"Find packages matching a given keyword." t)
|
1993-03-11 07:55:27 +00:00
|
|
|
|
|
2004-10-13 19:01:01 +00:00
|
|
|
|
;; insert-button makes the action nil if it is not store somewhere
|
|
|
|
|
(defvar help-button-cache nil)
|
|
|
|
|
|
(help-mode-map): Make button-buffer-map our parent.
Don't bind mouse events or tab/backtab.
(help-function, help-variable, help-face, help-coding-system)
(help-input-method, help-character-set, help-back, help-info)
(help-customize-variable, help-function-def, help-variable-def):
New button types.
(help-button-action): New function.
(describe-function-1): Pass help button-types to `help-xref-button'
rather than help function and help-echo string. Don't put multiple
help-function args in a list to pass them to help-xref-button, just pass
them as multiple arguments. Use `help-insert-xref-button' to make
[back]-button, rather than `help-xref-button'.
(help-xref-button): Take a button-type TYPE as a parameter rather than a
function. Remove HELP-ECHO parameter. Remove DATA parameter and add a
&rest parameter ARGS to serve the same purpose. Use `make-text-button'
to add the button.
(help-insert-xref-button): Use `insert-text-button' to add the button.
(help-follow-mouse, help-next-ref, help-previous-ref): Functions removed.
(help-do-xref): New function.
(help-follow): Use `push-button' and `help-do-xref' to do most of the work.
2001-10-07 12:05:22 +00:00
|
|
|
|
|
1994-03-30 01:43:37 +00:00
|
|
|
|
(defun help-quit ()
|
1998-09-27 21:20:42 +00:00
|
|
|
|
"Just exit from the Help command's command loop."
|
1994-03-30 01:43:37 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
nil)
|
|
|
|
|
|
1998-03-16 04:10:19 +00:00
|
|
|
|
(defvar help-return-method nil
|
|
|
|
|
"What to do to \"exit\" the help buffer.
|
|
|
|
|
This is a list
|
2005-12-03 11:52:23 +00:00
|
|
|
|
(WINDOW . t) delete the selected window (and possibly its frame,
|
|
|
|
|
see `quit-window' and `View-quit'), go to WINDOW.
|
1998-03-16 04:10:19 +00:00
|
|
|
|
(WINDOW . quit-window) do quit-window, then select WINDOW.
|
|
|
|
|
(WINDOW BUF START POINT) display BUF at START, POINT, then select WINDOW.")
|
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(defun print-help-return-message (&optional function)
|
|
|
|
|
"Display or return message saying how to restore windows after help command.
|
2002-07-12 22:57:11 +00:00
|
|
|
|
This function assumes that `standard-output' is the help buffer.
|
|
|
|
|
It computes a message, and applies the optional argument FUNCTION to it.
|
2005-12-03 11:52:23 +00:00
|
|
|
|
If FUNCTION is nil, it applies `message', thus displaying the message.
|
|
|
|
|
In addition, this function sets up `help-return-method', which see, that
|
|
|
|
|
specifies what to do when the user exits the help buffer."
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(and (not (get-buffer-window standard-output))
|
1994-07-16 17:58:12 +00:00
|
|
|
|
(let ((first-message
|
2005-12-03 11:52:23 +00:00
|
|
|
|
(cond ((or
|
|
|
|
|
pop-up-frames
|
|
|
|
|
(special-display-p (buffer-name standard-output)))
|
1998-03-16 04:10:19 +00:00
|
|
|
|
(setq help-return-method (cons (selected-window) t))
|
1994-07-16 17:58:12 +00:00
|
|
|
|
;; If the help output buffer is a special display buffer,
|
|
|
|
|
;; don't say anything about how to get rid of it.
|
|
|
|
|
;; First of all, the user will do that with the window
|
|
|
|
|
;; manager, not with Emacs.
|
|
|
|
|
;; Secondly, the buffer has not been displayed yet,
|
|
|
|
|
;; so we don't know whether its frame will be selected.
|
|
|
|
|
nil)
|
2000-08-08 12:18:17 +00:00
|
|
|
|
(display-buffer-reuse-frames
|
|
|
|
|
(setq help-return-method (cons (selected-window)
|
|
|
|
|
'quit-window))
|
|
|
|
|
nil)
|
1994-07-16 17:58:12 +00:00
|
|
|
|
((not (one-window-p t))
|
1998-03-16 04:10:19 +00:00
|
|
|
|
(setq help-return-method
|
|
|
|
|
(cons (selected-window) 'quit-window))
|
2006-03-25 10:11:09 +00:00
|
|
|
|
"Type \\[display-buffer] RET to restore the other window.")
|
1994-07-16 17:58:12 +00:00
|
|
|
|
(pop-up-windows
|
1998-03-16 04:10:19 +00:00
|
|
|
|
(setq help-return-method (cons (selected-window) t))
|
1994-07-16 17:58:12 +00:00
|
|
|
|
"Type \\[delete-other-windows] to remove help window.")
|
|
|
|
|
(t
|
1998-03-16 04:10:19 +00:00
|
|
|
|
(setq help-return-method
|
|
|
|
|
(list (selected-window) (window-buffer)
|
|
|
|
|
(window-start) (window-point)))
|
1994-07-16 17:58:12 +00:00
|
|
|
|
"Type \\[switch-to-buffer] RET to remove help window."))))
|
|
|
|
|
(funcall (or function 'message)
|
|
|
|
|
(concat
|
|
|
|
|
(if first-message
|
2000-05-14 15:48:45 +00:00
|
|
|
|
(substitute-command-keys first-message))
|
|
|
|
|
(if first-message " ")
|
1995-04-24 15:13:20 +00:00
|
|
|
|
;; If the help buffer will go in a separate frame,
|
|
|
|
|
;; it's no use mentioning a command to scroll, so don't.
|
2005-12-03 12:07:03 +00:00
|
|
|
|
(if (or pop-up-windows
|
|
|
|
|
(special-display-p (buffer-name standard-output)))
|
1995-04-24 15:13:20 +00:00
|
|
|
|
nil
|
1996-10-06 16:27:39 +00:00
|
|
|
|
(if (same-window-p (buffer-name standard-output))
|
1995-04-24 15:13:20 +00:00
|
|
|
|
;; Say how to scroll this window.
|
|
|
|
|
(substitute-command-keys
|
|
|
|
|
"\\[scroll-up] to scroll the help.")
|
|
|
|
|
;; Say how to scroll some other window.
|
1995-04-13 18:15:01 +00:00
|
|
|
|
(substitute-command-keys
|
1995-04-24 15:13:20 +00:00
|
|
|
|
"\\[scroll-other-window] to scroll the help."))))))))
|
1991-08-25 21:47:10 +00:00
|
|
|
|
|
|
|
|
|
;; So keyboard macro definitions are documented correctly
|
|
|
|
|
(fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
|
|
|
|
|
|
2005-02-10 06:46:42 +00:00
|
|
|
|
(defalias 'help 'help-for-help-internal)
|
|
|
|
|
;; find-function can find this.
|
|
|
|
|
(defalias 'help-for-help 'help-for-help-internal)
|
|
|
|
|
;; It can't find this, but nobody will look.
|
|
|
|
|
(make-help-screen help-for-help-internal
|
2005-12-10 17:20:10 +00:00
|
|
|
|
"a b c C e f F i I k C-k l L m p r s t v w C-c C-d C-f C-n C-p C-t C-w . or ? :"
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
"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.)
|
|
|
|
|
|
2005-11-14 04:47:05 +00:00
|
|
|
|
a command-apropos. Give a list of words or a regexp, to get a list of
|
2005-12-12 05:16:39 +00:00
|
|
|
|
commands whose names match. See also the apropos command.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
b describe-bindings. Display table of all key bindings.
|
|
|
|
|
c describe-key-briefly. Type a command key sequence;
|
|
|
|
|
it prints the function name that sequence runs.
|
|
|
|
|
C describe-coding-system. This describes either a specific coding system
|
|
|
|
|
(if you type its name) or the coding systems currently in use
|
|
|
|
|
(if you type just RET).
|
2005-11-13 21:25:13 +00:00
|
|
|
|
d apropos-documentation. Give a pattern (a list or words or a regexp), and
|
|
|
|
|
see a list of functions, variables, and other items whose built-in
|
|
|
|
|
doucmentation string matches that pattern. See also the apropos command.
|
2005-02-05 12:45:44 +00:00
|
|
|
|
e view-echo-area-messages. Show the buffer where the echo-area messages
|
|
|
|
|
are stored.
|
|
|
|
|
f describe-function. Type a function name and get its documentation.
|
2002-01-14 01:36:33 +00:00
|
|
|
|
F Info-goto-emacs-command-node. Type a function name;
|
2005-02-05 12:45:44 +00:00
|
|
|
|
it takes you to the on-line manual's section that describes
|
|
|
|
|
the command.
|
2002-01-14 01:40:29 +00:00
|
|
|
|
h Display the HELLO file which illustrates various scripts.
|
2005-02-05 12:45:44 +00:00
|
|
|
|
i info. The Info documentation reader: read on-line manuals.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
I describe-input-method. Describe a specific input method (if you type
|
|
|
|
|
its name) or the current input method (if you type just RET).
|
|
|
|
|
k describe-key. Type a command key sequence;
|
2005-02-05 12:45:44 +00:00
|
|
|
|
it displays the full documentation for that key sequence.
|
2002-01-14 01:36:33 +00:00
|
|
|
|
K Info-goto-emacs-key-command-node. Type a command key sequence;
|
2005-02-05 12:45:44 +00:00
|
|
|
|
it takes you to the on-line manual's section that describes
|
|
|
|
|
the command bound to that key.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
l view-lossage. Show last 100 characters you typed.
|
|
|
|
|
L describe-language-environment. This describes either a
|
|
|
|
|
specific language environment (if you type its name)
|
|
|
|
|
or the current language environment (if you type just RET).
|
2005-02-05 12:45:44 +00:00
|
|
|
|
m describe-mode. Display documentation of current minor modes,
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
and the current major mode, including their special commands.
|
2005-02-05 12:45:44 +00:00
|
|
|
|
n view-emacs-news. Display news of recent Emacs changes.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
p finder-by-keyword. Find packages matching a given topic keyword.
|
2005-12-10 17:20:10 +00:00
|
|
|
|
r info-emacs-manual. Display the Emacs manual in Info mode.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
s describe-syntax. Display contents of syntax table, plus explanations.
|
2002-01-14 01:36:33 +00:00
|
|
|
|
S info-lookup-symbol. Display the definition of a specific symbol
|
|
|
|
|
as found in the manual for the language this buffer is written in.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
t help-with-tutorial. Select the Emacs learn-by-doing tutorial.
|
|
|
|
|
v describe-variable. Type name of a variable;
|
|
|
|
|
it displays the variable's documentation and value.
|
|
|
|
|
w where-is. Type command name; it prints which keystrokes
|
|
|
|
|
invoke that command.
|
2003-11-30 17:50:54 +00:00
|
|
|
|
. display-local-help. Display any available local help at point
|
|
|
|
|
in the echo area.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
|
2002-01-14 01:36:33 +00:00
|
|
|
|
C-c Display Emacs copying permission (GNU General Public License).
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
C-d Display Emacs ordering information.
|
2002-01-14 01:36:33 +00:00
|
|
|
|
C-e Display info about Emacs problems.
|
|
|
|
|
C-f Display the Emacs FAQ.
|
|
|
|
|
C-m Display how to order printed Emacs manuals.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
C-n Display news of recent Emacs changes.
|
|
|
|
|
C-p Display information about the GNU project.
|
2002-05-01 16:41:52 +00:00
|
|
|
|
C-t Display the Emacs TODO list.
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
C-w Display information on absence of warranty for GNU Emacs."
|
|
|
|
|
help-map)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun function-called-at-point ()
|
|
|
|
|
"Return a function around point or else called by the list containing point.
|
|
|
|
|
If that doesn't give a function, return nil."
|
2004-09-02 16:37:01 +00:00
|
|
|
|
(or (with-syntax-table emacs-lisp-mode-syntax-table
|
|
|
|
|
(or (condition-case ()
|
|
|
|
|
(save-excursion
|
|
|
|
|
(or (not (zerop (skip-syntax-backward "_w")))
|
|
|
|
|
(eq (char-syntax (following-char)) ?w)
|
|
|
|
|
(eq (char-syntax (following-char)) ?_)
|
|
|
|
|
(forward-sexp -1))
|
|
|
|
|
(skip-chars-forward "'")
|
|
|
|
|
(let ((obj (read (current-buffer))))
|
|
|
|
|
(and (symbolp obj) (fboundp obj) obj)))
|
|
|
|
|
(error nil))
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region (max (point-min)
|
|
|
|
|
(- (point) 1000)) (point-max))
|
|
|
|
|
;; Move up to surrounding paren, then after the open.
|
|
|
|
|
(backward-up-list 1)
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
;; If there is space here, this is probably something
|
|
|
|
|
;; other than a real Lisp function call, so ignore it.
|
|
|
|
|
(if (looking-at "[ \t]")
|
|
|
|
|
(error "Probably not a Lisp function call"))
|
|
|
|
|
(let ((obj (read (current-buffer))))
|
|
|
|
|
(and (symbolp obj) (fboundp obj) obj))))
|
|
|
|
|
(error nil))))
|
|
|
|
|
(let* ((str (find-tag-default))
|
2004-12-16 13:05:37 +00:00
|
|
|
|
(sym (if str (intern-soft str))))
|
|
|
|
|
(if (and sym (fboundp sym))
|
|
|
|
|
sym
|
|
|
|
|
(save-match-data
|
|
|
|
|
(when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str))
|
|
|
|
|
(setq sym (intern-soft (match-string 1 str)))
|
|
|
|
|
(and (fboundp sym) sym)))))))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; `User' help functions
|
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(defun describe-distribution ()
|
|
|
|
|
"Display info on how to obtain the latest version of GNU Emacs."
|
|
|
|
|
(interactive)
|
2002-01-17 01:40:47 +00:00
|
|
|
|
(view-file (expand-file-name "DISTRIB" data-directory)))
|
1991-08-25 21:47:10 +00:00
|
|
|
|
|
|
|
|
|
(defun describe-copying ()
|
|
|
|
|
"Display info on how you may redistribute copies of GNU Emacs."
|
|
|
|
|
(interactive)
|
2001-12-22 01:27:34 +00:00
|
|
|
|
(view-file (expand-file-name "COPYING" data-directory))
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(goto-char (point-min)))
|
|
|
|
|
|
1993-11-15 09:23:34 +00:00
|
|
|
|
(defun describe-project ()
|
|
|
|
|
"Display info on the GNU project."
|
|
|
|
|
(interactive)
|
2001-12-22 01:27:34 +00:00
|
|
|
|
(view-file (expand-file-name "THE-GNU-PROJECT" data-directory))
|
1993-11-15 09:23:34 +00:00
|
|
|
|
(goto-char (point-min)))
|
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(defun describe-no-warranty ()
|
|
|
|
|
"Display info on all the kinds of warranty Emacs does NOT have."
|
|
|
|
|
(interactive)
|
|
|
|
|
(describe-copying)
|
|
|
|
|
(let (case-fold-search)
|
|
|
|
|
(search-forward "NO WARRANTY")
|
|
|
|
|
(recenter 0)))
|
|
|
|
|
|
1993-07-04 18:53:24 +00:00
|
|
|
|
(defun describe-prefix-bindings ()
|
1993-07-04 18:55:54 +00:00
|
|
|
|
"Describe the bindings of the prefix used to reach this command.
|
|
|
|
|
The prefix described consists of all but the last event
|
|
|
|
|
of the key sequence that ran this command."
|
1993-07-04 18:53:24 +00:00
|
|
|
|
(interactive)
|
1995-05-24 00:46:17 +00:00
|
|
|
|
(let* ((key (this-command-keys)))
|
|
|
|
|
(describe-bindings
|
|
|
|
|
(if (stringp key)
|
|
|
|
|
(substring key 0 (1- (length key)))
|
|
|
|
|
(let ((prefix (make-vector (1- (length key)) nil))
|
|
|
|
|
(i 0))
|
|
|
|
|
(while (< i (length prefix))
|
|
|
|
|
(aset prefix i (aref key i))
|
|
|
|
|
(setq i (1+ i)))
|
|
|
|
|
prefix)))))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
;; Make C-h after a prefix, when not specifically bound,
|
1993-07-04 18:55:54 +00:00
|
|
|
|
;; run describe-prefix-bindings.
|
1993-07-04 18:53:24 +00:00
|
|
|
|
(setq prefix-help-command 'describe-prefix-bindings)
|
|
|
|
|
|
2006-06-04 01:14:15 +00:00
|
|
|
|
(defun view-emacs-news (&optional version)
|
1998-03-18 01:59:58 +00:00
|
|
|
|
"Display info on recent changes to Emacs.
|
2004-04-27 06:35:25 +00:00
|
|
|
|
With argument, display info only for the selected version."
|
1998-03-18 01:59:58 +00:00
|
|
|
|
(interactive "P")
|
2006-06-04 01:14:15 +00:00
|
|
|
|
(unless version
|
|
|
|
|
(setq version emacs-major-version))
|
|
|
|
|
(when (consp version)
|
|
|
|
|
(let* ((all-versions
|
|
|
|
|
(let (res)
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents
|
|
|
|
|
(expand-file-name file data-directory))
|
|
|
|
|
(while (re-search-forward
|
|
|
|
|
(if (member file '("NEWS.18" "NEWS.1-17"))
|
|
|
|
|
"Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)"
|
|
|
|
|
"^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)
|
|
|
|
|
(setq res (cons (match-string-no-properties 1) res)))))
|
|
|
|
|
(cons "NEWS"
|
|
|
|
|
(directory-files data-directory nil
|
|
|
|
|
"^NEWS\\.[0-9][-0-9]*$" nil)))
|
|
|
|
|
(sort (delete-dups res) (lambda (a b) (string< b a)))))
|
|
|
|
|
(current (car all-versions))
|
|
|
|
|
res)
|
|
|
|
|
(setq version (completing-read
|
|
|
|
|
(format "Read NEWS for the version (default %s): " current)
|
|
|
|
|
all-versions nil nil nil nil current))
|
|
|
|
|
(if (integerp (string-to-number version))
|
|
|
|
|
(setq version (string-to-number version))
|
|
|
|
|
(unless (or (member version all-versions)
|
|
|
|
|
(<= (string-to-number version) (string-to-number current)))
|
|
|
|
|
(error "No news about version %s" version)))))
|
|
|
|
|
(when (integerp version)
|
|
|
|
|
(cond ((<= version 12)
|
|
|
|
|
(setq version (format "1.%d" version)))
|
|
|
|
|
((<= version 18)
|
|
|
|
|
(setq version (format "%d" version)))
|
|
|
|
|
((> version emacs-major-version)
|
|
|
|
|
(error "No news about emacs %d (yet)" version))))
|
|
|
|
|
(let* ((vn (if (stringp version)
|
|
|
|
|
(string-to-number version)
|
|
|
|
|
version))
|
|
|
|
|
(file (cond
|
|
|
|
|
((>= vn emacs-major-version) "NEWS")
|
|
|
|
|
((< vn 18) "NEWS.1-17")
|
|
|
|
|
(t (format "NEWS.%d" vn)))))
|
|
|
|
|
(view-file (expand-file-name file data-directory))
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (stringp version)
|
|
|
|
|
(when (re-search-forward
|
|
|
|
|
(concat (if (< vn 19)
|
|
|
|
|
"Changes in Emacs[ \t]*"
|
|
|
|
|
"^\* [^0-9\n]*") version "$")
|
|
|
|
|
nil t)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(narrow-to-region
|
|
|
|
|
(point)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(while (and (setq res
|
|
|
|
|
(re-search-forward
|
|
|
|
|
(if (< vn 19)
|
|
|
|
|
"Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)"
|
|
|
|
|
"^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t))
|
|
|
|
|
(equal (match-string-no-properties 1) version)))
|
|
|
|
|
(or res (goto-char (point-max)))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(point)))))))
|
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
|
2002-05-01 16:41:52 +00:00
|
|
|
|
(defun view-todo (&optional arg)
|
|
|
|
|
"Display the Emacs TODO list."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(view-file (expand-file-name "TODO" data-directory)))
|
|
|
|
|
|
2002-01-14 01:36:33 +00:00
|
|
|
|
(defun view-echo-area-messages ()
|
|
|
|
|
"View the log of recent echo-area messages: the `*Messages*' buffer.
|
|
|
|
|
The number of messages retained in that buffer
|
|
|
|
|
is specified by the variable `message-log-max'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(switch-to-buffer (get-buffer-create "*Messages*")))
|
|
|
|
|
|
2001-02-22 11:18:03 +00:00
|
|
|
|
(defun view-order-manuals ()
|
|
|
|
|
"Display the Emacs ORDERS file."
|
|
|
|
|
(interactive)
|
2001-12-22 01:27:34 +00:00
|
|
|
|
(view-file (expand-file-name "ORDERS" data-directory))
|
2001-02-26 14:13:35 +00:00
|
|
|
|
(goto-address))
|
2001-02-22 11:18:03 +00:00
|
|
|
|
|
1995-03-06 05:16:14 +00:00
|
|
|
|
(defun view-emacs-FAQ ()
|
|
|
|
|
"Display the Emacs Frequently Asked Questions (FAQ) file."
|
|
|
|
|
(interactive)
|
2001-10-11 22:31:20 +00:00
|
|
|
|
;; (find-file-read-only (expand-file-name "FAQ" data-directory))
|
2000-05-16 14:31:26 +00:00
|
|
|
|
(info "(efaq)"))
|
1995-03-06 05:16:14 +00:00
|
|
|
|
|
1999-12-07 20:01:20 +00:00
|
|
|
|
(defun view-emacs-problems ()
|
|
|
|
|
"Display info on known problems with Emacs and possible workarounds."
|
|
|
|
|
(interactive)
|
|
|
|
|
(view-file (expand-file-name "PROBLEMS" data-directory)))
|
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(defun view-lossage ()
|
2001-03-25 14:02:09 +00:00
|
|
|
|
"Display last 100 input keystrokes.
|
|
|
|
|
|
|
|
|
|
To record all your input on a file, use `open-dribble-file'."
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(interactive)
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(help-setup-xref (list #'view-lossage) (interactive-p))
|
|
|
|
|
(with-output-to-temp-buffer (help-buffer)
|
2002-04-02 03:23:26 +00:00
|
|
|
|
(princ (mapconcat (lambda (key)
|
|
|
|
|
(if (or (integerp key) (symbolp key) (listp key))
|
|
|
|
|
(single-key-description key)
|
|
|
|
|
(prin1-to-string key nil)))
|
1994-08-10 04:08:26 +00:00
|
|
|
|
(recent-keys)
|
|
|
|
|
" "))
|
2001-10-08 00:19:58 +00:00
|
|
|
|
(with-current-buffer standard-output
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (progn (move-to-column 50) (not (eobp)))
|
2006-03-08 10:11:47 +00:00
|
|
|
|
(when (search-forward " " nil t)
|
|
|
|
|
(delete-char -1))
|
|
|
|
|
(insert "\n")))
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(print-help-return-message)))
|
|
|
|
|
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
|
|
|
|
|
;; Key bindings
|
1991-08-25 21:47:10 +00:00
|
|
|
|
|
1998-06-01 21:11:47 +00:00
|
|
|
|
(defun describe-bindings (&optional prefix buffer)
|
1998-02-05 03:26:45 +00:00
|
|
|
|
"Show a list of all defined keys, and their definitions.
|
|
|
|
|
We put that list in a buffer, and display the buffer.
|
|
|
|
|
|
|
|
|
|
The optional argument PREFIX, if non-nil, should be a key sequence;
|
1998-06-01 21:11:47 +00:00
|
|
|
|
then we display only bindings that start with that prefix.
|
|
|
|
|
The optional argument BUFFER specifies which buffer's bindings
|
2004-08-09 18:50:28 +00:00
|
|
|
|
to display (default, the current buffer). BUFFER can be a buffer
|
|
|
|
|
or a buffer name."
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(interactive)
|
1998-06-01 21:11:47 +00:00
|
|
|
|
(or buffer (setq buffer (current-buffer)))
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(help-setup-xref (list #'describe-bindings prefix buffer) (interactive-p))
|
1998-06-01 21:11:47 +00:00
|
|
|
|
(with-current-buffer buffer
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(describe-bindings-internal nil prefix)))
|
1998-02-05 03:26:45 +00:00
|
|
|
|
|
2001-10-11 22:31:20 +00:00
|
|
|
|
;; This function used to be in keymap.c.
|
|
|
|
|
(defun describe-bindings-internal (&optional menus prefix)
|
|
|
|
|
"Show a list of all defined keys, and their definitions.
|
|
|
|
|
We put that list in a buffer, and display the buffer.
|
|
|
|
|
|
|
|
|
|
The optional argument MENUS, if non-nil, says to mention menu bindings.
|
|
|
|
|
\(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-output-to-temp-buffer "*Help*"
|
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
|
(describe-buffer-bindings buf prefix menus)))))
|
|
|
|
|
|
1997-05-22 06:20:42 +00:00
|
|
|
|
(defun where-is (definition &optional insert)
|
1999-01-15 17:29:03 +00:00
|
|
|
|
"Print message listing key sequences that invoke the command DEFINITION.
|
1997-05-22 06:20:42 +00:00
|
|
|
|
Argument is a command definition, usually a symbol with a function definition.
|
|
|
|
|
If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
|
1994-03-23 04:54:20 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(let ((fn (function-called-at-point))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(enable-recursive-minibuffers t)
|
1994-03-23 04:54:20 +00:00
|
|
|
|
val)
|
2002-11-07 18:28:09 +00:00
|
|
|
|
(setq val (completing-read
|
|
|
|
|
(if fn
|
|
|
|
|
(format "Where is command (default %s): " fn)
|
|
|
|
|
"Where is command: ")
|
|
|
|
|
obarray 'commandp t))
|
|
|
|
|
(list (if (equal val "") fn (intern val)) current-prefix-arg)))
|
2002-11-07 16:46:11 +00:00
|
|
|
|
(let ((func (indirect-function definition))
|
2002-11-07 18:28:09 +00:00
|
|
|
|
(defs nil)
|
2002-11-07 16:46:11 +00:00
|
|
|
|
(standard-output (if insert (current-buffer) t)))
|
2005-03-21 17:41:41 +00:00
|
|
|
|
;; In DEFS, find all symbols that are aliases for DEFINITION.
|
2002-11-07 18:28:09 +00:00
|
|
|
|
(mapatoms (lambda (symbol)
|
|
|
|
|
(and (fboundp symbol)
|
|
|
|
|
(not (eq symbol definition))
|
2003-01-13 08:04:46 +00:00
|
|
|
|
(eq func (condition-case ()
|
|
|
|
|
(indirect-function symbol)
|
|
|
|
|
(error symbol)))
|
2002-11-07 18:28:09 +00:00
|
|
|
|
(push symbol defs))))
|
2005-03-21 17:41:41 +00:00
|
|
|
|
;; Look at all the symbols--first DEFINITION,
|
|
|
|
|
;; then its aliases.
|
|
|
|
|
(dolist (symbol (cons definition defs))
|
|
|
|
|
(let* ((remapped (command-remapping symbol))
|
|
|
|
|
(keys (where-is-internal
|
|
|
|
|
symbol overriding-local-map nil nil remapped))
|
|
|
|
|
(keys (mapconcat 'key-description keys ", "))
|
|
|
|
|
string)
|
|
|
|
|
(setq string
|
|
|
|
|
(if insert
|
|
|
|
|
(if (> (length keys) 0)
|
|
|
|
|
(if remapped
|
|
|
|
|
(format "%s (%s) (remapped from %s)"
|
|
|
|
|
keys remapped symbol)
|
|
|
|
|
(format "%s (%s)" keys symbol))
|
|
|
|
|
(format "M-x %s RET" symbol))
|
|
|
|
|
(if (> (length keys) 0)
|
|
|
|
|
(if remapped
|
|
|
|
|
(format "%s is remapped to %s which is on %s"
|
2006-02-14 08:14:01 +00:00
|
|
|
|
symbol remapped keys)
|
2005-03-21 17:41:41 +00:00
|
|
|
|
(format "%s is on %s" symbol keys))
|
|
|
|
|
;; If this is the command the user asked about,
|
|
|
|
|
;; and it is not on any key, say so.
|
|
|
|
|
;; For other symbols, its aliases, say nothing
|
|
|
|
|
;; about them unless they are on keys.
|
|
|
|
|
(if (eq symbol definition)
|
|
|
|
|
(format "%s is not on any key" symbol)))))
|
|
|
|
|
(when string
|
|
|
|
|
(unless (eq symbol definition)
|
|
|
|
|
(princ ";\n its alias "))
|
|
|
|
|
(princ string)))))
|
1994-03-23 04:54:20 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(defun string-key-binding (key)
|
|
|
|
|
"Value is the binding of KEY in a string.
|
|
|
|
|
If KEY is an event on a string, and that string has a `local-map'
|
|
|
|
|
or `keymap' property, return the binding of KEY in the string's keymap."
|
|
|
|
|
(let* ((defn nil)
|
|
|
|
|
(start (when (vectorp key)
|
2002-04-12 09:40:56 +00:00
|
|
|
|
(if (memq (aref key 0)
|
|
|
|
|
'(mode-line header-line left-margin right-margin))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(event-start (aref key 1))
|
|
|
|
|
(and (consp (aref key 0))
|
|
|
|
|
(event-start (aref key 0))))))
|
|
|
|
|
(string-info (and (consp start) (nth 4 start))))
|
|
|
|
|
(when string-info
|
|
|
|
|
(let* ((string (car string-info))
|
|
|
|
|
(pos (cdr string-info))
|
2002-04-12 09:40:56 +00:00
|
|
|
|
(local-map (and (>= pos 0)
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(< pos (length string))
|
|
|
|
|
(or (get-text-property pos 'local-map string)
|
|
|
|
|
(get-text-property pos 'keymap string)))))
|
|
|
|
|
(setq defn (and local-map (lookup-key local-map key)))))
|
|
|
|
|
defn))
|
1992-05-30 23:12:08 +00:00
|
|
|
|
|
2002-04-02 03:23:26 +00:00
|
|
|
|
(defun help-key-description (key untranslated)
|
|
|
|
|
(let ((string (key-description key)))
|
2002-07-16 16:08:44 +00:00
|
|
|
|
(if (or (not untranslated)
|
|
|
|
|
(and (eq (aref untranslated 0) ?\e) (not (eq (aref key 0) ?\e))))
|
2002-04-02 03:23:26 +00:00
|
|
|
|
string
|
|
|
|
|
(let ((otherstring (key-description untranslated)))
|
|
|
|
|
(if (equal string otherstring)
|
|
|
|
|
string
|
|
|
|
|
(format "%s (translated from %s)" string otherstring))))))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
2006-02-11 13:55:42 +00:00
|
|
|
|
(defun describe-key-briefly (&optional key insert untranslated)
|
|
|
|
|
"Print the name of the function KEY invokes. KEY is a string.
|
|
|
|
|
If INSERT (the prefix arg) is non-nil, insert the message in the buffer.
|
|
|
|
|
If non-nil, UNTRANSLATED is a vector of the untranslated events.
|
|
|
|
|
It can also be a number in which case the untranslated events from
|
|
|
|
|
the last key hit are used.
|
|
|
|
|
|
|
|
|
|
If KEY is a menu item or a tool-bar button that is disabled, this command
|
2006-02-11 16:03:14 +00:00
|
|
|
|
temporarily enables it to allow getting help on disabled items and buttons."
|
2006-02-13 16:18:46 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(let ((enable-disabled-menus-and-buttons t)
|
|
|
|
|
(cursor-in-echo-area t)
|
|
|
|
|
saved-yank-menu)
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(let (key)
|
|
|
|
|
;; If yank-menu is empty, populate it temporarily, so that
|
|
|
|
|
;; "Select and Paste" menu can generate a complete event.
|
|
|
|
|
(when (null (cdr yank-menu))
|
|
|
|
|
(setq saved-yank-menu (copy-sequence yank-menu))
|
|
|
|
|
(menu-bar-update-yank-menu "(any string)" nil))
|
|
|
|
|
(setq key (read-key-sequence "Describe key (or click or menu item): "))
|
2006-03-07 15:53:41 +00:00
|
|
|
|
;; If KEY is a down-event, read and discard the
|
|
|
|
|
;; corresponding up-event.
|
|
|
|
|
(if (and (vectorp key)
|
|
|
|
|
(eventp (elt key 0))
|
|
|
|
|
(memq 'down (event-modifiers (elt key 0))))
|
|
|
|
|
(read-event))
|
2006-02-13 16:18:46 +00:00
|
|
|
|
(list
|
|
|
|
|
key
|
2006-02-21 19:51:37 +00:00
|
|
|
|
(if current-prefix-arg (prefix-numeric-value current-prefix-arg))
|
|
|
|
|
1))
|
2006-02-13 16:18:46 +00:00
|
|
|
|
;; Put yank-menu back as it was, if we changed it.
|
|
|
|
|
(when saved-yank-menu
|
|
|
|
|
(setq yank-menu (copy-sequence saved-yank-menu))
|
|
|
|
|
(fset 'yank-menu (cons 'keymap yank-menu))))))
|
2002-04-02 03:23:26 +00:00
|
|
|
|
(if (numberp untranslated)
|
|
|
|
|
(setq untranslated (this-single-command-raw-keys)))
|
(help-highlight-face): Use underline.
(help-mode-maybe): Ensure read-only.
(help-xref-button): Obey help-highlight-p.
(help-follow): Remove check for args being a list.
(help-mode): Doc fix.
(help-highlight-p): Put in help group.
(help-make-xrefs): Insert button label in scope of
inhibit-read-only binding.
(help-mode-map, help-make-xrefs): Define TAB, RET correctly.
Make hyperlinks for cross-reference info intuited from *Help* buffer.
(help-font-lock-keywords): Removed.
(help-mode-map): Define keys for navigating hyperlinks.
(help-xref-stack, help-xref-stack-item): New permanent-local variables.
(help-mode): Set font-lock-defaults to nil.
(help-mode-maybe): Invoke help-make-xrefs in Help mode.
(help-setup-xref): New function.
(describe-key, describe-mode, describe-function,
describe-variable): Call it.
(view-lossage, describe-bindings): Nullify help-xref-stack,
help-xref-stack-item.
(help-highlight-p): New option.
(help-highlight-face): New variable.
(help-back-label, help-xref-symbol-regexp, help-xref-info-regexp):
New variables.
(help-setup-xref, help-make-xrefs, help-xref-button,
help-xref-interned, help-xref-mode, help-follow-mouse,
help-xref-go-back, help-go-back, help-follow, help-next-ref): New functions.
1998-04-05 19:10:02 +00:00
|
|
|
|
(save-excursion
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(let ((modifiers (event-modifiers (aref key 0)))
|
|
|
|
|
(standard-output (if insert (current-buffer) t))
|
|
|
|
|
window position)
|
|
|
|
|
;; For a mouse button event, go to the button it applies to
|
|
|
|
|
;; to get the right key bindings. And go to the right place
|
|
|
|
|
;; in case the keymap depends on where you clicked.
|
|
|
|
|
(if (or (memq 'click modifiers) (memq 'down modifiers)
|
|
|
|
|
(memq 'drag modifiers))
|
|
|
|
|
(setq window (posn-window (event-start (aref key 0)))
|
|
|
|
|
position (posn-point (event-start (aref key 0)))))
|
|
|
|
|
(if (windowp window)
|
|
|
|
|
(progn
|
|
|
|
|
(set-buffer (window-buffer window))
|
|
|
|
|
(goto-char position)))
|
|
|
|
|
;; Ok, now look up the key and name the command.
|
|
|
|
|
(let ((defn (or (string-key-binding key)
|
2005-11-29 15:42:42 +00:00
|
|
|
|
(key-binding key t)))
|
2005-04-10 01:47:43 +00:00
|
|
|
|
key-desc)
|
2006-02-13 16:18:46 +00:00
|
|
|
|
;; Handle the case where we faked an entry in "Select and Paste" menu.
|
|
|
|
|
(if (and (eq defn nil)
|
|
|
|
|
(stringp (aref key (1- (length key))))
|
|
|
|
|
(eq (key-binding (substring key 0 -1)) 'yank-menu))
|
|
|
|
|
(setq defn 'menu-bar-select-yank))
|
2005-04-10 01:47:43 +00:00
|
|
|
|
;; Don't bother user with strings from (e.g.) the select-paste menu.
|
|
|
|
|
(if (stringp (aref key (1- (length key))))
|
|
|
|
|
(aset key (1- (length key)) "(any string)"))
|
2005-04-13 09:16:02 +00:00
|
|
|
|
(if (and (> (length untranslated) 0)
|
|
|
|
|
(stringp (aref untranslated (1- (length untranslated)))))
|
2005-04-10 01:47:43 +00:00
|
|
|
|
(aset untranslated (1- (length untranslated))
|
|
|
|
|
"(any string)"))
|
|
|
|
|
;; Now describe the key, perhaps as changed.
|
|
|
|
|
(setq key-desc (help-key-description key untranslated))
|
2002-03-04 09:24:40 +00:00
|
|
|
|
(if (or (null defn) (integerp defn) (equal defn 'undefined))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(princ (format "%s is undefined" key-desc))
|
2002-02-15 19:59:25 +00:00
|
|
|
|
(princ (format (if (windowp window)
|
|
|
|
|
"%s at that spot runs the command %s"
|
|
|
|
|
"%s runs the command %s")
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
key-desc
|
|
|
|
|
(if (symbolp defn) defn (prin1-to-string defn)))))))))
|
2000-09-07 02:37:37 +00:00
|
|
|
|
|
2006-02-11 13:55:42 +00:00
|
|
|
|
(defun describe-key (&optional key untranslated up-event)
|
|
|
|
|
"Display documentation of the function invoked by KEY.
|
|
|
|
|
KEY can be any kind of a key sequence; it can include keyboard events,
|
|
|
|
|
mouse events, and/or menu events. When calling from a program,
|
|
|
|
|
pass KEY as a string or a vector.
|
|
|
|
|
|
|
|
|
|
If non-nil, UNTRANSLATED is a vector of the corresponding untranslated events.
|
|
|
|
|
It can also be a number, in which case the untranslated events from
|
|
|
|
|
the last key sequence entered are used.
|
|
|
|
|
UP-EVENT is the up-event that was discarded by reading KEY, or nil.
|
|
|
|
|
|
|
|
|
|
If KEY is a menu item or a tool-bar button that is disabled, this command
|
2006-02-11 16:03:14 +00:00
|
|
|
|
temporarily enables it to allow getting help on disabled items and buttons."
|
2006-02-13 16:18:46 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(let ((enable-disabled-menus-and-buttons t)
|
|
|
|
|
(cursor-in-echo-area t)
|
|
|
|
|
saved-yank-menu)
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(let (key)
|
|
|
|
|
;; If yank-menu is empty, populate it temporarily, so that
|
|
|
|
|
;; "Select and Paste" menu can generate a complete event.
|
|
|
|
|
(when (null (cdr yank-menu))
|
|
|
|
|
(setq saved-yank-menu (copy-sequence yank-menu))
|
|
|
|
|
(menu-bar-update-yank-menu "(any string)" nil))
|
|
|
|
|
(setq key (read-key-sequence "Describe key (or click or menu item): "))
|
|
|
|
|
(list
|
|
|
|
|
key
|
|
|
|
|
(prefix-numeric-value current-prefix-arg)
|
|
|
|
|
;; If KEY is a down-event, read the corresponding up-event
|
|
|
|
|
;; and use it as the third argument.
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(if (and (vectorp key)
|
|
|
|
|
(eventp (elt key 0))
|
|
|
|
|
(memq 'down (event-modifiers (elt key 0))))
|
2006-02-13 16:18:46 +00:00
|
|
|
|
(read-event))))
|
|
|
|
|
;; Put yank-menu back as it was, if we changed it.
|
|
|
|
|
(when saved-yank-menu
|
|
|
|
|
(setq yank-menu (copy-sequence saved-yank-menu))
|
|
|
|
|
(fset 'yank-menu (cons 'keymap yank-menu))))))
|
2002-04-02 03:23:26 +00:00
|
|
|
|
(if (numberp untranslated)
|
|
|
|
|
(setq untranslated (this-single-command-raw-keys)))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((modifiers (event-modifiers (aref key 0)))
|
|
|
|
|
window position)
|
|
|
|
|
;; For a mouse button event, go to the button it applies to
|
|
|
|
|
;; to get the right key bindings. And go to the right place
|
|
|
|
|
;; in case the keymap depends on where you clicked.
|
|
|
|
|
(if (or (memq 'click modifiers) (memq 'down modifiers)
|
|
|
|
|
(memq 'drag modifiers))
|
|
|
|
|
(setq window (posn-window (event-start (aref key 0)))
|
|
|
|
|
position (posn-point (event-start (aref key 0)))))
|
2001-10-11 22:31:20 +00:00
|
|
|
|
(when (windowp window)
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(set-buffer (window-buffer window))
|
2001-10-11 22:31:20 +00:00
|
|
|
|
(goto-char position))
|
2005-11-29 15:42:42 +00:00
|
|
|
|
(let ((defn (or (string-key-binding key) (key-binding key t))))
|
2006-02-13 16:18:46 +00:00
|
|
|
|
;; Handle the case where we faked an entry in "Select and Paste" menu.
|
|
|
|
|
(if (and (eq defn nil)
|
|
|
|
|
(stringp (aref key (1- (length key))))
|
|
|
|
|
(eq (key-binding (substring key 0 -1)) 'yank-menu))
|
|
|
|
|
(setq defn 'menu-bar-select-yank))
|
2002-03-04 09:24:40 +00:00
|
|
|
|
(if (or (null defn) (integerp defn) (equal defn 'undefined))
|
2002-04-02 03:23:26 +00:00
|
|
|
|
(message "%s is undefined" (help-key-description key untranslated))
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(help-setup-xref (list #'describe-function defn) (interactive-p))
|
2005-04-10 01:47:43 +00:00
|
|
|
|
;; Don't bother user with strings from (e.g.) the select-paste menu.
|
|
|
|
|
(if (stringp (aref key (1- (length key))))
|
|
|
|
|
(aset key (1- (length key)) "(any string)"))
|
2005-05-04 14:31:45 +00:00
|
|
|
|
(if (and untranslated
|
|
|
|
|
(stringp (aref untranslated (1- (length untranslated)))))
|
2005-04-10 01:47:43 +00:00
|
|
|
|
(aset untranslated (1- (length untranslated))
|
|
|
|
|
"(any string)"))
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(with-output-to-temp-buffer (help-buffer)
|
2002-04-02 03:23:26 +00:00
|
|
|
|
(princ (help-key-description key untranslated))
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(if (windowp window)
|
|
|
|
|
(princ " at that spot"))
|
|
|
|
|
(princ " runs the command ")
|
|
|
|
|
(prin1 defn)
|
|
|
|
|
(princ "\n which is ")
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(describe-function-1 defn)
|
2004-10-26 12:59:44 +00:00
|
|
|
|
(when up-event
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(let ((type (event-basic-type up-event))
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(hdr "\n\n-------------- up event ---------------\n\n")
|
2006-03-06 22:31:36 +00:00
|
|
|
|
defn sequence
|
2004-12-17 15:16:46 +00:00
|
|
|
|
mouse-1-tricky mouse-1-remapped)
|
2006-03-06 22:31:36 +00:00
|
|
|
|
(setq sequence (vector up-event))
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(when (and (eq type 'mouse-1)
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(windowp window)
|
|
|
|
|
mouse-1-click-follows-link
|
|
|
|
|
(not (eq mouse-1-click-follows-link 'double))
|
2006-03-06 22:31:36 +00:00
|
|
|
|
(setq mouse-1-remapped
|
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
|
(mouse-on-link-p (posn-point
|
|
|
|
|
(event-start up-event))))))
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(setq mouse-1-tricky (and (integerp mouse-1-click-follows-link)
|
|
|
|
|
(> mouse-1-click-follows-link 0)))
|
2006-03-06 22:31:36 +00:00
|
|
|
|
(cond ((stringp mouse-1-remapped)
|
|
|
|
|
(setq sequence mouse-1-remapped))
|
|
|
|
|
((vectorp mouse-1-remapped)
|
|
|
|
|
(setcar up-event (elt mouse-1-remapped 0)))
|
|
|
|
|
(t (setcar up-event 'mouse-2))))
|
|
|
|
|
(setq defn (or (string-key-binding sequence)
|
|
|
|
|
(key-binding sequence)))
|
2004-10-26 12:59:44 +00:00
|
|
|
|
(unless (or (null defn) (integerp defn) (equal defn 'undefined))
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(princ (if mouse-1-tricky
|
|
|
|
|
"\n\n----------------- up-event (short click) ----------------\n\n"
|
|
|
|
|
hdr))
|
|
|
|
|
(setq hdr nil)
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(princ (symbol-name type))
|
2004-10-26 12:59:44 +00:00
|
|
|
|
(if (windowp window)
|
|
|
|
|
(princ " at that spot"))
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(if mouse-1-remapped
|
|
|
|
|
(princ " is remapped to <mouse-2>\n which" ))
|
2004-10-26 12:59:44 +00:00
|
|
|
|
(princ " runs the command ")
|
|
|
|
|
(prin1 defn)
|
|
|
|
|
(princ "\n which is ")
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(describe-function-1 defn))
|
|
|
|
|
(when mouse-1-tricky
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(setcar up-event 'mouse-1)
|
2006-03-06 22:31:36 +00:00
|
|
|
|
(setq defn (or (string-key-binding (vector up-event))
|
|
|
|
|
(key-binding (vector up-event))))
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(unless (or (null defn) (integerp defn) (eq defn 'undefined))
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(princ (or hdr
|
|
|
|
|
"\n\n----------------- up-event (long click) ----------------\n\n"))
|
2006-03-06 20:27:06 +00:00
|
|
|
|
(princ "Pressing mouse-1")
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(if (windowp window)
|
|
|
|
|
(princ " at that spot"))
|
|
|
|
|
(princ (format " for longer than %d milli-seconds\n"
|
2006-03-06 20:27:06 +00:00
|
|
|
|
mouse-1-click-follows-link))
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(princ " runs the command ")
|
|
|
|
|
(prin1 defn)
|
|
|
|
|
(princ "\n which is ")
|
2005-05-22 15:52:51 +00:00
|
|
|
|
(describe-function-1 defn)))))
|
|
|
|
|
(print-help-return-message)))))))
|
(help-highlight-face): Use underline.
(help-mode-maybe): Ensure read-only.
(help-xref-button): Obey help-highlight-p.
(help-follow): Remove check for args being a list.
(help-mode): Doc fix.
(help-highlight-p): Put in help group.
(help-make-xrefs): Insert button label in scope of
inhibit-read-only binding.
(help-mode-map, help-make-xrefs): Define TAB, RET correctly.
Make hyperlinks for cross-reference info intuited from *Help* buffer.
(help-font-lock-keywords): Removed.
(help-mode-map): Define keys for navigating hyperlinks.
(help-xref-stack, help-xref-stack-item): New permanent-local variables.
(help-mode): Set font-lock-defaults to nil.
(help-mode-maybe): Invoke help-make-xrefs in Help mode.
(help-setup-xref): New function.
(describe-key, describe-mode, describe-function,
describe-variable): Call it.
(view-lossage, describe-bindings): Nullify help-xref-stack,
help-xref-stack-item.
(help-highlight-p): New option.
(help-highlight-face): New variable.
(help-back-label, help-xref-symbol-regexp, help-xref-info-regexp):
New variables.
(help-setup-xref, help-make-xrefs, help-xref-button,
help-xref-interned, help-xref-mode, help-follow-mouse,
help-xref-go-back, help-go-back, help-follow, help-next-ref): New functions.
1998-04-05 19:10:02 +00:00
|
|
|
|
|
Don't require `view' when compiling.
(help-with-tutorial, describe-function, describe-function-1)
(variable-at-point, describe-variable, locate-library):
Functions moved into `help-funs.el'.
(help-manyarg-func-alist): Variable moved into `help-funs.el'.
(help-mode, help-mode-setup, help-mode-finish, help-button-action)
(help-setup-xref, help-xref-following, help-make-xrefs)
(help-xref-button, help-insert-xref-button, help-xref-interned)
(help-xref-go-back, help-go-back, help-do-xref, help-follow)
(help-xref-on-pp): Functions moved into `help-mode.el'
(help-mode-map, help-xref-stack, help-xref-stack-item)
(help-highlight-p, help-highlight-face, help-back-label)
(help-xref-symbol-regexp, help-xref-mule-regexp)
(help-xref-info-regexp): Variables moved into `help-mode.el'.
(help-symbol, help-back, help-info, help-customize-variable)
(help-function-def, help-variable-def):
Button-types moved into `help-mode.el'.
(load-symbol-file-load-history, symbol-file):
Functions moved into `subr.el'.
(symbol-file-load-history-loaded): Variable moved into `subr.el'.
(view-lossage): Call `help-setup-xref' instead of doing it manually.
2001-10-09 11:17:39 +00:00
|
|
|
|
(defun describe-mode (&optional buffer)
|
|
|
|
|
"Display documentation of current major mode and minor modes.
|
2004-04-12 10:25:33 +00:00
|
|
|
|
A brief summary of the minor modes comes first, followed by the
|
|
|
|
|
major mode description. This is followed by detailed
|
|
|
|
|
descriptions of the minor modes, each on a separate page.
|
|
|
|
|
|
|
|
|
|
For this to work correctly for a minor mode, the mode's indicator
|
|
|
|
|
variable \(listed in `minor-mode-alist') must also be a function
|
|
|
|
|
whose documentation describes the minor mode."
|
(help-highlight-face): Use underline.
(help-mode-maybe): Ensure read-only.
(help-xref-button): Obey help-highlight-p.
(help-follow): Remove check for args being a list.
(help-mode): Doc fix.
(help-highlight-p): Put in help group.
(help-make-xrefs): Insert button label in scope of
inhibit-read-only binding.
(help-mode-map, help-make-xrefs): Define TAB, RET correctly.
Make hyperlinks for cross-reference info intuited from *Help* buffer.
(help-font-lock-keywords): Removed.
(help-mode-map): Define keys for navigating hyperlinks.
(help-xref-stack, help-xref-stack-item): New permanent-local variables.
(help-mode): Set font-lock-defaults to nil.
(help-mode-maybe): Invoke help-make-xrefs in Help mode.
(help-setup-xref): New function.
(describe-key, describe-mode, describe-function,
describe-variable): Call it.
(view-lossage, describe-bindings): Nullify help-xref-stack,
help-xref-stack-item.
(help-highlight-p): New option.
(help-highlight-face): New variable.
(help-back-label, help-xref-symbol-regexp, help-xref-info-regexp):
New variables.
(help-setup-xref, help-make-xrefs, help-xref-button,
help-xref-interned, help-xref-mode, help-follow-mouse,
help-xref-go-back, help-go-back, help-follow, help-next-ref): New functions.
1998-04-05 19:10:02 +00:00
|
|
|
|
(interactive)
|
2005-03-10 21:43:16 +00:00
|
|
|
|
(unless buffer (setq buffer (current-buffer)))
|
|
|
|
|
(help-setup-xref (list #'describe-mode buffer)
|
2002-01-12 20:53:27 +00:00
|
|
|
|
(interactive-p))
|
|
|
|
|
;; For the sake of help-do-xref and help-xref-go-back,
|
|
|
|
|
;; don't switch buffers before calling `help-buffer'.
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(with-output-to-temp-buffer (help-buffer)
|
2005-03-10 21:43:16 +00:00
|
|
|
|
(with-current-buffer buffer
|
2003-09-30 12:50:44 +00:00
|
|
|
|
(let (minor-modes)
|
2005-03-10 21:43:16 +00:00
|
|
|
|
;; Older packages do not register in minor-mode-list but only in
|
|
|
|
|
;; minor-mode-alist.
|
|
|
|
|
(dolist (x minor-mode-alist)
|
|
|
|
|
(setq x (car x))
|
|
|
|
|
(unless (memq x minor-mode-list)
|
|
|
|
|
(push x minor-mode-list)))
|
2003-09-30 12:50:44 +00:00
|
|
|
|
;; Find enabled minor mode we will want to mention.
|
|
|
|
|
(dolist (mode minor-mode-list)
|
|
|
|
|
;; Document a minor mode if it is listed in minor-mode-alist,
|
|
|
|
|
;; non-nil, and has a function definition.
|
2005-03-16 13:08:15 +00:00
|
|
|
|
(let ((fmode (or (get mode :minor-mode-function) mode)))
|
|
|
|
|
(and (boundp mode) (symbol-value mode)
|
|
|
|
|
(fboundp fmode)
|
|
|
|
|
(let ((pretty-minor-mode
|
|
|
|
|
(if (string-match "\\(\\(-minor\\)?-mode\\)?\\'"
|
|
|
|
|
(symbol-name fmode))
|
|
|
|
|
(capitalize
|
|
|
|
|
(substring (symbol-name fmode)
|
|
|
|
|
0 (match-beginning 0)))
|
|
|
|
|
fmode)))
|
|
|
|
|
(push (list fmode pretty-minor-mode
|
|
|
|
|
(format-mode-line (assq mode minor-mode-alist)))
|
|
|
|
|
minor-modes)))))
|
2003-09-30 12:50:44 +00:00
|
|
|
|
(setq minor-modes
|
|
|
|
|
(sort minor-modes
|
2005-03-16 13:08:15 +00:00
|
|
|
|
(lambda (a b) (string-lessp (cadr a) (cadr b)))))
|
2003-09-30 12:50:44 +00:00
|
|
|
|
(when minor-modes
|
|
|
|
|
(princ "Summary of minor modes:\n")
|
2004-10-13 19:01:01 +00:00
|
|
|
|
(make-local-variable 'help-button-cache)
|
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
|
(dolist (mode minor-modes)
|
2005-03-16 13:08:15 +00:00
|
|
|
|
(let ((mode-function (nth 0 mode))
|
|
|
|
|
(pretty-minor-mode (nth 1 mode))
|
2004-10-13 19:01:01 +00:00
|
|
|
|
(indicator (nth 2 mode)))
|
2005-03-10 21:43:16 +00:00
|
|
|
|
(setq indicator (if (zerop (length indicator))
|
|
|
|
|
"no indicator"
|
|
|
|
|
(format "indicator%s" indicator)))
|
2004-10-13 19:01:01 +00:00
|
|
|
|
(add-text-properties 0 (length pretty-minor-mode)
|
|
|
|
|
'(face bold) pretty-minor-mode)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(princ "\n\f\n")
|
|
|
|
|
(push (point-marker) help-button-cache)
|
|
|
|
|
;; Document the minor modes fully.
|
|
|
|
|
(insert pretty-minor-mode)
|
2005-03-10 21:43:16 +00:00
|
|
|
|
(princ (format " minor mode (%s):\n" indicator))
|
2004-10-13 19:01:01 +00:00
|
|
|
|
(princ (documentation mode-function)))
|
|
|
|
|
(princ " ")
|
|
|
|
|
(insert-button pretty-minor-mode
|
|
|
|
|
'action (car help-button-cache)
|
2004-12-17 15:16:46 +00:00
|
|
|
|
'follow-link t
|
2004-10-13 19:01:01 +00:00
|
|
|
|
'help-echo "mouse-2, RET: show full information")
|
2005-03-10 21:43:16 +00:00
|
|
|
|
(princ (format " minor mode (%s):\n" indicator)))))
|
2003-09-30 12:50:44 +00:00
|
|
|
|
(princ "\n(Full information about these minor modes
|
|
|
|
|
follows the description of the major mode.)\n\n"))
|
|
|
|
|
;; Document the major mode.
|
2004-10-13 19:01:01 +00:00
|
|
|
|
(let ((mode mode-name))
|
|
|
|
|
(with-current-buffer standard-output
|
2006-02-23 16:39:24 +00:00
|
|
|
|
(let ((start (point)))
|
|
|
|
|
(insert (format-mode-line mode))
|
|
|
|
|
(add-text-properties start (point) '(face bold)))))
|
2003-09-30 12:50:44 +00:00
|
|
|
|
(princ " mode:\n")
|
2004-10-13 19:01:01 +00:00
|
|
|
|
(princ (documentation major-mode)))
|
2002-01-12 20:53:27 +00:00
|
|
|
|
(print-help-return-message))))
|
(help-highlight-face): Use underline.
(help-mode-maybe): Ensure read-only.
(help-xref-button): Obey help-highlight-p.
(help-follow): Remove check for args being a list.
(help-mode): Doc fix.
(help-highlight-p): Put in help group.
(help-make-xrefs): Insert button label in scope of
inhibit-read-only binding.
(help-mode-map, help-make-xrefs): Define TAB, RET correctly.
Make hyperlinks for cross-reference info intuited from *Help* buffer.
(help-font-lock-keywords): Removed.
(help-mode-map): Define keys for navigating hyperlinks.
(help-xref-stack, help-xref-stack-item): New permanent-local variables.
(help-mode): Set font-lock-defaults to nil.
(help-mode-maybe): Invoke help-make-xrefs in Help mode.
(help-setup-xref): New function.
(describe-key, describe-mode, describe-function,
describe-variable): Call it.
(view-lossage, describe-bindings): Nullify help-xref-stack,
help-xref-stack-item.
(help-highlight-p): New option.
(help-highlight-face): New variable.
(help-back-label, help-xref-symbol-regexp, help-xref-info-regexp):
New variables.
(help-setup-xref, help-make-xrefs, help-xref-button,
help-xref-interned, help-xref-mode, help-follow-mouse,
help-xref-go-back, help-go-back, help-follow, help-next-ref): New functions.
1998-04-05 19:10:02 +00:00
|
|
|
|
|
2003-09-30 12:50:44 +00:00
|
|
|
|
|
2003-03-31 20:22:58 +00:00
|
|
|
|
(defun describe-minor-mode (minor-mode)
|
2003-04-12 17:28:24 +00:00
|
|
|
|
"Display documentation of a minor mode given as MINOR-MODE.
|
|
|
|
|
MINOR-MODE can be a minor mode symbol or a minor mode indicator string
|
|
|
|
|
appeared on the mode-line."
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(interactive (list (completing-read
|
2003-04-12 17:28:24 +00:00
|
|
|
|
"Minor mode: "
|
|
|
|
|
(nconc
|
|
|
|
|
(describe-minor-mode-completion-table-for-symbol)
|
|
|
|
|
(describe-minor-mode-completion-table-for-indicator)
|
|
|
|
|
))))
|
|
|
|
|
(if (symbolp minor-mode)
|
|
|
|
|
(setq minor-mode (symbol-name minor-mode)))
|
|
|
|
|
(let ((symbols (describe-minor-mode-completion-table-for-symbol))
|
|
|
|
|
(indicators (describe-minor-mode-completion-table-for-indicator)))
|
|
|
|
|
(cond
|
|
|
|
|
((member minor-mode symbols)
|
|
|
|
|
(describe-minor-mode-from-symbol (intern minor-mode)))
|
|
|
|
|
((member minor-mode indicators)
|
|
|
|
|
(describe-minor-mode-from-indicator minor-mode))
|
|
|
|
|
(t
|
|
|
|
|
(error "No such minor mode: %s" minor-mode)))))
|
|
|
|
|
|
2003-11-30 17:50:54 +00:00
|
|
|
|
;; symbol
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(defun describe-minor-mode-completion-table-for-symbol ()
|
|
|
|
|
;; In order to list up all minor modes, minor-mode-list
|
|
|
|
|
;; is used here instead of minor-mode-alist.
|
|
|
|
|
(delq nil (mapcar 'symbol-name minor-mode-list)))
|
|
|
|
|
(defun describe-minor-mode-from-symbol (symbol)
|
|
|
|
|
"Display documentation of a minor mode given as a symbol, SYMBOL"
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(interactive (list (intern (completing-read
|
2003-04-12 17:28:24 +00:00
|
|
|
|
"Minor mode symbol: "
|
|
|
|
|
(describe-minor-mode-completion-table-for-symbol)))))
|
|
|
|
|
(if (fboundp symbol)
|
|
|
|
|
(describe-function symbol)
|
|
|
|
|
(describe-variable symbol)))
|
|
|
|
|
|
|
|
|
|
;; indicator
|
|
|
|
|
(defun describe-minor-mode-completion-table-for-indicator ()
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(delq nil
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(mapcar (lambda (x)
|
|
|
|
|
(let ((i (format-mode-line x)))
|
|
|
|
|
;; remove first space if existed
|
|
|
|
|
(cond
|
|
|
|
|
((= 0 (length i))
|
|
|
|
|
nil)
|
|
|
|
|
((eq (aref i 0) ?\ )
|
|
|
|
|
(substring i 1))
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(t
|
2003-04-12 17:28:24 +00:00
|
|
|
|
i))))
|
|
|
|
|
minor-mode-alist)))
|
2003-03-31 20:22:58 +00:00
|
|
|
|
(defun describe-minor-mode-from-indicator (indicator)
|
2003-04-12 17:28:24 +00:00
|
|
|
|
"Display documentation of a minor mode specified by INDICATOR.
|
|
|
|
|
If you call this function interactively, you can give indicator which
|
|
|
|
|
is currently activated with completion."
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(interactive (list
|
|
|
|
|
(completing-read
|
2003-03-31 20:22:58 +00:00
|
|
|
|
"Minor mode indicator: "
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(describe-minor-mode-completion-table-for-indicator))))
|
2003-03-31 20:22:58 +00:00
|
|
|
|
(let ((minor-mode (lookup-minor-mode-from-indicator indicator)))
|
|
|
|
|
(if minor-mode
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(describe-minor-mode-from-symbol minor-mode)
|
2003-03-31 20:22:58 +00:00
|
|
|
|
(error "Cannot find minor mode for `%s'" indicator))))
|
|
|
|
|
|
|
|
|
|
(defun lookup-minor-mode-from-indicator (indicator)
|
|
|
|
|
"Return a minor mode symbol from its indicator on the modeline."
|
2003-04-12 17:28:24 +00:00
|
|
|
|
;; remove first space if existed
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(if (and (< 0 (length indicator))
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(eq (aref indicator 0) ?\ ))
|
|
|
|
|
(setq indicator (substring indicator 1)))
|
2003-03-31 20:22:58 +00:00
|
|
|
|
(let ((minor-modes minor-mode-alist)
|
|
|
|
|
result)
|
|
|
|
|
(while minor-modes
|
|
|
|
|
(let* ((minor-mode (car (car minor-modes)))
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(anindicator (format-mode-line
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(car (cdr (car minor-modes))))))
|
|
|
|
|
;; remove first space if existed
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(if (and (stringp anindicator)
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(> (length anindicator) 0)
|
|
|
|
|
(eq (aref anindicator 0) ?\ ))
|
|
|
|
|
(setq anindicator (substring anindicator 1)))
|
|
|
|
|
(if (equal indicator anindicator)
|
2003-03-31 20:22:58 +00:00
|
|
|
|
(setq result minor-mode
|
|
|
|
|
minor-modes nil)
|
|
|
|
|
(setq minor-modes (cdr minor-modes)))))
|
|
|
|
|
result))
|
|
|
|
|
|
1998-11-22 17:26:16 +00:00
|
|
|
|
|
|
|
|
|
;;; Automatic resizing of temporary buffers.
|
|
|
|
|
|
1998-11-22 17:31:55 +00:00
|
|
|
|
(defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2))
|
2006-02-23 16:39:24 +00:00
|
|
|
|
"Maximum height of a window displaying a temporary buffer.
|
2006-05-30 02:35:56 +00:00
|
|
|
|
This is effective only when Temp Buffer Resize mode is enabled.
|
|
|
|
|
The value is the maximum height (in lines) which `resize-temp-buffer-window'
|
1998-11-22 17:26:16 +00:00
|
|
|
|
will give to a window displaying a temporary buffer.
|
2006-05-30 02:35:56 +00:00
|
|
|
|
It can also be a function to be called to choose the height for such a buffer.
|
|
|
|
|
It gets one argumemt, the buffer, and should return a positive integer."
|
1998-11-22 17:26:16 +00:00
|
|
|
|
:type '(choice integer function)
|
|
|
|
|
:group 'help
|
|
|
|
|
:version "20.4")
|
|
|
|
|
|
2000-10-05 22:27:38 +00:00
|
|
|
|
(define-minor-mode temp-buffer-resize-mode
|
|
|
|
|
"Toggle the mode which makes windows smaller for temporary buffers.
|
1998-11-22 17:26:16 +00:00
|
|
|
|
With prefix argument ARG, turn the resizing of windows displaying temporary
|
|
|
|
|
buffers on if ARG is positive or off otherwise.
|
2000-10-05 22:27:38 +00:00
|
|
|
|
This makes the window the right height for its contents, but never
|
|
|
|
|
more than `temp-buffer-max-height' nor less than `window-min-height'.
|
|
|
|
|
This applies to `help', `apropos' and `completion' buffers, and some others."
|
2001-10-08 00:19:58 +00:00
|
|
|
|
:global t :group 'help
|
2000-10-05 22:27:38 +00:00
|
|
|
|
(if temp-buffer-resize-mode
|
2001-02-21 02:37:01 +00:00
|
|
|
|
;; `help-make-xrefs' may add a `back' button and thus increase the
|
2000-10-05 22:27:38 +00:00
|
|
|
|
;; text size, so `resize-temp-buffer-window' must be run *after* it.
|
|
|
|
|
(add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append)
|
2000-10-05 22:28:23 +00:00
|
|
|
|
(remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window)))
|
1998-11-22 17:26:16 +00:00
|
|
|
|
|
|
|
|
|
(defun resize-temp-buffer-window ()
|
|
|
|
|
"Resize the current window to fit its contents.
|
1998-11-22 17:31:55 +00:00
|
|
|
|
Will not make it higher than `temp-buffer-max-height' nor smaller than
|
1999-01-15 17:29:03 +00:00
|
|
|
|
`window-min-height'. Do nothing if it is the only window on its frame, if it
|
1998-11-22 17:26:16 +00:00
|
|
|
|
is not as wide as the frame or if some of the window's contents are scrolled
|
|
|
|
|
out of view."
|
|
|
|
|
(unless (or (one-window-p 'nomini)
|
|
|
|
|
(not (pos-visible-in-window-p (point-min)))
|
|
|
|
|
(/= (frame-width) (window-width)))
|
2000-10-21 05:40:19 +00:00
|
|
|
|
(fit-window-to-buffer
|
|
|
|
|
(selected-window)
|
|
|
|
|
(if (functionp temp-buffer-max-height)
|
|
|
|
|
(funcall temp-buffer-max-height (current-buffer))
|
|
|
|
|
temp-buffer-max-height))))
|
1998-11-22 17:26:16 +00:00
|
|
|
|
|
2006-02-23 23:14:01 +00:00
|
|
|
|
|
|
|
|
|
(provide 'help)
|
|
|
|
|
|
2005-03-10 21:43:16 +00:00
|
|
|
|
;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423
|
1992-05-30 23:12:08 +00:00
|
|
|
|
;;; help.el ends here
|