Remove visibility cycling from general clock mapping function

It's only necessary when editing the buffer, not when only traversing it.  Moved
it to the only function where this is actually done, and added a comment to the
docstring of `timeline-tools-map-clocklines' to remind everyone that editing the
buffer through this function may yield funny surprises :)
This commit is contained in:
Daniel Borchmann 2020-01-10 18:12:50 +01:00
parent e966edd950
commit 9ab5d55237
Signed by: exot
GPG Key ID: 1C7071A75BB72D64

View File

@ -166,14 +166,13 @@ ending time as arguments and point on the beginning of the line.
For each headline, call HEADLINE-FN with no arguments and point For each headline, call HEADLINE-FN with no arguments and point
on the start of the headline. Traversal will be done from the on the start of the headline. Traversal will be done from the
end of the file upwards. If the buffer is narrowed, only this end of the file upwards. If the buffer is narrowed, only this
region will be traversed." region will be traversed. If either CLOCKLINE-FN or HEADLINE-FN
edit the current buffer, make sure to use `org-show-all' to show
all insivible elements; otherwise editing may result in
unpredictable behavior."
(unless (eq major-mode 'org-mode) (unless (eq major-mode 'org-mode)
(user-error "Not in Org mode buffer, cannot parse clocklines")) (user-error "Not in Org mode buffer, cannot parse clocklines"))
;; Make sure everything is visible, as otherwise editing may produce odd
;; results
(org-show-all)
(let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
org-clock-string org-clock-string
"[ \t]*\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)"))) "[ \t]*\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)")))
@ -642,6 +641,10 @@ clock line."
(new-end (float-time end))) (new-end (float-time end)))
(dolist (buffer buffers) (dolist (buffer buffers)
(with-current-buffer buffer (with-current-buffer buffer
;; Make sure everything is visible, as otherwise editing may produce odd
;; results
(org-show-all)
(timeline-tools-map-clocklines (timeline-tools-map-clocklines
(lambda (timestamp-1 timestamp-2) (lambda (timestamp-1 timestamp-2)
(let ((current-start (org-time-string-to-seconds timestamp-1)) (let ((current-start (org-time-string-to-seconds timestamp-1))