Function: hyrolo-set-date

hyrolo-set-date is a byte-compiled function defined in hyrolo.el.

Signature

(hyrolo-set-date &optional EDIT-ONLY-FLAG)

Documentation

Add a line with the current date at the end of the current hyrolo entry.

With optional non-nil EDIT-ONLY-FLAG, edit an existing date but do not add one if the entry lacks one.

Do nothing if in a Koutline buffer or if hyrolo-date-format is an empty string.

Suitable for use as an entry in hyrolo-add-hook and hyrolo-edit-hook. The date format is determined by the setting, hyrolo-date-format.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
(defun hyrolo-set-date (&optional edit-only-flag)
  "Add a line with the current date at the end of the current hyrolo entry.
With optional non-nil EDIT-ONLY-FLAG, edit an existing date but do
not add one if the entry lacks one.

Do nothing if in a Koutline buffer or if `hyrolo-date-format' is an
empty string.

Suitable for use as an entry in `hyrolo-add-hook' and `hyrolo-edit-hook'.
The date format is determined by the setting, `hyrolo-date-format'."
  (unless (or (string-empty-p hyrolo-date-format) (null hyrolo-date-format)
	      (derived-mode-p 'kotl-mode))
    (save-excursion
      (skip-chars-forward "*")
      (hyrolo-to-entry-end)
      (skip-chars-backward " \t\n\r\f")
      (skip-chars-backward "^\n\r\f")
      (if (looking-at "\\s-+[-0-9./]+\\s-*$") ;; a date
	  ;; edit date
	  (progn (delete-region (point) (match-end 0))
		 (insert "\t" (hyrolo-current-date)))
	(unless edit-only-flag
	  ;; add date
	  (end-of-line)
	  (insert "\n\t" (hyrolo-current-date)))))))