changeset 109847:80192451ba34

Fix previous Org change. * org.el (org-outline-overlay-data, org-set-outline-overlay-data) (org-save-outline-visibility): Move to org-macs. * org-macs.el (org-outline-overlay-data, org-set-outline-overlay-data) (org-save-outline-visibility): Move here from org.el. (show-all): Autoload it. * ob.el: Don't require org when compiling.
author Glenn Morris <rgm@gnu.org>
date Wed, 18 Aug 2010 20:45:46 -0700
parents dce0738d09ef
children 637005c4c3ca
files lisp/org/ChangeLog lisp/org/ob.el lisp/org/org-macs.el lisp/org/org.el
diffstat 4 files changed, 70 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/org/ChangeLog	Thu Aug 19 01:25:36 2010 +0200
+++ b/lisp/org/ChangeLog	Wed Aug 18 20:45:46 2010 -0700
@@ -1,3 +1,12 @@
+2010-08-19  Glenn Morris  <rgm@gnu.org>
+
+	* org.el (org-outline-overlay-data, org-set-outline-overlay-data)
+	(org-save-outline-visibility): Move to org-macs.
+	* org-macs.el (org-outline-overlay-data, org-set-outline-overlay-data)
+	(org-save-outline-visibility): Move here from org.el.
+	(show-all): Autoload it.
+	* ob.el: Don't require org when compiling.
+
 2010-08-18  Glenn Morris  <rgm@gnu.org>
 
 	* ob.el: Require org when compiling.
--- a/lisp/org/ob.el	Thu Aug 19 01:25:36 2010 +0200
+++ b/lisp/org/ob.el	Wed Aug 18 20:45:46 2010 -0700
@@ -30,8 +30,7 @@
 
 ;;; Code:
 (eval-when-compile
-  (require 'cl)
-  (require 'org))                  ; org-save-outline-visibility macro
+  (require 'cl))
 (require 'org-macs)
 
 (defvar org-babel-call-process-region-original)
--- a/lisp/org/org-macs.el	Thu Aug 19 01:25:36 2010 +0200
+++ b/lisp/org/org-macs.el	Wed Aug 18 20:45:46 2010 -0700
@@ -300,6 +300,66 @@
 	   (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
       (format "\\*\\{1,%d\\} " nstars))))
 
+
+;;; Saving and restoring visibility
+
+(defun org-outline-overlay-data (&optional use-markers)
+  "Return a list of the locations of all outline overlays.
+The are overlays with the `invisible' property value `outline'.
+The return values is a list of cons cells, with start and stop
+positions for each overlay.
+If USE-MARKERS is set, return the positions as markers."
+  (let (beg end)
+    (save-excursion
+      (save-restriction
+	(widen)
+	(delq nil
+	      (mapcar (lambda (o)
+			(when (eq (overlay-get o 'invisible) 'outline)
+			  (setq beg (overlay-start o)
+				end (overlay-end o))
+			  (and beg end (> end beg)
+			       (if use-markers
+				   (cons (move-marker (make-marker) beg)
+					 (move-marker (make-marker) end))
+				 (cons beg end)))))
+		      (overlays-in (point-min) (point-max))))))))
+
+(autoload 'show-all "outline" nil t)
+
+(defun org-set-outline-overlay-data (data)
+  "Create visibility overlays for all positions in DATA.
+DATA should have been made by `org-outline-overlay-data'."
+  (let (o)
+    (save-excursion
+      (save-restriction
+	(widen)
+	(show-all)
+	(mapc (lambda (c)
+		(setq o (make-overlay (car c) (cdr c)))
+		(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)))))
+
+
 (provide 'org-macs)
 
 ;; arch-tag: 7e6a73ce-aac9-4fc0-9b30-ce6f89dc6668
--- a/lisp/org/org.el	Thu Aug 19 01:25:36 2010 +0200
+++ b/lisp/org/org.el	Wed Aug 18 20:45:46 2010 -0700
@@ -6190,62 +6190,6 @@
     (beginning-of-line)
     (recenter (prefix-numeric-value N))))
 
-;;; Saving and restoring visibility
-
-(defun org-outline-overlay-data (&optional use-markers)
-  "Return a list of the locations of all outline overlays.
-The are overlays with the `invisible' property value `outline'.
-The return values is a list of cons cells, with start and stop
-positions for each overlay.
-If USE-MARKERS is set, return the positions as markers."
-  (let (beg end)
-    (save-excursion
-      (save-restriction
-	(widen)
-	(delq nil
-	      (mapcar (lambda (o)
-			(when (eq (overlay-get o 'invisible) 'outline)
-			  (setq beg (overlay-start o)
-				end (overlay-end o))
-			  (and beg end (> end beg)
-			       (if use-markers
-				   (cons (move-marker (make-marker) beg)
-					 (move-marker (make-marker) end))
-				 (cons beg end)))))
-		      (overlays-in (point-min) (point-max))))))))
-
-(defun org-set-outline-overlay-data (data)
-  "Create visibility overlays for all positions in DATA.
-DATA should have been made by `org-outline-overlay-data'."
-  (let (o)
-    (save-excursion
-      (save-restriction
-	(widen)
-	(show-all)
-	(mapc (lambda (c)
-		(setq o (make-overlay (car c) (cdr c)))
-		(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