summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-08-27 08:18:32 -0600
committerEric Schulte <schulte.eric@gmail.com>2010-08-27 08:18:32 -0600
commit2554f27683f03e699c7006a472d3814278a613d3 (patch)
treea38732bf29df62781c9f845ce0c0426b0afcf859
parent7be6f7e3d58c57b6b9b1dce0225f63e46de38ec2 (diff)
downloadorg-mode-2554f27683f03e699c7006a472d3814278a613d3.tar.gz
moved `org-save-outline-visibility' into org-macs.el
Thanks to Nick Dokos for pointing out this as a fix to a Babel issue * lisp/org-macs.el (org-save-outline-visibility): moved from org.el * lisp/org.el: moved `org-save-outline-visibility' to org-macs.el
-rw-r--r--lisp/org-macs.el19
-rw-r--r--lisp/org.el20
2 files changed, 19 insertions, 20 deletions
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 77527d2..8136ff4 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -290,6 +290,25 @@ This is in contrast to merely setting it to 0."
(match-beginning 0) string)))
(replace-match newtext fixedcase literal string))
+(defmacro org-save-outline-visibility (use-markers &rest body)
+ "Save and restore outline visibility around BODY.
+If USE-MARKERS is non-nil, use markers for the positions.
+This means that the buffer may change while running BODY,
+but it also means that the buffer should stay alive
+during the operation, because otherwise all these markers will
+point nowhere."
+ (declare (indent 1))
+ `(let ((data (org-outline-overlay-data ,use-markers)))
+ (unwind-protect
+ (progn
+ ,@body
+ (org-set-outline-overlay-data data))
+ (when ,use-markers
+ (mapc (lambda (c)
+ (and (markerp (car c)) (move-marker (car c) nil))
+ (and (markerp (cdr c)) (move-marker (cdr c) nil)))
+ data)))))
+
(defmacro org-with-limited-levels (&rest body)
"Execute BODY with limited number of outline levels."
`(let* ((outline-regexp (org-get-limited-outline-regexp)))
diff --git a/lisp/org.el b/lisp/org.el
index 0b69976..bc62633 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6255,26 +6255,6 @@ DATA should have been made by `org-outline-overlay-data'."
(overlay-put o 'invisible 'outline))
data)))))
-(defmacro org-save-outline-visibility (use-markers &rest body)
- "Save and restore outline visibility around BODY.
-If USE-MARKERS is non-nil, use markers for the positions.
-This means that the buffer may change while running BODY,
-but it also means that the buffer should stay alive
-during the operation, because otherwise all these markers will
-point nowhere."
- (declare (indent 1))
- `(let ((data (org-outline-overlay-data ,use-markers)))
- (unwind-protect
- (progn
- ,@body
- (org-set-outline-overlay-data data))
- (when ,use-markers
- (mapc (lambda (c)
- (and (markerp (car c)) (move-marker (car c) nil))
- (and (markerp (cdr c)) (move-marker (cdr c) nil)))
- data)))))
-
-
;;; Folding of blocks
(defconst org-block-regexp