Function: actype:doc

actype:doc is a byte-compiled function defined in hact.el.

Signature

(actype:doc BUT &optional FULL)

Documentation

Return first line of action doc for BUT.

BUT should be a Hyperbole button symbol or an Emacs push button. With optional FULL, returns full documentation string. Return nil when no documentation.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hact.el
(defun    actype:doc (but &optional full)
  "Return first line of action doc for BUT.
BUT should be a Hyperbole button symbol or an Emacs push button.
With optional FULL, returns full documentation string.
Return nil when no documentation."
  (let* ((is-hbut (hbut:is-p but))
	 (act (if is-hbut
		  (or (hattr:get but 'action) (hattr:get but 'actype))
		(let ((attrs (hattr:list but)))
		  (or (plist-get attrs 'action)
		      (when (plist-get attrs 'follow-link)
			(plist-get attrs 'help-echo))))))
	 (but-type (if is-hbut
		       (hattr:get but 'categ)
		     act))
	 (sym-p (when act (symbolp act)))
	 (end-line) (doc))
    (cond ((stringp but-type)
	   (setq doc but-type))
	  ((and (functionp but-type)
		(setq doc (htype:doc but-type)))) ;; Is an implicit button, use its doc string.
	  (sym-p
	   (setq doc (htype:doc act))))
    (when doc
      (setq doc (substitute-command-keys doc))
      (or full (setq end-line (string-match "[\n]" doc)
		     doc (substring doc 0 end-line))))
    doc))