]> code.delx.au - gnu-emacs/blob - lisp/apropos.el
(apropos-print): The cross ref for a variable
[gnu-emacs] / lisp / apropos.el
1 ;;; apropos.el --- apropos commands for users and programmers.
2
3 ;; Copyright (C) 1989, 1994, 1995 Free Software Foundation, Inc.
4
5 ;; Author: Joe Wells <jbw@bigbird.bu.edu>
6 ;; Rewritten: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389
7 ;; Keywords: help
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;; The ideas for this package were derived from the C code in
29 ;; src/keymap.c and elsewhere. The functions in this file should
30 ;; always be byte-compiled for speed. Someone should rewrite this in
31 ;; C (as part of src/keymap.c) for speed.
32
33 ;; The idea for super-apropos is based on the original implementation
34 ;; by Lynn Slater <lrs@esl.com>.
35
36 ;; History:
37 ;; Fixed bug, current-local-map can return nil.
38 ;; Change, doesn't calculate key-bindings unless needed.
39 ;; Added super-apropos capability, changed print functions.
40 ;;; Made fast-apropos and super-apropos share code.
41 ;;; Sped up fast-apropos again.
42 ;; Added apropos-do-all option.
43 ;;; Added fast-command-apropos.
44 ;; Changed doc strings to comments for helping functions.
45 ;;; Made doc file buffer read-only, buried it.
46 ;; Only call substitute-command-keys if do-all set.
47
48 ;; Optionally use configurable faces to make the output more legible.
49 ;; Differentiate between command, function and macro.
50 ;; Apropos-command (ex command-apropos) does cmd and optionally user var.
51 ;; Apropos shows all 3 aspects of symbols (fn, var and plist)
52 ;; Apropos-documentation (ex super-apropos) now finds all it should.
53 ;; New apropos-value snoops through all values and optionally plists.
54 ;; Reading DOC file doesn't load nroff.
55 ;; Added hypertext following of documentation, mouse-2 on variable gives value
56 ;; from buffer in active window.
57
58 ;;; Code:
59
60 (defgroup apropos nil
61 "Apropos commands for users and programmers"
62 :group 'Help
63 :prefix "apropos")
64
65 ;; I see a degradation of maybe 10-20% only.
66 (defcustom apropos-do-all nil
67 "*Whether the apropos commands should do more.
68
69 Slows them down more or less. Set this non-nil if you have a fast machine."
70 :group 'apropos
71 :type 'boolean)
72
73
74 (defcustom apropos-symbol-face (if window-system 'bold)
75 "*Face for symbol name in apropos output or `nil'.
76 This looks good, but slows down the commands several times."
77 :group 'apropos
78 :type 'face)
79
80 (defcustom apropos-keybinding-face (if window-system 'underline)
81 "*Face for keybinding display in apropos output or `nil'.
82 This looks good, but slows down the commands several times."
83 :group 'apropos
84 :type 'face)
85
86 (defcustom apropos-label-face (if window-system 'italic)
87 "*Face for label (Command, Variable ...) in apropos output or `nil'.
88 If this is `nil' no mouse highlighting occurs.
89 This looks good, but slows down the commands several times.
90 When this is a face name, as it is initially, it gets transformed to a
91 text-property list for efficiency."
92 :group 'apropos
93 :type 'face)
94
95 (defcustom apropos-property-face (if window-system 'bold-italic)
96 "*Face for property name in apropos output or `nil'.
97 This looks good, but slows down the commands several times."
98 :group 'apropos
99 :type 'face)
100
101 (defcustom apropos-match-face (if window-system 'secondary-selection)
102 "*Face for matching part in apropos-documentation/value output or `nil'.
103 This looks good, but slows down the commands several times."
104 :group 'apropos
105 :type 'face)
106
107
108 (defvar apropos-mode-map
109 (let ((map (make-sparse-keymap)))
110 (define-key map "\C-m" 'apropos-follow)
111 (define-key map " " 'scroll-up)
112 (define-key map "\177" 'scroll-down)
113 (define-key map "q" 'quit-window)
114 (define-key map [mouse-2] 'apropos-mouse-follow)
115 (define-key map [down-mouse-2] nil)
116 map)
117 "Keymap used in Apropos mode.")
118
119
120 (defvar apropos-regexp nil
121 "Regexp used in current apropos run.")
122
123 (defvar apropos-files-scanned ()
124 "List of elc files already scanned in current run of `apropos-documentation'.")
125
126 (defvar apropos-accumulator ()
127 "Alist of symbols already found in current apropos run.")
128
129 (defvar apropos-item ()
130 "Current item in or for apropos-accumulator.")
131 \f
132 (defun apropos-mode ()
133 "Major mode for following hyperlinks in output of apropos commands.
134
135 \\{apropos-mode-map}"
136 (interactive)
137 (kill-all-local-variables)
138 (use-local-map apropos-mode-map)
139 (setq major-mode 'apropos-mode
140 mode-name "Apropos"))
141
142 ;;;###autoload
143 (defun apropos-variable (regexp &optional do-all)
144 "Show user variables that match REGEXP.
145 With optional prefix ARG or if `apropos-do-all' is non-nil, also show
146 normal variables."
147 (interactive (list (read-string
148 (concat "Apropos "
149 (if (or current-prefix-arg apropos-do-all)
150 "variable"
151 "user option")
152 " (regexp): "))
153 current-prefix-arg))
154 (apropos-command regexp nil
155 (if (or do-all apropos-do-all)
156 #'(lambda (symbol)
157 (and (boundp symbol)
158 (get symbol 'variable-documentation)))
159 'user-variable-p)))
160
161 ;; For auld lang syne:
162 ;;;###autoload
163 (fset 'command-apropos 'apropos-command)
164 ;;;###autoload
165 (defun apropos-command (apropos-regexp &optional do-all var-predicate)
166 "Show commands (interactively callable functions) that match REGEXP.
167 With optional prefix ARG, or if `apropos-do-all' is non-nil, also show
168 noninteractive functions.
169
170 If VAR-PREDICATE is non-nil, show only variables, and only those that
171 satisfy the predicate VAR-PREDICATE."
172 (interactive (list (read-string (concat
173 "Apropos command "
174 (if (or current-prefix-arg
175 apropos-do-all)
176 "or function ")
177 "(regexp): "))
178 current-prefix-arg))
179 (let ((message
180 (let ((standard-output (get-buffer-create "*Apropos*")))
181 (print-help-return-message 'identity))))
182 (or do-all (setq do-all apropos-do-all))
183 (setq apropos-accumulator
184 (apropos-internal apropos-regexp
185 (or var-predicate
186 (if do-all 'functionp 'commandp))))
187 (let ((tem apropos-accumulator))
188 (while tem
189 (if (get (car tem) 'apropos-inhibit)
190 (setq apropos-accumulator (delq (car tem) apropos-accumulator)))
191 (setq tem (cdr tem))))
192 (if (apropos-print
193 t
194 (lambda (p)
195 (let (doc symbol)
196 (while p
197 (setcar p (list
198 (setq symbol (car p))
199 (unless var-predicate
200 (if (functionp symbol)
201 (if (setq doc (documentation symbol t))
202 (substring doc 0 (string-match "\n" doc))
203 "(not documented)")))
204 (and var-predicate
205 (funcall var-predicate symbol)
206 (if (setq doc (documentation-property
207 symbol 'variable-documentation t))
208 (substring doc 0
209 (string-match "\n" doc))))))
210 (setq p (cdr p)))))
211 nil)
212 (and message (message message)))))
213
214
215 ;;;###autoload
216 (defun apropos (apropos-regexp &optional do-all)
217 "Show all bound symbols whose names match REGEXP.
218 With optional prefix ARG or if `apropos-do-all' is non-nil, also show unbound
219 symbols and key bindings, which is a little more time-consuming.
220 Returns list of symbols and documentation found."
221 (interactive "sApropos symbol (regexp): \nP")
222 (setq apropos-accumulator
223 (apropos-internal apropos-regexp
224 (and (not do-all)
225 (not apropos-do-all)
226 (lambda (symbol)
227 (or (fboundp symbol)
228 (boundp symbol)
229 (facep symbol)
230 (symbol-plist symbol))))))
231 (let ((tem apropos-accumulator))
232 (while tem
233 (if (get (car tem) 'apropos-inhibit)
234 (setq apropos-accumulator (delq (car tem) apropos-accumulator)))
235 (setq tem (cdr tem))))
236 (apropos-print
237 (or do-all apropos-do-all)
238 (lambda (p)
239 (let (symbol doc properties)
240 (while p
241 (setcar p (list
242 (setq symbol (car p))
243 (when (fboundp symbol)
244 (if (setq doc (condition-case nil
245 (documentation symbol t)
246 (void-function
247 "(alias for undefined function)")))
248 (substring doc 0 (string-match "\n" doc))
249 "(not documented)"))
250 (when (boundp symbol)
251 (if (setq doc (documentation-property
252 symbol 'variable-documentation t))
253 (substring doc 0 (string-match "\n" doc))
254 "(not documented)"))
255 (when (setq properties (symbol-plist symbol))
256 (setq doc (list (car properties)))
257 (while (setq properties (cdr (cdr properties)))
258 (setq doc (cons (car properties) doc)))
259 (mapconcat #'symbol-name (nreverse doc) " "))
260 (when (get symbol 'widget-type)
261 (if (setq doc (documentation-property
262 symbol 'widget-documentation t))
263 (substring doc 0
264 (string-match "\n" doc))
265 "(not documented)"))
266 (when (facep symbol)
267 (if (setq doc (documentation-property
268 symbol 'face-documentation t))
269 (substring doc 0
270 (string-match "\n" doc))
271 "(not documented)"))
272 (when (get symbol 'custom-group)
273 (if (setq doc (documentation-property
274 symbol 'group-documentation t))
275 (substring doc 0
276 (string-match "\n" doc))
277 "(not documented)"))))
278 (setq p (cdr p)))))
279 nil))
280
281
282 ;;;###autoload
283 (defun apropos-value (apropos-regexp &optional do-all)
284 "Show all symbols whose value's printed image matches REGEXP.
285 With optional prefix ARG or if `apropos-do-all' is non-nil, also looks
286 at the function and at the names and values of properties.
287 Returns list of symbols and values found."
288 (interactive "sApropos value (regexp): \nP")
289 (or do-all (setq do-all apropos-do-all))
290 (setq apropos-accumulator ())
291 (let (f v p)
292 (mapatoms
293 (lambda (symbol)
294 (setq f nil v nil p nil)
295 (or (memq symbol '(apropos-regexp do-all apropos-accumulator
296 symbol f v p))
297 (setq v (apropos-value-internal 'boundp symbol 'symbol-value)))
298 (if do-all
299 (setq f (apropos-value-internal 'fboundp symbol 'symbol-function)
300 p (apropos-format-plist symbol "\n " t)))
301 (if (or f v p)
302 (setq apropos-accumulator (cons (list symbol f v p)
303 apropos-accumulator))))))
304 (apropos-print nil nil t))
305
306
307 ;;;###autoload
308 (defun apropos-documentation (apropos-regexp &optional do-all)
309 "Show symbols whose documentation contain matches for REGEXP.
310 With optional prefix ARG or if `apropos-do-all' is non-nil, also use
311 documentation that is not stored in the documentation file and show key
312 bindings.
313 Returns list of symbols and documentation found."
314 (interactive "sApropos documentation (regexp): \nP")
315 (or do-all (setq do-all apropos-do-all))
316 (setq apropos-accumulator () apropos-files-scanned ())
317 (let ((standard-input (get-buffer-create " apropos-temp"))
318 f v)
319 (unwind-protect
320 (save-excursion
321 (set-buffer standard-input)
322 (apropos-documentation-check-doc-file)
323 (if do-all
324 (mapatoms
325 (lambda (symbol)
326 (setq f (apropos-safe-documentation symbol)
327 v (get symbol 'variable-documentation))
328 (if (integerp v) (setq v))
329 (setq f (apropos-documentation-internal f)
330 v (apropos-documentation-internal v))
331 (if (or f v)
332 (if (setq apropos-item
333 (cdr (assq symbol apropos-accumulator)))
334 (progn
335 (if f
336 (setcar apropos-item f))
337 (if v
338 (setcar (cdr apropos-item) v)))
339 (setq apropos-accumulator
340 (cons (list symbol f v)
341 apropos-accumulator)))))))
342 (apropos-print nil nil t))
343 (kill-buffer standard-input))))
344
345 \f
346 (defun apropos-value-internal (predicate symbol function)
347 (if (funcall predicate symbol)
348 (progn
349 (setq symbol (prin1-to-string (funcall function symbol)))
350 (if (string-match apropos-regexp symbol)
351 (progn
352 (if apropos-match-face
353 (put-text-property (match-beginning 0) (match-end 0)
354 'face apropos-match-face
355 symbol))
356 symbol)))))
357
358 (defun apropos-documentation-internal (doc)
359 (if (consp doc)
360 (apropos-documentation-check-elc-file (car doc))
361 (and doc
362 (string-match apropos-regexp doc)
363 (progn
364 (if apropos-match-face
365 (put-text-property (match-beginning 0)
366 (match-end 0)
367 'face apropos-match-face
368 (setq doc (copy-sequence doc))))
369 doc))))
370
371 (defun apropos-format-plist (pl sep &optional compare)
372 (setq pl (symbol-plist pl))
373 (let (p p-out)
374 (while pl
375 (setq p (format "%s %S" (car pl) (nth 1 pl)))
376 (if (or (not compare) (string-match apropos-regexp p))
377 (if apropos-property-face
378 (put-text-property 0 (length (symbol-name (car pl)))
379 'face apropos-property-face p))
380 (setq p nil))
381 (if p
382 (progn
383 (and compare apropos-match-face
384 (put-text-property (match-beginning 0) (match-end 0)
385 'face apropos-match-face
386 p))
387 (setq p-out (concat p-out (if p-out sep) p))))
388 (setq pl (nthcdr 2 pl)))
389 p-out))
390
391
392 ;; Finds all documentation related to APROPOS-REGEXP in internal-doc-file-name.
393
394 (defun apropos-documentation-check-doc-file ()
395 (let (type symbol (sepa 2) sepb beg end)
396 (insert ?\^_)
397 (backward-char)
398 (insert-file-contents (concat doc-directory internal-doc-file-name))
399 (forward-char)
400 (while (save-excursion
401 (setq sepb (search-forward "\^_"))
402 (not (eobp)))
403 (beginning-of-line 2)
404 (if (save-restriction
405 (narrow-to-region (point) (1- sepb))
406 (re-search-forward apropos-regexp nil t))
407 (progn
408 (setq beg (match-beginning 0)
409 end (point))
410 (goto-char (1+ sepa))
411 (or (setq type (if (eq ?F (preceding-char))
412 1 ; function documentation
413 2) ; variable documentation
414 symbol (read)
415 beg (- beg (point) 1)
416 end (- end (point) 1)
417 doc (buffer-substring (1+ (point)) (1- sepb))
418 apropos-item (assq symbol apropos-accumulator))
419 (setq apropos-item (list symbol nil nil)
420 apropos-accumulator (cons apropos-item
421 apropos-accumulator)))
422 (if apropos-match-face
423 (put-text-property beg end 'face apropos-match-face doc))
424 (setcar (nthcdr type apropos-item) doc)))
425 (setq sepa (goto-char sepb)))))
426
427 (defun apropos-documentation-check-elc-file (file)
428 (if (member file apropos-files-scanned)
429 nil
430 (let (symbol doc beg end this-is-a-variable)
431 (setq apropos-files-scanned (cons file apropos-files-scanned))
432 (erase-buffer)
433 (insert-file-contents file)
434 (while (search-forward "\n#@" nil t)
435 ;; Read the comment length, and advance over it.
436 (setq end (read)
437 beg (1+ (point))
438 end (+ (point) end -1))
439 (forward-char)
440 (if (save-restriction
441 ;; match ^ and $ relative to doc string
442 (narrow-to-region beg end)
443 (re-search-forward apropos-regexp nil t))
444 (progn
445 (goto-char (+ end 2))
446 (setq doc (buffer-substring beg end)
447 end (- (match-end 0) beg)
448 beg (- (match-beginning 0) beg)
449 this-is-a-variable (looking-at "(def\\(var\\|const\\) ")
450 symbol (progn
451 (skip-chars-forward "(a-z")
452 (forward-char)
453 (read))
454 symbol (if (consp symbol)
455 (nth 1 symbol)
456 symbol))
457 (if (if this-is-a-variable
458 (get symbol 'variable-documentation)
459 (and (fboundp symbol) (apropos-safe-documentation symbol)))
460 (progn
461 (or (setq apropos-item (assq symbol apropos-accumulator))
462 (setq apropos-item (list symbol nil nil)
463 apropos-accumulator (cons apropos-item
464 apropos-accumulator)))
465 (if apropos-match-face
466 (put-text-property beg end 'face apropos-match-face
467 doc))
468 (setcar (nthcdr (if this-is-a-variable 2 1)
469 apropos-item)
470 doc)))))))))
471
472
473
474 (defun apropos-safe-documentation (function)
475 "Like documentation, except it avoids calling `get_doc_string'.
476 Will return nil instead."
477 (while (and function (symbolp function))
478 (setq function (if (fboundp function)
479 (symbol-function function))))
480 (if (eq (car-safe function) 'macro)
481 (setq function (cdr function)))
482 (setq function (if (byte-code-function-p function)
483 (if (> (length function) 4)
484 (aref function 4))
485 (if (eq (car-safe function) 'autoload)
486 (nth 2 function)
487 (if (eq (car-safe function) 'lambda)
488 (if (stringp (nth 2 function))
489 (nth 2 function)
490 (if (stringp (nth 3 function))
491 (nth 3 function)))))))
492 (if (integerp function)
493 nil
494 function))
495
496
497
498 (defun apropos-print (do-keys doc-fn spacing)
499 "Output result of various apropos commands with `apropos-regexp'.
500 APROPOS-ACCUMULATOR is a list. Optional DOC-FN is called for each element
501 of apropos-accumulator and may modify it resulting in (SYMBOL FN-DOC
502 VAR-DOC [PLIST-DOC]). Returns sorted list of symbols and documentation
503 found."
504 (if (null apropos-accumulator)
505 (message "No apropos matches for `%s'" apropos-regexp)
506 (if doc-fn
507 (funcall doc-fn apropos-accumulator))
508 (setq apropos-accumulator
509 (sort apropos-accumulator (lambda (a b)
510 (string-lessp (car a) (car b)))))
511 (and apropos-label-face
512 (symbolp apropos-label-face)
513 (setq apropos-label-face `(face ,apropos-label-face
514 mouse-face highlight)))
515 (with-output-to-temp-buffer "*Apropos*"
516 (let ((p apropos-accumulator)
517 (old-buffer (current-buffer))
518 symbol item point1 point2)
519 (set-buffer standard-output)
520 (apropos-mode)
521 (if window-system
522 (insert "If you move the mouse over text that changes color,\n"
523 (substitute-command-keys
524 "you can click \\[apropos-mouse-follow] to get more information.\n")))
525 (insert (substitute-command-keys
526 "In this buffer, type \\[apropos-follow] to get full documentation.\n\n"))
527 (while (consp p)
528 (or (not spacing) (bobp) (terpri))
529 (setq apropos-item (car p)
530 symbol (car apropos-item)
531 p (cdr p)
532 point1 (point))
533 (princ symbol) ; print symbol name
534 (setq point2 (point))
535 ;; Calculate key-bindings if we want them.
536 (and do-keys
537 (commandp symbol)
538 (indent-to 30 1)
539 (if (let ((keys
540 (save-excursion
541 (set-buffer old-buffer)
542 (where-is-internal symbol)))
543 filtered)
544 ;; Copy over the list of key sequences,
545 ;; omitting any that contain a buffer or a frame.
546 (while keys
547 (let ((key (car keys))
548 (i 0)
549 loser)
550 (while (< i (length key))
551 (if (or (framep (aref key i))
552 (bufferp (aref key i)))
553 (setq loser t))
554 (setq i (1+ i)))
555 (or loser
556 (setq filtered (cons key filtered))))
557 (setq keys (cdr keys)))
558 (setq item filtered))
559 ;; Convert the remaining keys to a string and insert.
560 (insert
561 (mapconcat
562 (lambda (key)
563 (setq key (key-description key))
564 (if apropos-keybinding-face
565 (put-text-property 0 (length key)
566 'face apropos-keybinding-face
567 key))
568 key)
569 item ", "))
570 (insert "M-x")
571 (put-text-property (- (point) 3) (point)
572 'face apropos-keybinding-face)
573 (insert " " (symbol-name symbol) " ")
574 (insert "RET")
575 (put-text-property (- (point) 3) (point)
576 'face apropos-keybinding-face)))
577 (terpri)
578 ;; only now so we don't propagate text attributes all over
579 (put-text-property point1 point2 'item
580 (if (eval `(or ,@(cdr apropos-item)))
581 (car apropos-item)
582 apropos-item))
583 (if apropos-symbol-face
584 (put-text-property point1 point2 'face apropos-symbol-face))
585 (apropos-print-doc 'describe-function 1
586 (if (commandp symbol)
587 "Command"
588 (if (apropos-macrop symbol)
589 "Macro"
590 "Function"))
591 t)
592 ;; We used to use customize-variable-other-window instead
593 ;; for a customizable variable, but that is slow.
594 ;; It is better to show an ordinary help buffer
595 ;; and let the user click on the customization button
596 ;; in that buffer, if he wants to.
597 (apropos-print-doc 'describe-variable 2 "Variable" t)
598 (apropos-print-doc 'customize-group-other-window 6 "Group" t)
599 (apropos-print-doc 'customize-face-other-window 5 "Face" t)
600 (apropos-print-doc 'widget-browse-other-window 4 "Widget" t)
601 (apropos-print-doc 'apropos-describe-plist 3
602 "Plist" nil)))))
603 (prog1 apropos-accumulator
604 (setq apropos-accumulator ()))) ; permit gc
605
606
607 (defun apropos-macrop (symbol)
608 "T if SYMBOL is a Lisp macro."
609 (and (fboundp symbol)
610 (consp (setq symbol
611 (symbol-function symbol)))
612 (or (eq (car symbol) 'macro)
613 (if (eq (car symbol) 'autoload)
614 (memq (nth 4 symbol)
615 '(macro t))))))
616
617
618 (defun apropos-print-doc (action i str do-keys)
619 (if (stringp (setq i (nth i apropos-item)))
620 (progn
621 (insert " ")
622 (put-text-property (- (point) 2) (1- (point))
623 'action action)
624 (insert str ": ")
625 (if apropos-label-face
626 (add-text-properties (- (point) (length str) 2)
627 (1- (point))
628 apropos-label-face))
629 (insert (if do-keys (substitute-command-keys i) i))
630 (or (bolp) (terpri)))))
631
632
633 (defun apropos-mouse-follow (event)
634 (interactive "e")
635 (let ((other (if (eq (current-buffer) (get-buffer "*Apropos*"))
636 ()
637 (current-buffer))))
638 (save-excursion
639 (set-buffer (window-buffer (posn-window (event-start event))))
640 (goto-char (posn-point (event-start event)))
641 (or (and (not (eobp)) (get-text-property (point) 'mouse-face))
642 (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face))
643 (error "There is nothing to follow here"))
644 (apropos-follow other))))
645
646
647 (defun apropos-follow (&optional other)
648 (interactive)
649 (let* (;; Properties are always found at the beginning of the line.
650 (bol (save-excursion (beginning-of-line) (point)))
651 ;; If there is no `item' property here, look behind us.
652 (item (get-text-property bol 'item))
653 (item-at (if item nil (previous-single-property-change bol 'item)))
654 ;; Likewise, if there is no `action' property here, look in front.
655 (action (get-text-property bol 'action))
656 (action-at (if action nil (next-single-property-change bol 'action))))
657 (and (null item) item-at
658 (setq item (get-text-property (1- item-at) 'item)))
659 (and (null action) action-at
660 (setq action (get-text-property action-at 'action)))
661 (if (not (and item action))
662 (error "There is nothing to follow here"))
663 (if (consp item) (error "There is nothing to follow in `%s'" (car item)))
664 (if other (set-buffer other))
665 (funcall action item)))
666
667
668
669 (defun apropos-describe-plist (symbol)
670 "Display a pretty listing of SYMBOL's plist."
671 (with-output-to-temp-buffer "*Help*"
672 (set-buffer standard-output)
673 (princ "Symbol ")
674 (prin1 symbol)
675 (princ "'s plist is\n (")
676 (if apropos-symbol-face
677 (put-text-property 8 (- (point) 14) 'face apropos-symbol-face))
678 (insert (apropos-format-plist symbol "\n "))
679 (princ ")")
680 (print-help-return-message)))
681
682 (provide 'apropos)
683
684 ;;; apropos.el ends here