Function: denote-link-description-with-signature-and-title

denote-link-description-with-signature-and-title is a byte-compiled function defined in denote.el.

Signature

(denote-link-description-with-signature-and-title FILE &optional FILE-TYPE)

Documentation

Return link description for FILE with FILE-TYPE.

For backward compatibility, FILE-TYPE is an optional parameter. If it is nil, then compute FILE-TYPE internally.

- If the region is active, use it as the description.

- If FILE has a signature, then format the description as a sequence of
  the signature text and the title with two spaces between them.

- If FILE does not have a signature, then use its title as the
  description.

- If none of the above works, return an empty string.

This function is useful as the value of the user option denote-link-description-format (which can optionally be bound to a function).

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;; NOTE 2025-11-23: The only reason I have &optional is because I want
;; it to be backward compatible.  We used to have a single FILE
;; parameter.
(defun denote-link-description-with-signature-and-title (file &optional file-type)
  "Return link description for FILE with FILE-TYPE.
For backward compatibility, FILE-TYPE is an optional parameter.  If it
is nil, then compute FILE-TYPE internally.

- If the region is active, use it as the description.

- If FILE has a signature, then format the description as a sequence of
  the signature text and the title with two spaces between them.

- If FILE does not have a signature, then use its title as the
  description.

- If none of the above works, return an empty string.

This function is useful as the value of the user option
`denote-link-description-format' (which can optionally be bound to a
function)."
  (let* ((type (or file-type (denote-filetype-heuristics file)))
         (signature (denote-retrieve-filename-signature file))
         (title (denote-retrieve-title-or-filename file type))
         (region-text (denote--get-active-region-content)))
    (cond
     (region-text region-text)
     ((and signature title) (format "%s  %s" signature title))
     (title (format "%s" title))
     (signature (format "%s" signature))
     (t ""))))