Browse Source

Fixed premature deletion of data when scripting org-plot.

This patch was sent by James TD Smith.
Bastien Guerry 15 years ago
parent
commit
57838f8286
3 changed files with 7 additions and 4 deletions
  1. 3 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-plot.el
  3. 3 3
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -3,6 +3,9 @@
 	* org.el (org-tags-sort-function): New option for sorting tags.
 	(org-set-tags): Use the new option to sort tags.
 
+	* org-plot.el (org-plot/gnuplot): Run with an idle timer to avoid
+	premature deletion of the data when using org-plot in a script.
+
 2009-07-17  Bastien Guerry  <bzg@altern.org>
 
 	* org-clock.el (org-clock-in-prepare-hook): New hook.

+ 1 - 1
lisp/org-plot.el

@@ -346,7 +346,7 @@ line directly before or after the table."
 	(gnuplot-send-buffer-to-gnuplot))
       ;; cleanup
       (bury-buffer (get-buffer "*gnuplot*"))
-      (delete-file data-file))))
+      (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file))))))
 
 (provide 'org-plot)
 

+ 3 - 3
lisp/org.el

@@ -10849,9 +10849,9 @@ With prefix ARG, realign all tags in headings in the current buffer."
 	  (setq tags (replace-match ":" t t tags))))
 
       (if org-tags-sort-function
-	  (setq tags (mapconcat 'identity
-				(sort (org-split-string tags (org-re "[^[:alnum:]_@]+"))
-				      org-tags-sort-function) ":")))
+      	  (setq tags (mapconcat 'identity
+      				(sort (org-split-string tags (org-re "[^[:alnum:]_@]+"))
+      				      org-tags-sort-function) ":")))
 
       (if (string-match "\\`[\t ]*\\'" tags)
           (setq tags "")