Function: describe-categories

describe-categories is an autoloaded, interactive and byte-compiled function defined in help-fns.el.gz.

Signature

(describe-categories &optional BUFFER)

Documentation

Describe the category specifications in the current category table.

The descriptions are inserted in a buffer, which is then displayed. If BUFFER is non-nil, then describe BUFFER's category table instead. BUFFER should be a buffer or a buffer name.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
;;;###autoload
(defun describe-categories (&optional buffer)
  "Describe the category specifications in the current category table.
The descriptions are inserted in a buffer, which is then displayed.
If BUFFER is non-nil, then describe BUFFER's category table instead.
BUFFER should be a buffer or a buffer name."
  (interactive)
  (let ((help-buffer-under-preparation t))
    (setq buffer (or buffer (current-buffer)))
    (help-setup-xref (list #'describe-categories buffer)
		     (called-interactively-p 'interactive))
    (with-help-window (help-buffer)
      (let* ((table (with-current-buffer buffer (category-table)))
	     (docs (char-table-extra-slot table 0)))
        (if (or (not (vectorp docs)) (/= (length docs) 95))
	    (error "Invalid first extra slot in this category table\n"))
        (with-current-buffer standard-output
          (setq-default help-button-cache (make-marker))
	  (insert "Legend of category mnemonics ")
          (insert-button "(longer descriptions at the bottom)"
                         'action help-button-cache
                         'follow-link t
                         'help-echo "mouse-2, RET: show full legend")
          (insert "\n")
	  (let ((pos (point)) (items 0) lines n)
	    (dotimes (i 95)
	      (if (aref docs i) (setq items (1+ items))))
	    (setq lines (1+ (/ (1- items) 4)))
	    (setq n 0)
	    (dotimes (i 95)
	      (let ((elt (aref docs i)))
                (when elt
		  (string-match ".*" elt)
		  (setq elt (match-string 0 elt))
		  (if (>= (length elt) 17)
		      (setq elt (concat (substring elt 0 14) "...")))
		  (if (< (point) (point-max))
		      (move-to-column (* 20 (/ n lines)) t))
		  (insert (+ i ?\s) ?: elt)
		  (if (< (point) (point-max))
		      (forward-line 1)
		    (insert "\n"))
		  (setq n (1+ n))
		  (if (= (% n lines) 0)
		      (goto-char pos))))))
	  (goto-char (point-max))
	  (insert "\n"
		  "character(s)\tcategory mnemonics\n"
		  "------------\t------------------")
	  (describe-vector table 'help-describe-category-set)
          (set-marker help-button-cache (point))
	  (insert "Legend of category mnemonics:\n")
	  (dotimes (i 95)
	    (let ((elt (aref docs i)))
	      (when elt
                (if (string-match "\n" elt)
		    (setq elt (substring elt (match-end 0))))
                (insert (+ i ?\s) ": " elt "\n"))))
	  (while (setq table (char-table-parent table))
	    (insert "\nThe parent category table is:")
	    (describe-vector table 'help-describe-category-set)))))))