Pārlūkot izejas kodu

Redefine the functions where XEmacs invisibility has to be turned off

Carsten Dominik 15 gadi atpakaļ
vecāks
revīzija
b65f1f9489
3 mainītis faili ar 25 papildinājumiem un 40 dzēšanām
  1. 5 0
      lisp/ChangeLog
  2. 20 39
      lisp/org-compat.el
  3. 0 1
      lisp/org-macs.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2010-04-18  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-compat.el (org-xemacs-without-invisibility): New macro.
+	(org-xemacs-without-invisibility): New macro.
+	(org-indent-to-column, org-indent-line-to, org-move-to-column):
+	Redefine using the macro `org-xemacs-without-invisibility'.
+
 	* org.el (org-mode, org-org-menu): Use `add-to-invisibility-spec'.
 
 	* org-table.el (orgtbl-mode): Use `add-to-invisibility-spec'.

+ 20 - 39
lisp/org-compat.el

@@ -126,6 +126,8 @@ If DELETE is non-nil, delete all those overlays."
           (if delete (delete-overlay ov) (push ov found))))
     found))
 
+;; Miscellaneous functions
+
 (defun org-add-hook (hook function &optional append local)
   "Add-hook, compatible with both Emacsen."
   (if (and local (featurep 'xemacs))
@@ -196,57 +198,36 @@ Works on both Emacs and XEmacs."
       (member arg buffer-invisibility-spec)
     nil))
 
+(defmacro org-xemacs-without-invisibility (&rest body)
+  "Turn off exents with invisibility while executing BODY."
+  `(let ((ext-inv (extent-list nil (point-at-bol) (point-at-eol)
+			       'all-extents-closed-open 'invisible))
+	 ext-inv-specs)
+     (dolist (ext ext-inv)
+       (when (extent-property ext 'invisible)
+	 (add-to-list 'ext-inv-specs (list ext (extent-property
+						ext 'invisible)))
+	 (set-extent-property ext 'invisible nil)))
+     ,@body
+     (dolist (ext-inv-spec ext-inv-specs)
+       (set-extent-property (car ext-inv-spec) 'invisible
+			    (cadr ext-inv-spec)))))
+
 (defun org-indent-to-column (column &optional minimum buffer)
   "Work around a bug with extents with invisibility in XEmacs."
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-		      nil (point-at-bol) (point-at-eol)
-		      'all-extents-closed-open 'invisible))
-	    ext-inv-specs)
-	(dolist (ext ext-inv)
-	  (when (extent-property ext 'invisible)
-	    (add-to-list 'ext-inv-specs (list ext (extent-property
-						   ext 'invisible)))
-	    (set-extent-property ext 'invisible nil)))
-	(indent-to-column column minimum buffer)
-	(dolist (ext-inv-spec ext-inv-specs)
-	  (set-extent-property (car ext-inv-spec) 'invisible
-			       (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (indent-to-column column minimum buffer))
     (indent-to-column column minimum)))
 
 (defun org-indent-line-to (column)
   "Work around a bug with extents with invisibility in XEmacs."
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-		      nil (point-at-bol) (point-at-eol)
-		      'all-extents-closed-open 'invisible))
-	    ext-inv-specs)
-	(dolist (ext ext-inv)
-	  (when (extent-property ext 'invisible)
-	    (add-to-list 'ext-inv-specs (list ext (extent-property
-						   ext 'invisible)))
-	    (set-extent-property ext 'invisible nil)))
-	(indent-line-to column)
-	(dolist (ext-inv-spec ext-inv-specs)
-	  (set-extent-property (car ext-inv-spec) 'invisible
-			       (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (indent-line-to column))
     (indent-line-to column)))
 
 (defun org-move-to-column (column &optional force buffer)
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-		      nil (point-at-bol) (point-at-eol)
-		      'all-extents-closed-open 'invisible))
-	    ext-inv-specs)
-	(dolist (ext ext-inv)
-	  (when (extent-property ext 'invisible)
-	    (add-to-list 'ext-inv-specs (list ext (extent-property ext
-								   'invisible)))
-	    (set-extent-property ext 'invisible nil)))
-	(move-to-column column force buffer)
-	(dolist (ext-inv-spec ext-inv-specs)
-	  (set-extent-property (car ext-inv-spec) 'invisible
-			       (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (move-to-column column force buffer))
     (move-to-column column force)))
 
 (defun org-get-x-clipboard-compat (value)

+ 0 - 1
lisp/org-macs.el

@@ -270,7 +270,6 @@ This is in contrast to merely setting it to 0."
       (setq plist (cddr plist)))
     p))
 
-
 (defun org-replace-match-keep-properties (newtext &optional fixedcase
 						  literal string)
   "Like `replace-match', but add the text properties found original text."