Function: denote--find-first-unused-id-as-date

denote--find-first-unused-id-as-date is a byte-compiled function defined in denote.el.

Signature

(denote--find-first-unused-id-as-date ID)

Documentation

Return the first unused id starting at ID.

If ID is already used, increment it 1 second at a time until an available id is found.

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote--find-first-unused-id-as-date (id)
  "Return the first unused id starting at ID.
If ID is already used, increment it 1 second at a time until an
available id is found."
  (let ((current-id id)
        (iteration 0))
    (while (gethash current-id denote-used-identifiers)
      ;; Prevent infinite loop if `denote-date-identifier-format' is misconfigured
      (setq iteration (1+ iteration))
      (when (>= iteration 10000)
        (user-error "A unique identifier could not be found"))
      (setq current-id (format-time-string
                        denote-date-identifier-format
                        (time-add (date-to-time current-id) 1))))
    current-id))