File docutils-0.6-insecure-temp.patch of Package docutils

Index: docutils-0.6/tools/editors/emacs/rst.el
===================================================================
--- docutils-0.6.orig/tools/editors/emacs/rst.el
+++ docutils-0.6/tools/editors/emacs/rst.el
@@ -3301,13 +3301,31 @@ of the entire buffer, if the region is n
      (cadr (assq 'pseudoxml rst-compile-toolsets))
      standard-output)))
 
+(defvar rst-temp-dir nil)
+(make-variable-buffer-local 'rst-temp-dir)
+
+(defun rst-get-temp-dir ()
+  (or rst-temp-dir
+    (setq rst-temp-dir 
+      (file-name-as-directory (make-temp-file "rst-" t))
+    )
+  )
+)
+
+(defun rst-remove-temp-dir ()
+  (require 'dired)
+  (if rst-temp-dir (dired-delete-file rst-temp-dir 'always))
+)
+
+(add-hook 'kill-buffer-hook 'rst-remove-temp-dir)
+
 (defvar rst-pdf-program "xpdf"
   "Program used to preview PDF files.")
 
 (defun rst-compile-pdf-preview ()
   "Convert the document to a PDF file and launch a preview program."
   (interactive)
-  (let* ((tmp-filename "/tmp/out.pdf")
+  (let* ((tmp-filename (concat (rst-get-temp-dir) "out.pdf"))
 	 (command (format "%s %s %s && %s %s"
 			  (cadr (assq 'pdf rst-compile-toolsets))
 			  buffer-file-name tmp-filename
@@ -3323,7 +3341,7 @@ of the entire buffer, if the region is n
 (defun rst-compile-slides-preview ()
   "Convert the document to an S5 slide presentation and launch a preview program."
   (interactive)
-  (let* ((tmp-filename "/tmp/slides.html")
+  (let* ((tmp-filename (concat (rst-get-temp-dir) "slides.html"))
 	 (command (format "%s %s %s && %s %s"
 			  (cadr (assq 's5 rst-compile-toolsets))
 			  buffer-file-name tmp-filename
openSUSE Build Service is sponsored by