Eric, > First off this looks great.
Thanks. > Rather than explicitly using the "/tmp" directory i would recommend > using the `make-temp-file' function, which should work across a wider > range of systems. Additionally if you need to get the directory from a > path, or combine a file-name and a directory name into a path I'd > recommend the `expand-file-name' and `file-name-directory' functions > respectively. > > With those change I would love to include this new feature into the main > blorgit repository. I tried to take your remarks into account as much as possible. I only changed "org-interaction.el". Here's the diff: --8<---------------cut here---------------start------------->8--- diff --git a/elisp/org-interaction.el b/elisp/org-interaction.el index 2311156..9b785e2 100644 --- a/elisp/org-interaction.el +++ b/elisp/org-interaction.el @@ -65,6 +65,31 @@ latex as a string." (write-file latex-path) (kill-buffer (current-buffer))))))) +(defun org-file-to-pdf (file-path) + "Open up an org file and export it as pdf." + (let* ((file-name (file-name-nondirectory file-path)) + (file-dir (file-name-directory file-path)) + (org-tmp-path (make-temp-file "org-file-to-pdf-")) + (pdf-tmp-path (concat org-tmp-path ".pdf")) + (tex-tmp-path (concat org-tmp-path ".tex")) + (pdf-path (expand-file-name (concat org-interaction-prefix file-name ".pdf") file-dir))) + (if (and (file-exists-p pdf-path) + (< 0 (time-to-seconds + (time-subtract + (nth 5 (file-attributes pdf-path)) + (nth 5 (file-attributes file-path)))))) + pdf-path + (with-temp-filebuffer + file-path + (write-file org-tmp-path) + (org-mode) + (save-window-excursion + (org-export-as-pdf nil) + (rename-file pdf-tmp-path pdf-path t) + (delete-file org-tmp-path) + (delete-file tex-tmp-path) + (kill-buffer (current-buffer))))))) + ;; customization (setq org-export-blocks-witheld '(hidden comment)) --8<---------------cut here---------------end--------------->8--- Is this better? Francesco _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode