1 ;;; help-fns.el --- Complex help functions
3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001,
4 ;; 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
7 ;; Keywords: help, internal
9 ;; This file is part of GNU Emacs.
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 3, or (at your option)
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.
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., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
28 ;; This file contains those help commands which are complicated, and
29 ;; which may not be used in every session. For example
30 ;; `describe-function' will probably be heavily used when doing elisp
31 ;; programming, but not if just editing C files. Simpler help commands
41 (defun describe-function (function)
42 "Display the full documentation of FUNCTION (a symbol)."
44 (let ((fn (function-called-at-point))
45 (enable-recursive-minibuffers t
)
47 (setq val
(completing-read (if fn
48 (format "Describe function (default %s): " fn
)
49 "Describe function: ")
50 obarray
'fboundp t nil nil
51 (and fn
(symbol-name fn
))))
52 (list (if (equal val
"")
55 (message "You didn't specify a function")
56 (help-setup-xref (list #'describe-function function
) (interactive-p))
58 (with-help-window (help-buffer)
60 ;; Use " is " instead of a colon so that
61 ;; it is easier to get out the function name using forward-sexp.
63 (describe-function-1 function
)
64 (with-current-buffer standard-output
65 ;; Return the text we displayed.
68 (defun help-split-fundoc (docstring def
)
69 "Split a function DOCSTRING into the actual doc and the usage info.
70 Return (USAGE . DOC) or nil if there's no usage info.
71 DEF is the function whose usage we're looking for in DOCSTRING."
72 ;; Functions can get the calling sequence at the end of the doc string.
73 ;; In cases where `function' has been fset to a subr we can't search for
74 ;; function's name in the doc string so we use `fn' as the anonymous
75 ;; function name instead.
76 (when (and docstring
(string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring
))
78 ;; Replace `fn' with the actual function name.
79 (if (consp def
) "anonymous" def
)
80 (match-string 1 docstring
))
81 (substring docstring
0 (match-beginning 0)))))
83 (defun help-add-fundoc-usage (docstring arglist
)
84 "Add the usage info to DOCSTRING.
85 If DOCSTRING already has a usage info, then just return it unchanged.
86 The usage info is built from ARGLIST. DOCSTRING can be nil.
87 ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"."
88 (unless (stringp docstring
) (setq docstring
"Not documented"))
89 (if (or (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring
) (eq arglist t
))
92 (if (string-match "\n?\n\\'" docstring
)
93 (if (< (- (match-end 0) (match-beginning 0)) 2) "\n" "")
95 (if (and (stringp arglist
)
96 (string-match "\\`([^ ]+\\(.*\\))\\'" arglist
))
97 (concat "(fn" (match-string 1 arglist
) ")")
98 (format "%S" (help-make-usage 'fn arglist
))))))
100 (defun help-function-arglist (def)
101 ;; Handle symbols aliased to other symbols.
102 (if (and (symbolp def
) (fboundp def
)) (setq def
(indirect-function def
)))
103 ;; If definition is a macro, find the function inside it.
104 (if (eq (car-safe def
) 'macro
) (setq def
(cdr def
)))
106 ((byte-code-function-p def
) (aref def
0))
107 ((eq (car-safe def
) 'lambda
) (nth 1 def
))
108 ((and (eq (car-safe def
) 'autoload
) (not (eq (nth 4 def
) 'keymap
)))
109 "[Arg list not available until function definition is loaded.]")
112 (defun help-make-usage (function arglist
)
113 (cons (if (symbolp function
) function
'anonymous
)
114 (mapcar (lambda (arg)
115 (if (not (symbolp arg
))
116 (if (and (consp arg
) (symbolp (car arg
)))
117 ;; CL style default values for optional args.
118 (cons (intern (upcase (symbol-name (car arg
))))
121 (let ((name (symbol-name arg
)))
122 (if (string-match "\\`&" name
) arg
123 (intern (upcase name
))))))
126 ;; Could be this, if we make symbol-file do the work below.
127 ;; (defun help-C-file-name (subr-or-var kind)
128 ;; "Return the name of the C file where SUBR-OR-VAR is defined.
129 ;; KIND should be `var' for a variable or `subr' for a subroutine."
130 ;; (symbol-file (if (symbolp subr-or-var) subr-or-var
131 ;; (subr-name subr-or-var))
132 ;; (if (eq kind 'var) 'defvar 'defun)))
134 (defun help-C-file-name (subr-or-var kind
)
135 "Return the name of the C file where SUBR-OR-VAR is defined.
136 KIND should be `var' for a variable or `subr' for a subroutine."
137 (let ((docbuf (get-buffer-create " *DOC*"))
138 (name (if (eq 'var kind
)
139 (concat "V" (symbol-name subr-or-var
))
140 (concat "F" (subr-name subr-or-var
)))))
141 (with-current-buffer docbuf
142 (goto-char (point-min))
144 (insert-file-contents-literally
145 (expand-file-name internal-doc-file-name doc-directory
)))
146 (let ((file (catch 'loop
148 (let ((pnt (search-forward (concat "\x1f" name
"\n"))))
149 (re-search-backward "\x1fS\\(.*\\)")
150 (let ((file (match-string 1)))
151 (if (member file build-files
)
153 (goto-char pnt
))))))))
154 (if (string-match "\\.\\(o\\|obj\\)\\'" file
)
155 (setq file
(replace-match ".c" t t file
)))
156 (if (string-match "\\.c\\'" file
)
160 (defface help-argument-name
'((((supports :slant italic
)) :inherit italic
))
161 "Face to highlight argument names in *Help* buffers."
164 (defun help-default-arg-highlight (arg)
165 "Default function to highlight arguments in *Help* buffers.
166 It returns ARG in face `help-argument-name'; ARG is also
167 downcased if it displays differently than the default
168 face (according to `face-differs-from-default-p')."
169 (propertize (if (face-differs-from-default-p 'help-argument-name
)
172 'face
'help-argument-name
))
174 (defun help-do-arg-highlight (doc args
)
175 (with-syntax-table (make-syntax-table emacs-lisp-mode-syntax-table
)
176 (modify-syntax-entry ?\-
"w")
177 (dolist (arg args doc
)
178 (setq doc
(replace-regexp-in-string
179 ;; This is heuristic, but covers all common cases
181 (concat "\\<" ; beginning of word
182 "\\(?:[a-z-]*-\\)?" ; for xxx-ARG
186 "\\(?:es\\|s\\|th\\)?" ; for ARGth, ARGs
187 "\\(?:-[a-z0-9-]+\\)?" ; for ARG-xxx, ARG-n
188 "\\(?:-[{([<`\"].*?\\)?"; for ARG-{x}, (x), <x>, [x], `x'
190 (help-default-arg-highlight arg
)
193 (defun help-highlight-arguments (usage doc
&rest args
)
197 (goto-char (point-min))
198 (let ((case-fold-search nil
)
199 (next (not (or args
(looking-at "\\["))))
201 ;; Make a list of all arguments
202 (skip-chars-forward "^ ")
204 (or opt
(not (looking-at " &")) (setq opt t
))
205 (if (not (re-search-forward " \\([\\[(]*\\)\\([^] &)\.]+\\)" nil t
))
207 (setq args
(cons (match-string 2) args
))
208 (when (and opt
(string= (match-string 1) "("))
209 ;; A pesky CL-style optional argument with default value,
210 ;; so let's skip over it
211 (search-backward "(")
212 (goto-char (scan-sexps (point) 1)))))
213 ;; Highlight aguments in the USAGE string
214 (setq usage
(help-do-arg-highlight (buffer-string) args
))
215 ;; Highlight arguments in the DOC string
216 (setq doc
(and doc
(help-do-arg-highlight doc args
))))))
217 ;; Return value is like the one from help-split-fundoc, but highlighted
221 (defun describe-simplify-lib-file-name (file)
222 "Simplify a library name FILE to a relative name, and make it a source file."
224 ;; Try converting the absolute file name to a library name.
225 (let ((libname (file-name-nondirectory file
)))
226 ;; Now convert that back to a file name and see if we get
227 ;; the original one. If so, they are equivalent.
228 (if (equal file
(locate-file libname load-path
'("")))
229 (if (string-match "[.]elc\\'" libname
)
230 (substring libname
0 -
1)
234 (defun find-source-lisp-file (file-name)
235 (let* ((elc-file (locate-file (concat file-name
236 (if (string-match "\\.el" file-name
)
240 (str (if (and elc-file
(file-readable-p elc-file
))
242 (insert-file-contents-literally elc-file nil
0 256)
245 (string-match ";;; from file \\(.*\\.el\\)" str
)
246 (match-string 1 str
))))
247 (if (and src-file
(file-readable-p src-file
))
251 (declare-function ad-get-advice-info
"emacs-lisp/advice" (function))
254 (defun describe-function-1 (function)
255 (let* ((advised (and (featurep 'advice
) (ad-get-advice-info function
)))
256 ;; If the function is advised, use the symbol that has the
257 ;; real definition, if that symbol is already set up.
260 (cdr (assq 'origname advised
))
261 (fboundp (cdr (assq 'origname advised
)))
262 (cdr (assq 'origname advised
)))
264 ;; Get the real definition.
265 (def (if (symbolp real-function
)
266 (symbol-function real-function
)
269 (beg (if (commandp def
) "an interactive " "a ")))
271 (cond ((or (stringp def
)
275 (if (eq 'unevalled
(cdr (subr-arity def
)))
276 (concat beg
"special form")
277 (concat beg
"built-in function")))
278 ((byte-code-function-p def
)
279 (concat beg
"compiled Lisp function"))
281 (while (symbolp (symbol-function def
))
282 (setq def
(symbol-function def
)))
283 (format "an alias for `%s'" def
))
284 ((eq (car-safe def
) 'lambda
)
285 (concat beg
"Lisp function"))
286 ((eq (car-safe def
) 'macro
)
288 ((eq (car-safe def
) 'autoload
)
289 (setq file-name
(nth 1 def
))
290 (format "%s autoloaded %s"
291 (if (commandp def
) "an interactive" "an")
292 (if (eq (nth 4 def
) 'keymap
) "keymap"
293 (if (nth 4 def
) "Lisp macro" "Lisp function"))
297 (elts (cdr-safe def
)))
299 (if (char-table-p (car-safe elts
))
302 (setq elts
(cdr-safe elts
)))
308 (with-current-buffer standard-output
311 (if (re-search-backward "alias for `\\([^`']+\\)'" nil t
)
312 (help-xref-button 1 'help-function def
)))))
314 (setq file-name
(symbol-file function
'defun
)))
315 (setq file-name
(describe-simplify-lib-file-name file-name
))
316 (when (equal file-name
"loaddefs.el")
317 ;; Find the real def site of the preloaded function.
318 ;; This is necessary only for defaliases.
321 (find-function-search-for-symbol function nil
"loaddefs.el")
324 (with-current-buffer (car location
)
325 (goto-char (cdr location
))
326 (when (re-search-backward
327 "^;;; Generated autoloads from \\(.*\\)" nil t
)
328 (setq file-name
(match-string 1)))))))
329 (when (and (null file-name
) (subrp def
))
330 ;; Find the C source file name.
331 (setq file-name
(if (get-buffer " *DOC*")
332 (help-C-file-name def
'subr
)
336 ;; We used to add .el to the file name,
337 ;; but that's completely wrong when the user used load-file.
338 (princ (if (eq file-name
'C-source
) "C source code" file-name
))
340 ;; See if lisp files are present where they where installed from.
341 (if (not (eq file-name
'C-source
))
342 (setq file-name
(find-source-lisp-file file-name
)))
344 ;; Make a hyperlink to the library.
345 (with-current-buffer standard-output
347 (re-search-backward "`\\([^`']+\\)'" nil t
)
348 (help-xref-button 1 'help-function-def real-function file-name
))))
351 (when (commandp function
)
352 (if (and (eq function
'self-insert-command
)
353 (eq (key-binding "a") 'self-insert-command
)
354 (eq (key-binding "b") 'self-insert-command
)
355 (eq (key-binding "c") 'self-insert-command
))
356 (princ "It is bound to many ordinary text characters.\n")
357 (let* ((remapped (command-remapping function
))
358 (keys (where-is-internal
359 (or remapped function
) overriding-local-map nil nil
))
361 ;; Which non-control non-meta keys run this command?
363 (if (member (event-modifiers (aref key
0)) '(nil (shift)))
364 (push key non-modified-keys
)))
366 (princ "It is remapped to `")
367 (princ (symbol-name remapped
))
371 (princ (if remapped
" which is bound to " "It is bound to "))
372 ;; If lots of ordinary text characters run this command,
373 ;; don't mention them one by one.
374 (if (< (length non-modified-keys
) 10)
375 (princ (mapconcat 'key-description keys
", "))
376 (dolist (key non-modified-keys
)
377 (setq keys
(delq key keys
)))
380 (princ (mapconcat 'key-description keys
", "))
381 (princ ", and many ordinary text characters"))
382 (princ "many ordinary text characters"))))
383 (when (or remapped keys non-modified-keys
)
386 (let* ((arglist (help-function-arglist def
))
387 (doc (documentation function
))
388 (usage (help-split-fundoc doc function
)))
389 (with-current-buffer standard-output
390 ;; If definition is a keymap, skip arglist note.
391 (unless (keymapp def
)
393 (usage (setq doc
(cdr usage
)) (car usage
))
395 (format "%S" (help-make-usage function arglist
)))
396 ((stringp arglist
) arglist
)
397 ;; Maybe the arglist is in the docstring of a symbol
398 ;; this one is aliased to.
399 ((let ((fun real-function
))
400 (while (and (symbolp fun
)
401 (setq fun
(symbol-function fun
))
402 (not (setq usage
(help-split-fundoc
409 (format "\nMacro: %s" (format-kbd-macro def
)))
410 (t "[Missing arglist. Please make a bug report.]")))
411 (high (help-highlight-arguments use doc
)))
412 (let ((fill-begin (point)))
413 (insert (car high
) "\n")
414 (fill-region fill-begin
(point)))
415 (setq doc
(cdr high
))))
417 ;; function might be a lambda construct.
419 (get function
'byte-obsolete-info
))))
421 (princ "\nThis function is obsolete")
422 (when (nth 2 obsolete
)
423 (insert (format " since %s" (nth 2 obsolete
))))
425 (if (stringp (car obsolete
)) (car obsolete
)
426 (format "use `%s' instead." (car obsolete
)))
429 (or doc
"Not documented.")))))))
435 (defun variable-at-point (&optional any-symbol
)
436 "Return the bound variable symbol found at or before point.
437 Return 0 if there is no such symbol.
438 If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
439 (or (condition-case ()
440 (with-syntax-table emacs-lisp-mode-syntax-table
442 (or (not (zerop (skip-syntax-backward "_w")))
443 (eq (char-syntax (following-char)) ?w
)
444 (eq (char-syntax (following-char)) ?_
)
446 (skip-chars-forward "'")
447 (let ((obj (read (current-buffer))))
448 (and (symbolp obj
) (boundp obj
) obj
))))
450 (let* ((str (find-tag-default))
451 (sym (if str
(intern-soft str
))))
452 (if (and sym
(or any-symbol
(boundp sym
)))
455 (when (and str
(string-match "\\`\\W*\\(.*?\\)\\W*\\'" str
))
456 (setq sym
(intern-soft (match-string 1 str
)))
457 (and (or any-symbol
(boundp sym
)) sym
)))))
460 (defun describe-variable-custom-version-info (variable)
461 (let ((custom-version (get variable
'custom-version
))
462 (cpv (get variable
'custom-package-version
))
466 (format "This variable was introduced, or its default value was changed, in\nversion %s of Emacs.\n"
469 (let* ((package (car-safe cpv
))
470 (version (car (cdr-safe cpv
)))
471 (pkg-versions (assq package customize-package-emacs-version-alist
))
472 (emacsv (cdr (assoc version pkg-versions
))))
473 (if (and package version
)
475 (format (concat "This variable was introduced, or its default value was changed, in\nversion %s of the %s package"
477 (format " that is part of Emacs %s" emacsv
))
479 version package
))))))
483 (defun describe-variable (variable &optional buffer frame
)
484 "Display the full documentation of VARIABLE (a symbol).
485 Returns the documentation as a string, also.
486 If VARIABLE has a buffer-local value in BUFFER or FRAME
487 \(default to the current buffer and current frame),
488 it is displayed along with the global value."
490 (let ((v (variable-at-point))
491 (enable-recursive-minibuffers t
)
493 (setq val
(completing-read (if (symbolp v
)
495 "Describe variable (default %s): " v
)
496 "Describe variable: ")
500 (get vv
'variable-documentation
)))
502 (if (symbolp v
) (symbol-name v
))))
503 (list (if (equal val
"")
505 (unless (buffer-live-p buffer
) (setq buffer
(current-buffer)))
506 (unless (frame-live-p frame
) (setq frame
(selected-frame)))
507 (if (not (symbolp variable
))
508 (message "You did not specify a variable")
510 (let ((valvoid (not (with-current-buffer buffer
(boundp variable
))))
511 val val-start-pos locus
)
512 ;; Extract the value before setting up the output buffer,
513 ;; in case `buffer' *is* the output buffer.
515 (with-selected-frame frame
516 (with-current-buffer buffer
517 (setq val
(symbol-value variable
)
518 locus
(variable-binding-locus variable
)))))
519 (help-setup-xref (list #'describe-variable variable buffer
)
521 (with-help-window (help-buffer)
522 (with-current-buffer buffer
524 ;; Make a hyperlink to the library if appropriate. (Don't
525 ;; change the format of the buffer's initial line in case
526 ;; anything expects the current format.)
527 (let ((file-name (symbol-file variable
'defvar
)))
528 (setq file-name
(describe-simplify-lib-file-name file-name
))
529 (when (equal file-name
"loaddefs.el")
530 ;; Find the real def site of the preloaded variable.
533 (find-variable-noselect variable file-name
)
536 (with-current-buffer (car location
)
538 (goto-char (cdr location
)))
539 (when (re-search-backward
540 "^;;; Generated autoloads from \\(.*\\)" nil t
)
541 (setq file-name
(match-string 1)))))))
542 (when (and (null file-name
)
543 (integerp (get variable
'variable-documentation
)))
544 ;; It's a variable not defined in Elisp but in C.
546 (if (get-buffer " *DOC*")
547 (help-C-file-name variable
'var
)
551 (princ " is a variable defined in `")
552 (princ (if (eq file-name
'C-source
) "C source code" file-name
))
554 (with-current-buffer standard-output
556 (re-search-backward "`\\([^`']+\\)'" nil t
)
557 (help-xref-button 1 'help-variable-def
558 variable file-name
)))
560 (princ "It is void as a variable.")
563 (princ " is void as a variable.")
567 (with-current-buffer standard-output
568 (setq val-start-pos
(point))
571 (let ((from (point)))
573 ;; Hyperlinks in variable's value are quite frequently
574 ;; inappropriate e.g C-h v <RET> features <RET>
575 ;; (help-xref-on-pp from (point))
576 (if (< (point) (+ from
20))
577 (delete-region (1- from
) from
)))))
582 (princ (format "%socal in buffer %s; "
583 (if (get variable
'permanent-local
)
586 (princ (format "It is a frame-local variable; ")))
587 (if (not (default-boundp variable
))
588 (princ "globally void")
589 (let ((val (default-value variable
)))
590 (with-current-buffer standard-output
591 (princ "global value is ")
593 ;; Fixme: pp can take an age if you happen to
594 ;; ask for a very large expression. We should
595 ;; probably print it raw once and check it's a
596 ;; sensible size before prettyprinting. -- fx
597 (let ((from (point)))
599 ;; See previous comment for this function.
600 ;; (help-xref-on-pp from (point))
601 (if (< (point) (+ from
20))
602 (delete-region (1- from
) from
))))))
605 ;; If the value is large, move it to the end.
606 (with-current-buffer standard-output
607 (when (> (count-lines (point-min) (point-max)) 10)
608 ;; Note that setting the syntax table like below
609 ;; makes forward-sexp move over a `'s' at the end
611 (set-syntax-table emacs-lisp-mode-syntax-table
)
612 (goto-char val-start-pos
)
613 ;; The line below previously read as
614 ;; (delete-region (point) (progn (end-of-line) (point)))
615 ;; which suppressed display of the buffer local value for
617 (when (looking-at "value is") (replace-match ""))
619 (insert "\n\nValue:")
620 (set (make-local-variable 'help-button-cache
)
622 (insert "value is shown ")
623 (insert-button "below"
624 'action help-button-cache
626 'help-echo
"mouse-2, RET: show value")
630 (let* ((alias (condition-case nil
631 (indirect-variable variable
)
633 (obsolete (get variable
'byte-obsolete-variable
))
634 (safe-var (get variable
'safe-local-variable
))
635 (doc (or (documentation-property variable
'variable-documentation
)
636 (documentation-property alias
'variable-documentation
)))
638 ;; Add a note for variables that have been make-var-buffer-local.
639 (when (and (local-variable-if-set-p variable
)
640 (or (not (local-variable-p variable
))
642 (local-variable-if-set-p variable
))))
644 (princ " Automatically becomes buffer-local when set in any fashion.\n"))
646 ;; Mention if it's an alias
647 (unless (eq alias variable
)
649 (princ (format " This variable is an alias for `%s'.\n" alias
)))
653 (princ " This variable is obsolete")
654 (if (cdr obsolete
) (princ (format " since %s" (cdr obsolete
))))
656 (princ (if (stringp (car obsolete
)) (car obsolete
)
657 (format "use `%s' instead." (car obsolete
))))
661 (princ " This variable is safe as a file local variable ")
662 (princ "if its value\n satisfies the predicate ")
663 (princ (if (byte-code-function-p safe-var
)
664 "which is byte-compiled expression.\n"
665 (format "`%s'.\n" safe-var
))))
667 (if extra-line
(terpri))
668 (princ "Documentation:\n")
669 (with-current-buffer standard-output
670 (insert (or doc
"Not documented as a variable."))))
671 ;; Make a link to customize if this variable can be customized.
672 (when (custom-variable-p variable
)
673 (let ((customize-label "customize"))
676 (princ (concat "You can " customize-label
" this variable."))
677 (with-current-buffer standard-output
680 (concat "\\(" customize-label
"\\)") nil t
)
681 (help-xref-button 1 'help-customize-variable variable
))))
682 ;; Note variable's version or package version
683 (let ((output (describe-variable-custom-version-info variable
)))
690 (set-buffer standard-output
)
691 ;; Return the text we displayed.
692 (buffer-string))))))))
696 (defun describe-syntax (&optional buffer
)
697 "Describe the syntax specifications in the syntax table of BUFFER.
698 The descriptions are inserted in a help buffer, which is then displayed.
699 BUFFER defaults to the current buffer."
701 (setq buffer
(or buffer
(current-buffer)))
702 (help-setup-xref (list #'describe-syntax buffer
) (interactive-p))
703 (with-help-window (help-buffer)
704 (let ((table (with-current-buffer buffer
(syntax-table))))
705 (with-current-buffer standard-output
706 (describe-vector table
'internal-describe-syntax-value
)
707 (while (setq table
(char-table-parent table
))
708 (insert "\nThe parent syntax table is:")
709 (describe-vector table
'internal-describe-syntax-value
))))))
711 (defun help-describe-category-set (value)
713 ((null value
) "default")
714 ((char-table-p value
) "deeper char-table ...")
715 (t (condition-case err
716 (category-set-mnemonics value
)
717 (error "invalid"))))))
720 (defun describe-categories (&optional buffer
)
721 "Describe the category specifications in the current category table.
722 The descriptions are inserted in a buffer, which is then displayed.
723 If BUFFER is non-nil, then describe BUFFER's category table instead.
724 BUFFER should be a buffer or a buffer name."
726 (setq buffer
(or buffer
(current-buffer)))
727 (help-setup-xref (list #'describe-categories buffer
) (interactive-p))
728 (with-help-window (help-buffer)
729 (let ((table (with-current-buffer buffer
(category-table))))
730 (with-current-buffer standard-output
731 (describe-vector table
'help-describe-category-set
)
732 (let ((docs (char-table-extra-slot table
0)))
733 (if (or (not (vectorp docs
)) (/= (length docs
) 95))
734 (insert "Invalid first extra slot in this char table\n")
735 (insert "Meanings of mnemonic characters are:\n")
737 (let ((elt (aref docs i
)))
739 (insert (+ i ?\s
) ": " elt
"\n"))))
740 (while (setq table
(char-table-parent table
))
741 (insert "\nThe parent category table is:")
742 (describe-vector table
'help-describe-category-set
))))))))
746 ;; arch-tag: 9e10331c-ae81-4d13-965d-c4819aaab0b3
747 ;;; help-fns.el ends here