1: (defmacro org-save-outline-visibility (use-markers &rest body)
2: "Save and restore outline visibility around BODY.
3: If USE-MARKERS is non-nil, use markers for the positions.
4: This means that the buffer may change while running BODY,
5: but it also means that the buffer should stay alive
6: during the operation, because otherwise all these markers will
7: point nowhere."
8: (declare (debug (form body)) (indent 1))
9: (org-with-gensyms (data)
10: `(let ((,data (org-outline-overlay-data ,use-markers)))
12: (prog1 (progn ,@body)
13: (org-set-outline-overlay-data ,data))
14: (when ,use-markers
15: (dolist (c ,data)
16: (when (markerp (car c)) (move-marker (car c) nil))
17: (when (markerp (cdr c)) (move-marker (cdr c) nil))))))))
日付: 2018-08-09 Thu 13:14
Created: 2018-12-14 Fri 21:04