1992-05-30 23:12:08 +00:00
|
|
|
|
;;; help.el --- help commands for Emacs
|
|
|
|
|
|
2005-03-10 21:43:16 +00:00
|
|
|
|
;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2004,
|
|
|
|
|
;; 2005 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
|
|
|
|
|
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
;; Boston, MA 02111-1307, 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
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(defvar help-map (make-sparse-keymap)
|
|
|
|
|
"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)
|
|
|
|
|
|
1992-08-03 22:07:34 +00:00
|
|
|
|
(define-key help-map (char-to-string help-char) 'help-for-help)
|
1995-06-29 02:50:52 +00:00
|
|
|
|
(define-key help-map [help] 'help-for-help)
|
|
|
|
|
(define-key help-map [f1] 'help-for-help)
|
2003-11-30 17:50:54 +00:00
|
|
|
|
(define-key help-map "." 'display-local-help)
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(define-key help-map "?" 'help-for-help)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "\C-c" 'describe-copying)
|
|
|
|
|
(define-key help-map "\C-d" 'describe-distribution)
|
2002-01-14 01:36:33 +00:00
|
|
|
|
(define-key help-map "\C-e" 'view-emacs-problems)
|
|
|
|
|
(define-key help-map "\C-f" 'view-emacs-FAQ)
|
|
|
|
|
(define-key help-map "\C-m" 'view-order-manuals)
|
|
|
|
|
(define-key help-map "\C-n" 'view-emacs-news)
|
1993-11-15 09:23:34 +00:00
|
|
|
|
(define-key help-map "\C-p" 'describe-project)
|
2002-05-01 16:41:52 +00:00
|
|
|
|
(define-key help-map "\C-t" 'view-todo)
|
2002-01-14 01:36:33 +00:00
|
|
|
|
(define-key help-map "\C-w" 'describe-no-warranty)
|
|
|
|
|
|
|
|
|
|
;; This does not fit the pattern, but it is natural given the C-\ command.
|
|
|
|
|
(define-key help-map "\C-\\" 'describe-input-method)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "C" 'describe-coding-system)
|
|
|
|
|
(define-key help-map "F" 'Info-goto-emacs-command-node)
|
|
|
|
|
(define-key help-map "I" 'describe-input-method)
|
|
|
|
|
(define-key help-map "K" 'Info-goto-emacs-key-command-node)
|
|
|
|
|
(define-key help-map "L" 'describe-language-environment)
|
|
|
|
|
(define-key help-map "S" 'info-lookup-symbol)
|
|
|
|
|
|
1997-03-21 07:45:24 +00:00
|
|
|
|
(define-key help-map "a" 'apropos-command)
|
1991-08-25 21:47:10 +00:00
|
|
|
|
|
|
|
|
|
(define-key help-map "b" 'describe-bindings)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "c" 'describe-key-briefly)
|
|
|
|
|
|
2002-01-14 01:36:33 +00:00
|
|
|
|
(define-key help-map "e" 'view-echo-area-messages)
|
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(define-key help-map "f" 'describe-function)
|
|
|
|
|
|
2002-01-14 01:36:33 +00:00
|
|
|
|
(define-key help-map "h" 'view-hello-file)
|
1995-03-06 05:16:14 +00:00
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(define-key help-map "i" 'info)
|
1998-06-13 05:59:46 +00:00
|
|
|
|
(define-key help-map "4i" 'info-other-window)
|
2002-01-14 01:36:33 +00:00
|
|
|
|
|
|
|
|
|
(define-key help-map "k" 'describe-key)
|
1991-08-25 21:47:10 +00:00
|
|
|
|
|
|
|
|
|
(define-key help-map "l" 'view-lossage)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "m" 'describe-mode)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "n" 'view-emacs-news)
|
|
|
|
|
|
1993-03-11 07:55:27 +00:00
|
|
|
|
(define-key help-map "p" 'finder-by-keyword)
|
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
|
|
|
|
|
2002-07-12 22:57:11 +00:00
|
|
|
|
(define-key help-map "r" 'info-emacs-manual)
|
|
|
|
|
|
1991-08-25 21:47:10 +00:00
|
|
|
|
(define-key help-map "s" 'describe-syntax)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "t" 'help-with-tutorial)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "w" 'where-is)
|
|
|
|
|
|
|
|
|
|
(define-key help-map "v" 'describe-variable)
|
|
|
|
|
|
1994-03-30 01:43:37 +00:00
|
|
|
|
(define-key help-map "q" 'help-quit)
|
|
|
|
|
|
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
|
|
|
|
|
(WINDOW . t) delete the selected window, go to WINDOW.
|
|
|
|
|
(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.
|
|
|
|
|
If FUNCTION is nil, it applies `message', thus displaying the message."
|
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
|
1996-10-06 16:27:39 +00:00
|
|
|
|
(cond ((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))
|
1994-07-16 17:58:12 +00:00
|
|
|
|
"Type \\[switch-to-buffer-other-window] RET to restore the other window.")
|
|
|
|
|
(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.
|
1996-10-06 16:27:39 +00:00
|
|
|
|
(if (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
|
2003-11-30 17:50:54 +00:00
|
|
|
|
"a b c C e f F i I k C-k l L m p 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.)
|
|
|
|
|
|
|
|
|
|
a command-apropos. Give a substring, and see a list of commands
|
2005-02-05 12:45:44 +00:00
|
|
|
|
(functions that are interactively callable) that contain
|
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
|
|
|
|
that substring. See also the apropos command.
|
|
|
|
|
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-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.
|
|
|
|
|
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)
|
|
|
|
|
|
1998-03-18 01:59:58 +00:00
|
|
|
|
(defun view-emacs-news (&optional arg)
|
|
|
|
|
"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")
|
2004-04-27 06:35:25 +00:00
|
|
|
|
(if (not arg)
|
|
|
|
|
(view-file (expand-file-name "NEWS" data-directory))
|
|
|
|
|
(let* ((map (sort
|
|
|
|
|
(delete-dups
|
|
|
|
|
(apply
|
|
|
|
|
'nconc
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents
|
|
|
|
|
(expand-file-name file data-directory))
|
|
|
|
|
(let (res)
|
|
|
|
|
(while (re-search-forward
|
|
|
|
|
(if (string-match "^ONEWS\\.[0-9]+$" file)
|
|
|
|
|
"Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)"
|
|
|
|
|
"^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)
|
|
|
|
|
(setq res (cons (list (match-string-no-properties 1)
|
|
|
|
|
file) res)))
|
|
|
|
|
res)))
|
|
|
|
|
(append '("NEWS" "ONEWS")
|
|
|
|
|
(directory-files data-directory nil
|
|
|
|
|
"^ONEWS\\.[0-9]+$" nil)))))
|
|
|
|
|
(lambda (a b)
|
|
|
|
|
(string< (car b) (car a)))))
|
|
|
|
|
(current (caar map))
|
|
|
|
|
(version (completing-read
|
|
|
|
|
(format "Read NEWS for the version (default %s): " current)
|
|
|
|
|
(mapcar 'car map) nil nil nil nil current))
|
|
|
|
|
(file (cadr (assoc version map)))
|
|
|
|
|
res)
|
|
|
|
|
(if (not file)
|
|
|
|
|
(error "No news is good news")
|
|
|
|
|
(view-file (expand-file-name file data-directory))
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (re-search-forward
|
|
|
|
|
(concat (if (string-match "^ONEWS\\.[0-9]+$" file)
|
|
|
|
|
"Changes in \\(?:Emacs\\|version\\)?[ \t]*"
|
|
|
|
|
"^\* [^0-9\n]*") version)
|
|
|
|
|
nil t)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(narrow-to-region
|
|
|
|
|
(point)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(while (and (setq res
|
|
|
|
|
(re-search-forward
|
|
|
|
|
(if (string-match "^ONEWS\\.[0-9]+$" file)
|
|
|
|
|
"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)))
|
|
|
|
|
(search-forward " " nil t)
|
2001-10-11 23:34:17 +00:00
|
|
|
|
(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"
|
|
|
|
|
definition symbol keys)
|
|
|
|
|
(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
|
|
|
|
|
2002-04-02 03:23:26 +00:00
|
|
|
|
(defun describe-key-briefly (key &optional insert 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
|
|
|
|
"Print the name of the function KEY invokes. KEY is a string.
|
2002-04-02 03:23:26 +00:00
|
|
|
|
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."
|
|
|
|
|
(interactive "kDescribe key briefly: \nP\np")
|
|
|
|
|
(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)
|
|
|
|
|
(key-binding key)))
|
2005-04-10 01:47:43 +00:00
|
|
|
|
key-desc)
|
|
|
|
|
;; 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
|
|
|
|
|
2004-10-26 12:59:44 +00:00
|
|
|
|
(defun describe-key (key &optional untranslated up-event)
|
2001-12-28 02:11:59 +00:00
|
|
|
|
"Display documentation of the function invoked by KEY.
|
|
|
|
|
KEY should be a key sequence--when calling from a program,
|
2002-04-02 03:23:26 +00:00
|
|
|
|
pass a string or a vector.
|
|
|
|
|
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."
|
2004-10-26 12:59:44 +00:00
|
|
|
|
(interactive "kDescribe key: \np\nU")
|
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))
|
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 ((defn (or (string-key-binding key) (key-binding key))))
|
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)"))
|
|
|
|
|
(if (stringp (aref untranslated (1- (length untranslated))))
|
|
|
|
|
(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
|
2004-12-17 15:16:46 +00:00
|
|
|
|
(let ((ev (aref up-event 0))
|
|
|
|
|
(descr (key-description up-event))
|
|
|
|
|
(hdr "\n\n-------------- up event ---------------\n\n")
|
|
|
|
|
defn
|
|
|
|
|
mouse-1-tricky mouse-1-remapped)
|
|
|
|
|
(when (and (consp ev)
|
|
|
|
|
(eq (car ev) 'mouse-1)
|
|
|
|
|
(windowp window)
|
|
|
|
|
mouse-1-click-follows-link
|
|
|
|
|
(not (eq mouse-1-click-follows-link 'double))
|
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
|
(mouse-on-link-p (posn-point (event-start ev)))))
|
|
|
|
|
(setq mouse-1-tricky (integerp mouse-1-click-follows-link)
|
|
|
|
|
mouse-1-remapped (or (not mouse-1-tricky)
|
|
|
|
|
(> mouse-1-click-follows-link 0)))
|
|
|
|
|
(if mouse-1-remapped
|
|
|
|
|
(setcar ev 'mouse-2)))
|
|
|
|
|
(setq defn (or (string-key-binding up-event) (key-binding up-event)))
|
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)
|
|
|
|
|
(princ descr)
|
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
|
|
|
|
|
(setcar ev
|
|
|
|
|
(if (> mouse-1-click-follows-link 0) 'mouse-1 'mouse-2))
|
|
|
|
|
(setq defn (or (string-key-binding up-event) (key-binding up-event)))
|
|
|
|
|
(unless (or (null defn) (integerp defn) (equal defn 'undefined))
|
|
|
|
|
(princ (or hdr
|
|
|
|
|
"\n\n----------------- up-event (long click) ----------------\n\n"))
|
|
|
|
|
(princ "Pressing ")
|
|
|
|
|
(princ descr)
|
|
|
|
|
(if (windowp window)
|
|
|
|
|
(princ " at that spot"))
|
|
|
|
|
(princ (format " for longer than %d milli-seconds\n"
|
|
|
|
|
(abs mouse-1-click-follows-link)))
|
|
|
|
|
(if (not mouse-1-remapped)
|
|
|
|
|
(princ " remaps it to <mouse-2> which" ))
|
|
|
|
|
(princ " runs the command ")
|
|
|
|
|
(prin1 defn)
|
|
|
|
|
(princ "\n which is ")
|
|
|
|
|
(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
|
|
|
|
|
(insert mode)
|
|
|
|
|
(add-text-properties (- (point) (length mode)) (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))
|
1998-11-22 17:26:16 +00:00
|
|
|
|
"*Maximum height of a window displaying a temporary buffer.
|
|
|
|
|
This is the maximum height (in text lines) which `resize-temp-buffer-window'
|
|
|
|
|
will give to a window displaying a temporary buffer.
|
|
|
|
|
It can also be a function which will be called with the object corresponding
|
|
|
|
|
to the buffer to be displayed as argument and should return an integer
|
|
|
|
|
positive number."
|
|
|
|
|
: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
|
|
|
|
|
2000-10-16 15:56:32 +00:00
|
|
|
|
;; Provide this for the sake of define-minor-mode which generates
|
|
|
|
|
;; defcustoms which require 'help'.
|
|
|
|
|
(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
|