Fix org mode category refresh when redisplaying timelines

Iterating over the current set of file names may not work when no files are
given (in which case all agenda files should be visisted).  However, instead of
fixing the set of files, it should be more robust to find all referenced buffers
by iterating over the markers of the entries.  In that case, even if a file is
visited by multiple buffers, we can be sure that the right buffers are referesh
before the timeline is redrawn.
Daniel Borchmann 1 year ago
parent 31e2067050
commit b952504c81
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
  1. 15

@ -474,6 +474,7 @@ current values of the relevant buffer local variables."
(if (not (eq major-mode 'timeline-tools-mode))
(user-error "Not in Timeline buffer")
(let ((timeline (timeline-tools-transform-timeline
(if force
@ -481,6 +482,17 @@ current values of the relevant buffer local variables."
;; Update categories in all affected buffers to retrieve up-to-date
;; information; find all relevant buffers by checking the markers of all
;; entries.
(dolist (buffer (->> timeline
(mapcar #'timeline-tools-entry-marker)
(mapcar #'marker-buffer)
(with-current-buffer buffer
(insert (format "* Timeline from [%s] to [%s]\n\n"
(format-time-string timeline-tools-headline-time-format
@ -563,9 +575,6 @@ as it is done by `timeline-tools-redraw-timeline'."
"Parse timeline from files again and redraw current display.
Updates category properties before constructing the new timeline."
(dolist (file timeline-tools--current-files)
(with-current-buffer (get-file-buffer file)
(timeline-tools-redraw-timeline 'force))
(defun timeline-tools-forward-day ()