Skip to content

Commit

Permalink
Intern strings for use as plist keys
Browse files Browse the repository at this point in the history
`plist-get` and `plist-put` don't work properly otherwise.
  • Loading branch information
telotortium committed Jul 15, 2022
1 parent 5b1afd1 commit 8850fdf
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions org-generic-id.el
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ diagnostic and progress messages."
((file
(car-safe
(org-generic-id-files-modified-since-modtime
(plist-get org-generic-id--last-update-id-time id-prop)
(org-generic-id--last-update-id-time-get id-prop)
(list file)
org-generic-id--files))))
(unless silent
Expand Down Expand Up @@ -268,7 +268,7 @@ diagnostic and progress messages."
;; Save the new locations and reload to regenerate variables.
(org-generic-id-locations-save)
(org-generic-id-locations-load)
(plist-put org-generic-id--last-update-id-time id-prop (current-time))
(org-generic-id--last-update-id-time-put id-prop (current-time))
(when (and (not silent) (> ndup 0))
(warn
"WARNING: %d duplicate :%s: properties found, check *Messages* buffer"
Expand Down Expand Up @@ -496,6 +496,20 @@ FILE-TO-BUF, whose format is documented at ‘org-generic-id--files’."
file-to-buf file buf)
buf))))

(defun org-generic-id--last-update-id-time-get (id-prop)
"Get last update ID time for ID-PROP.
ID-PROP is a string. This function converts ID-PROP to a symbol in order to
query ‘org-generic-id--last-update-id-time' using ‘plist-get’."
(plist-get org-generic-id--last-update-id-time (intern id-prop)))

(defun org-generic-id--last-update-id-time-put (id-prop time)
"Set last update ID time for ID-PROP to TIME.
ID-PROP is a string; TIME is an Emacs time value as returned by ‘encode-time’.
This function converts ID-PROP to a symbol in order to query
‘org-generic-id--last-update-id-time' using ‘plist-put’."
(plist-put org-generic-id--last-update-id-time
(intern id-prop) time))

(defun org-generic-id--files-find-file-hook ()
"Update ‘org-generic-id--files’ after a file is loaded."
(org-generic-id--files-buffer-hook-impl
Expand Down

0 comments on commit 8850fdf

Please sign in to comment.