Mercurial > emacs
annotate lisp/help-funs.el @ 39863:345caf35c534
(skip_invisible): Don't skip "ellipsisized" text.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 12 Oct 2001 22:31:23 +0000 |
parents | 2f5725430b4f |
children | 6748fb350a05 |
rev | line source |
---|---|
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
1 ;;; help-funs.el --- Complex help functions |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
2 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 ;; Keywords: help, internal |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
14 ;; any later version. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;; Boston, MA 02111-1307, USA. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 ;;; Commentary: |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 ;; This file contains those help commands which are complicated, and |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 ;; which may not be used in every session. For example |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 ;; `describe-function' will probably be heavily used when doing elisp |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 ;; programming, but not if just editing C files. Simpler help commands |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 ;; are in help.el |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 ;;; Code: |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
35 |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
36 (require 'help-mode) |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
37 |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
38 |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
39 ;;;###autoload |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
40 (defun help-with-tutorial (&optional arg) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 "Select the Emacs learn-by-doing tutorial. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
42 If there is a tutorial version written in the language |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
43 of the selected language environment, that version is used. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
44 If there's no tutorial in that language, `TUTORIAL' is selected. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
45 With arg, you are asked to choose which language." |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
46 (interactive "P") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
47 (let ((lang (if arg |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
48 (read-language-name 'tutorial "Language: " "English") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
49 (if (get-language-info current-language-environment 'tutorial) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
50 current-language-environment |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
51 "English"))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
52 file filename) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
53 (setq filename (get-language-info lang 'tutorial)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
54 (setq file (expand-file-name (concat "~/" filename))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
55 (delete-other-windows) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
56 (if (get-file-buffer file) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
57 (switch-to-buffer (get-file-buffer file)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
58 (switch-to-buffer (create-file-buffer file)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
59 (setq buffer-file-name file) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
60 (setq default-directory (expand-file-name "~/")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
61 (setq buffer-auto-save-file-name nil) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
62 (insert-file-contents (expand-file-name filename data-directory)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
63 (goto-char (point-min)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
64 (search-forward "\n<<") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
65 (beginning-of-line) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
66 (delete-region (point) (progn (end-of-line) (point))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
67 (let ((n (- (window-height (selected-window)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
68 (count-lines (point-min) (point)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
69 6))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
70 (if (< n 12) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
71 (newline n) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
72 ;; Some people get confused by the large gap. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
73 (newline (/ n 2)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
74 (insert "[Middle of page left blank for didactic purposes. " |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
75 "Text continues below]") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
76 (newline (- n (/ n 2))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
77 (goto-char (point-min)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
78 (set-buffer-modified-p nil)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
79 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
80 ;;;###autoload |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
81 (defun locate-library (library &optional nosuffix path interactive-call) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
82 "Show the precise file name of Emacs library LIBRARY. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
83 This command searches the directories in `load-path' like `M-x load-library' |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
84 to find the file that `M-x load-library RET LIBRARY RET' would load. |
39847
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
85 Optional second arg NOSUFFIX non-nil means don't add suffixes `load-suffixes' |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
86 to the specified name LIBRARY. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
87 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
88 If the optional third arg PATH is specified, that list of directories |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
89 is used instead of `load-path'. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
90 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
91 When called from a program, the file name is normaly returned as a |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
92 string. When run interactively, the argument INTERACTIVE-CALL is t, |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
93 and the file name is displayed in the echo area." |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
94 (interactive (list (read-string "Locate library: ") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
95 nil nil |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
96 t)) |
39847
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
97 (catch 'answer |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
98 (dolist (dir (or path load-path)) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
99 (dolist (suf (append (unless nosuffix load-suffixes) '(""))) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
100 (let ((try (expand-file-name (concat library suf) dir))) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
101 (and (file-readable-p try) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
102 (null (file-directory-p try)) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
103 (progn |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
104 (if interactive-call |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
105 (message "Library is file %s" (abbreviate-file-name try))) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
106 (throw 'answer try)))))) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
107 (if interactive-call |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
108 (message "No library %s in search path" library)) |
2f5725430b4f
(locate-library): Use load-suffixes and abbrev filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39788
diff
changeset
|
109 nil)) |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
110 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
111 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
112 ;; Functions |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
113 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
114 ;;;###autoload |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
115 (defun describe-function (function) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
116 "Display the full documentation of FUNCTION (a symbol)." |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
117 (interactive |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
118 (let ((fn (function-called-at-point)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
119 (enable-recursive-minibuffers t) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
120 val) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
121 (setq val (completing-read (if fn |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
122 (format "Describe function (default %s): " fn) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
123 "Describe function: ") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
124 obarray 'fboundp t nil nil (symbol-name fn))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
125 (list (if (equal val "") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
126 fn (intern val))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
127 (if (null function) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
128 (message "You didn't specify a function") |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
129 (help-setup-xref (list #'describe-function function) (interactive-p)) |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
130 (with-output-to-temp-buffer (help-buffer) |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
131 (prin1 function) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
132 ;; Use " is " instead of a colon so that |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
133 ;; it is easier to get out the function name using forward-sexp. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
134 (princ " is ") |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
135 (describe-function-1 function) |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
136 (print-help-return-message) |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
137 (with-current-buffer standard-output |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
138 ;; Return the text we displayed. |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
139 (buffer-string))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
140 |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
141 ;;;###autoload |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
142 (defun describe-function-1 (function) |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
143 (let* ((def (if (symbolp function) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
144 (symbol-function function) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
145 function)) |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
146 file-name string |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
147 (beg (if (commandp def) "an interactive " "a "))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
148 (setq string |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
149 (cond ((or (stringp def) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
150 (vectorp def)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
151 "a keyboard macro") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
152 ((subrp def) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
153 (if (eq 'unevalled (cdr (subr-arity def))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
154 (concat beg "special form") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
155 (concat beg "built-in function"))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
156 ((byte-code-function-p def) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
157 (concat beg "compiled Lisp function")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
158 ((symbolp def) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
159 (while (symbolp (symbol-function def)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
160 (setq def (symbol-function def))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
161 (format "an alias for `%s'" def)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
162 ((eq (car-safe def) 'lambda) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
163 (concat beg "Lisp function")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
164 ((eq (car-safe def) 'macro) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
165 "a Lisp macro") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
166 ((eq (car-safe def) 'mocklisp) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
167 "a mocklisp function") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
168 ((eq (car-safe def) 'autoload) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
169 (setq file-name (nth 1 def)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
170 (format "%s autoloaded %s" |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
171 (if (commandp def) "an interactive" "an") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
172 (if (eq (nth 4 def) 'keymap) "keymap" |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
173 (if (nth 4 def) "Lisp macro" "Lisp function")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
174 )) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
175 ;; perhaps use keymapp here instead |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
176 ((eq (car-safe def) 'keymap) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
177 (let ((is-full nil) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
178 (elts (cdr-safe def))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
179 (while elts |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
180 (if (char-table-p (car-safe elts)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
181 (setq is-full t |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
182 elts nil)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
183 (setq elts (cdr-safe elts))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
184 (if is-full |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
185 "a full keymap" |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
186 "a sparse keymap"))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
187 (t ""))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
188 (princ string) |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
189 (with-current-buffer standard-output |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
190 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
191 (save-match-data |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
192 (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
193 (help-xref-button 1 'help-function def))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
194 (or file-name |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
195 (setq file-name (symbol-file function))) |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
196 (cond |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
197 (file-name |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
198 (princ " in `") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
199 ;; We used to add .el to the file name, |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
200 ;; but that's completely wrong when the user used load-file. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
201 (princ file-name) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
202 (princ "'") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
203 ;; Make a hyperlink to the library. |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
204 (with-current-buffer standard-output |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
205 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
206 (re-search-backward "`\\([^`']+\\)'" nil t) |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
207 (help-xref-button 1 'help-function-def function file-name))))) |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
208 (princ ".") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
209 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
210 (when (commandp function) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
211 (let ((keys (where-is-internal |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
212 function overriding-local-map nil nil))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
213 (when keys |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
214 (princ "It is bound to ") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
215 ;; FIXME: This list can be very long (f.ex. for self-insert-command). |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
216 (princ (mapconcat 'key-description keys ", ")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
217 (princ ".") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
218 (terpri)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
219 ;; Handle symbols aliased to other symbols. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
220 (setq def (indirect-function def)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
221 ;; If definition is a macro, find the function inside it. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
222 (if (eq (car-safe def) 'macro) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
223 (setq def (cdr def))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
224 (let ((arglist (cond ((byte-code-function-p def) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
225 (car (append def nil))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
226 ((eq (car-safe def) 'lambda) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
227 (nth 1 def)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
228 ((and (eq (car-safe def) 'autoload) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
229 (not (eq (nth 4 def) 'keymap))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
230 (concat "[Arg list not available until " |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
231 "function definition is loaded.]")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
232 (t t)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
233 (cond ((listp arglist) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
234 (princ (cons (if (symbolp function) function "anonymous") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
235 (mapcar (lambda (arg) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
236 (if (memq arg '(&optional &rest)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
237 arg |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
238 (intern (upcase (symbol-name arg))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
239 arglist))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
240 (terpri)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
241 ((stringp arglist) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
242 (princ arglist) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
243 (terpri)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
244 (let ((doc (documentation function))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
245 (if doc |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
246 (progn (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
247 (princ doc) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
248 (if (subrp def) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
249 (with-current-buffer standard-output |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
250 (beginning-of-line) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
251 ;; Builtins get the calling sequence at the end of |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
252 ;; the doc string. Move it to the same place as |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
253 ;; for other functions. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
254 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
255 ;; In cases where `function' has been fset to a |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
256 ;; subr we can't search for function's name in |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
257 ;; the doc string. Kluge round that using the |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
258 ;; printed representation. The arg list then |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
259 ;; shows the wrong function name, but that |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
260 ;; might be a useful hint. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
261 (let* ((rep (prin1-to-string def)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
262 (name (progn |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
263 (string-match " \\([^ ]+\\)>$" rep) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
264 (match-string 1 rep)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
265 (if (looking-at (format "(%s[ )]" (regexp-quote name))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
266 (let ((start (point-marker))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
267 (goto-char (point-min)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
268 (forward-paragraph) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
269 (insert-buffer-substring (current-buffer) start) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
270 (insert ?\n) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
271 (delete-region (1- start) (point-max))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
272 (goto-char (point-min)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
273 (forward-paragraph) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
274 (insert |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
275 "[Missing arglist. Please make a bug report.]\n"))) |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
276 (goto-char (point-max))))) |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
277 (princ "not documented"))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
278 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
279 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
280 ;; Variables |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
281 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
282 ;;;###autoload |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
283 (defun variable-at-point () |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
284 "Return the bound variable symbol found around point. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
285 Return 0 if there is no such symbol." |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
286 (condition-case () |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
287 (with-syntax-table emacs-lisp-mode-syntax-table |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
288 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
289 (or (not (zerop (skip-syntax-backward "_w"))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
290 (eq (char-syntax (following-char)) ?w) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
291 (eq (char-syntax (following-char)) ?_) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
292 (forward-sexp -1)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
293 (skip-chars-forward "'") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
294 (let ((obj (read (current-buffer)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
295 (or (and (symbolp obj) (boundp obj) obj) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
296 0)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
297 (error 0))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
298 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
299 ;;;###autoload |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
300 (defun describe-variable (variable &optional buffer) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
301 "Display the full documentation of VARIABLE (a symbol). |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
302 Returns the documentation as a string, also. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
303 If VARIABLE has a buffer-local value in BUFFER (default to the current buffer), |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
304 it is displayed along with the global value." |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
305 (interactive |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
306 (let ((v (variable-at-point)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
307 (enable-recursive-minibuffers t) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
308 val) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
309 (setq val (completing-read (if (symbolp v) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
310 (format |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
311 "Describe variable (default %s): " v) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
312 "Describe variable: ") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
313 obarray 'boundp t nil nil |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
314 (if (symbolp v) (symbol-name v)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
315 (list (if (equal val "") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
316 v (intern val))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
317 (unless (bufferp buffer) (setq buffer (current-buffer))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
318 (if (not (symbolp variable)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
319 (message "You did not specify a variable") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
320 (let (valvoid) |
39788
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
321 (help-setup-xref (list #'describe-variable variable buffer) |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
322 (interactive-p)) |
67f0a4191315
(describe-function-1): Remove unused `parens' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39726
diff
changeset
|
323 (with-output-to-temp-buffer (help-buffer) |
39726
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
324 (with-current-buffer buffer |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
325 (prin1 variable) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
326 (if (not (boundp variable)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
327 (progn |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
328 (princ " is void") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
329 (setq valvoid t)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
330 (let ((val (symbol-value variable))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
331 (with-current-buffer standard-output |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
332 (princ "'s value is ") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
333 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
334 (let ((from (point))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
335 (pp val) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
336 (help-xref-on-pp from (point)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
337 (if (< (point) (+ from 20)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
338 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
339 (goto-char from) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
340 (delete-char -1))))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
341 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
342 (when (local-variable-p variable) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
343 (princ (format "Local in buffer %s; " (buffer-name))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
344 (if (not (default-boundp variable)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
345 (princ "globally void") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
346 (let ((val (default-value variable))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
347 (with-current-buffer standard-output |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
348 (princ "global value is ") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
349 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
350 ;; Fixme: pp can take an age if you happen to |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
351 ;; ask for a very large expression. We should |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
352 ;; probably print it raw once and check it's a |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
353 ;; sensible size before prettyprinting. -- fx |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
354 (let ((from (point))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
355 (pp val) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
356 (help-xref-on-pp from (point)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
357 (if (< (point) (+ from 20)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
358 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
359 (goto-char from) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
360 (delete-char -1))))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
361 (terpri)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
362 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
363 (with-current-buffer standard-output |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
364 (when (> (count-lines (point-min) (point-max)) 10) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
365 ;; Note that setting the syntax table like below |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
366 ;; makes forward-sexp move over a `'s' at the end |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
367 ;; of a symbol. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
368 (set-syntax-table emacs-lisp-mode-syntax-table) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
369 (goto-char (point-min)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
370 (if valvoid |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
371 (forward-line 1) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
372 (forward-sexp 1) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
373 (delete-region (point) (progn (end-of-line) (point))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
374 (insert " value is shown below.\n\n") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
375 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
376 (insert "\n\nValue:")))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
377 ;; Add a note for variables that have been make-var-buffer-local. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
378 (when (and (local-variable-if-set-p variable) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
379 (or (not (local-variable-p variable)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
380 (with-temp-buffer |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
381 (local-variable-if-set-p variable)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
382 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
383 (forward-line -1) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
384 (insert "Automatically becomes buffer-local when set in any fashion.\n")))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
385 (princ "Documentation:") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
386 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
387 (let ((doc (documentation-property variable 'variable-documentation))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
388 (princ (or doc "not documented as a variable."))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
389 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
390 ;; Make a link to customize if this variable can be customized. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
391 ;; Note, it is not reliable to test only for a custom-type property |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
392 ;; because those are only present after the var's definition |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
393 ;; has been loaded. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
394 (if (or (get variable 'custom-type) ; after defcustom |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
395 (get variable 'custom-loads) ; from loaddefs.el |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
396 (get variable 'standard-value)) ; from cus-start.el |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
397 (let ((customize-label "customize")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
398 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
399 (terpri) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
400 (princ (concat "You can " customize-label " this variable.")) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
401 (with-current-buffer standard-output |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
402 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
403 (re-search-backward |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
404 (concat "\\(" customize-label "\\)") nil t) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
405 (help-xref-button 1 'help-customize-variable variable))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
406 ;; Make a hyperlink to the library if appropriate. (Don't |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
407 ;; change the format of the buffer's initial line in case |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
408 ;; anything expects the current format.) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
409 (let ((file-name (symbol-file variable))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
410 (when (equal file-name "loaddefs.el") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
411 ;; Find the real def site of the preloaded variable. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
412 (let ((location |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
413 (condition-case nil |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
414 (find-variable-noselect variable file-name) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
415 (error nil)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
416 (when location |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
417 (with-current-buffer (car location) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
418 (goto-char (cdr location)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
419 (when (re-search-backward |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
420 "^;;; Generated autoloads from \\(.*\\)" nil t) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
421 (setq file-name (match-string 1))))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
422 (when file-name |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
423 (princ "\n\nDefined in `") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
424 (princ file-name) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
425 (princ "'.") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
426 (with-current-buffer standard-output |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
427 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
428 (re-search-backward "`\\([^`']+\\)'" nil t) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
429 (help-xref-button 1 'help-variable-def |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
430 variable file-name))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
431 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
432 (print-help-return-message) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
433 (save-excursion |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
434 (set-buffer standard-output) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
435 ;; Return the text we displayed. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
436 (buffer-string))))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
437 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
438 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
439 ;; `help-manyarg-func-alist' is defined primitively (in doc.c). |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
440 ;; New primitives with `MANY' or `UNEVALLED' arglists should be added |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
441 ;; to this alist. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
442 ;; The parens and function name are redundant, but it's messy to add |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
443 ;; them in `documentation'. |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
444 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
445 ;; This will find any missing items: |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
446 ;; (let (l) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
447 ;; (mapatoms (lambda (x) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
448 ;; (if (and (fboundp x) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
449 ;; (subrp (symbol-function x)) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
450 ;; (not (numberp (cdr (subr-arity (symbol-function x))))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
451 ;; (not (assq x help-manyarg-func-alist))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
452 ;; (push x l)))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
453 ;; l) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
454 (defconst help-manyarg-func-alist |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
455 (purecopy |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
456 '((list . "(list &rest OBJECTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
457 (vector . "(vector &rest OBJECTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
458 (make-byte-code . "(make-byte-code &rest ELEMENTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
459 (call-process |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
460 . "(call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
461 (call-process-region |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
462 . "(call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
463 (string . "(string &rest CHARACTERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
464 (+ . "(+ &rest NUMBERS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
465 (- . "(- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
466 (* . "(* &rest NUMBERS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
467 (/ . "(/ DIVIDEND DIVISOR &rest DIVISORS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
468 (max . "(max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
469 (min . "(min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
470 (logand . "(logand &rest INTS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
471 (logior . "(logior &rest INTS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
472 (logxor . "(logxor &rest INTS-OR-MARKERS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
473 (encode-time |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
474 . "(encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
475 (insert . "(insert &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
476 (insert-and-inherit . "(insert-and-inherit &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
477 (insert-before-markers . "(insert-before-markers &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
478 (message . "(message STRING &rest ARGUMENTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
479 (message-box . "(message-box STRING &rest ARGUMENTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
480 (message-or-box . "(message-or-box STRING &rest ARGUMENTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
481 (propertize . "(propertize STRING &rest PROPERTIES)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
482 (format . "(format STRING &rest OBJECTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
483 (apply . "(apply FUNCTION &rest ARGUMENTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
484 (run-hooks . "(run-hooks &rest HOOKS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
485 (run-hook-with-args . "(run-hook-with-args HOOK &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
486 (run-hook-with-args-until-failure |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
487 . "(run-hook-with-args-until-failure HOOK &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
488 (run-hook-with-args-until-success |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
489 . "(run-hook-with-args-until-success HOOK &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
490 (funcall . "(funcall FUNCTION &rest ARGUMENTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
491 (append . "(append &rest SEQUENCES)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
492 (concat . "(concat &rest SEQUENCES)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
493 (vconcat . "(vconcat &rest SEQUENCES)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
494 (nconc . "(nconc &rest LISTS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
495 (widget-apply . "(widget-apply WIDGET PROPERTY &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
496 (make-hash-table . "(make-hash-table &rest KEYWORD-ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
497 (insert-string . "(insert-string &rest ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
498 (start-process . "(start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
499 (setq-default . "(setq-default SYMBOL VALUE [SYMBOL VALUE...])") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
500 (save-excursion . "(save-excursion &rest BODY)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
501 (save-current-buffer . "(save-current-buffer &rest BODY)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
502 (save-restriction . "(save-restriction &rest BODY)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
503 (or . "(or CONDITIONS ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
504 (and . "(and CONDITIONS ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
505 (if . "(if COND THEN ELSE...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
506 (cond . "(cond CLAUSES...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
507 (progn . "(progn BODY ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
508 (prog1 . "(prog1 FIRST BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
509 (prog2 . "(prog2 X Y BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
510 (setq . "(setq SYM VAL SYM VAL ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
511 (quote . "(quote ARG)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
512 (function . "(function ARG)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
513 (defun . "(defun NAME ARGLIST [DOCSTRING] BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
514 (defmacro . "(defmacro NAME ARGLIST [DOCSTRING] BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
515 (defvar . "(defvar SYMBOL [INITVALUE DOCSTRING])") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
516 (defconst . "(defconst SYMBOL INITVALUE [DOCSTRING])") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
517 (let* . "(let* VARLIST BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
518 (let . "(let VARLIST BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
519 (while . "(while TEST BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
520 (catch . "(catch TAG BODY...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
521 (unwind-protect . "(unwind-protect BODYFORM UNWINDFORMS...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
522 (condition-case . "(condition-case VAR BODYFORM HANDLERS...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
523 (track-mouse . "(track-mouse BODY ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
524 (ml-if . "(ml-if COND THEN ELSE...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
525 (ml-provide-prefix-argument . "(ml-provide-prefix-argument ARG1 ARG2)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
526 (ml-prefix-argument-loop . "(ml-prefix-argument-loop ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
527 (with-output-to-temp-buffer |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
528 . "(with-output-to-temp-buffer BUFFNAME BODY ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
529 (save-window-excursion . "(save-window-excursion BODY ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
530 (find-operation-coding-system |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
531 . "(find-operation-coding-system OPERATION ARGUMENTS ...)") |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
532 (insert-before-markers-and-inherit |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
533 . "(insert-before-markers-and-inherit &rest ARGS)")))) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
534 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
535 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
536 (provide 'help-funs) |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
537 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
538 ;;; help-funs.el ends here |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
539 |
19d78cd38271
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
540 |