emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [PATCH] Move definition of macro org-save-outline-visibility f


From: Nick Dokos
Subject: [Orgmode] [PATCH] Move definition of macro org-save-outline-visibility from org.el to org-macs.el.
Date: Thu, 19 Aug 2010 11:26:12 -0400

It is used by ob.el so it has to be in a file that is require'd by ob.el,
otherwise compiling it leads to problems: the compiler thinks it's a
function it hasn't seen, so when it tries to call it, it fails.

Another solution would be to (require 'org) in ob.el.

Reported-by: Austin Frank, ref: 
http://thread.gmane.org/gmane.emacs.orgmode/28048

Signed-off-by: Nick Dokos <address@hidden>
---
 lisp/org-macs.el |   22 ++++++++++++++++++++++
 lisp/org.el      |   20 --------------------
 2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 77527d2..918dd46 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -307,6 +307,28 @@ The number of levels is controlled by 
`org-inlinetask-min-level'"
           (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
       (format "\\*\\{1,%d\\} " nstars))))
 
+;;; moved here from org.el so that ob.el can use it too.
+(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
diff --git a/lisp/org.el b/lisp/org.el
index 31d2411..0e1d191 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6247,26 +6247,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
-- 
1.7.2.1.95.g3d045.dirty




reply via email to

[Prev in Thread] Current Thread [Next in Thread]