Skip to content

Commit

Permalink
refactor: Make logbook-entry an alist instead of a plist
Browse files Browse the repository at this point in the history
This commit is a small workaround to make the TOML generation for
`logbook_notes` to work on Emacs 26.3 as well.

The plist worked fine too, but only on Emacs 27+. Using plist gives a
runtime error in map-do/seq-do code on Emacs 26.3. See
https://lists.gnu.org/r/help-gnu-emacs/2022-05/msg00022.html for
reference.
  • Loading branch information
kaushalmodi committed May 10, 2022
1 parent 78dd4d8 commit 4322236
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ox-hugo.el
Expand Up @@ -1771,7 +1771,7 @@ holding contextual information."
(ts-str (org-hugo--org-date-time-to-rfc3339 ts-raw-str info)))
;; (message "[ox-hugo logbook DBG] ts: %s, ts fmtd: %s"
;; ts-raw-str ts-str)
(setq logbook-entry (plist-put logbook-entry :timestamp ts-str)))
(push `(timestamp . ,ts-str) logbook-entry))
nil)
nil :first-match) ;Each 'paragraph element will have only one 'timestamp element

Expand All @@ -1793,20 +1793,20 @@ holding contextual information."
;; (message "[ox-hugo logbook DBG] state change : from %s to %s @ %s"
;; from-state to-state (plist-get logbook-entry :timestamp))
(when to-state
(setq logbook-entry (plist-put logbook-entry :to-state to-state)))
(push `(to_state . ,to-state) logbook-entry))
(when from-state
(setq logbook-entry (plist-put logbook-entry :from-state from-state)))))
(push `(from_state . ,from-state) logbook-entry))))
;; Parse (assq 'note org-log-note-headings)
((string-match "^Note taken on .*?\n\\(?1:\\(.\\|\n\\)*\\)" para-raw-str)
(let ((note (string-trim
(match-string-no-properties 1 para-raw-str))))
;; (message "[ox-hugo logbook DBG] note : %s @ %s"
;; note (plist-get logbook-entry :timestamp))
(setq logbook-entry (plist-put logbook-entry :note note))))
(push `(note . ,note) logbook-entry)))
(t
(user-error "LOGBOOK drawer entry is neither a state change, nor a note."))))
(when (plist-get logbook-entry :note)
(push logbook-entry logbook-notes))
(when (assoc 'note logbook-entry)
(push (nreverse logbook-entry) logbook-notes))
;; (message "[ox-hugo logbook DBG] logbook entry : %S" logbook-entry)
logbook-entry))
nil :first-match) ;Each 'item element will have only one 'paragraph element
Expand Down

0 comments on commit 4322236

Please sign in to comment.