Function: denote--rewrite-front-matter-line

denote--rewrite-front-matter-line is a byte-compiled function defined in denote.el.

Signature

(denote--rewrite-front-matter-line COMPONENT NEW-LINE FILE-TYPE)

Documentation

Rewrite COMPONENT with NEW-LINE given the FILE-TYPE.

Preserve the existing key and the spacing, if any, that follows it. Return non-nil if successful.

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote--rewrite-front-matter-line (component new-line file-type)
  "Rewrite COMPONENT with NEW-LINE given the FILE-TYPE.
Preserve the existing key and the spacing, if any, that follows it.
Return non-nil if successful."
  (when-let* ((key-regexp-fn (denote--get-component-key-regexp-function component))
              (regexp (funcall key-regexp-fn file-type))
              (_ (re-search-forward regexp nil t 1))
              (new-value (denote--get-front-matter-value-no-indentation component new-line file-type)))
    (re-search-forward "\\s-*" (line-end-position) t)
    (delete-region (point) (line-end-position))
    (insert new-value)
    t))