emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/org/org-publish.el,v


From: Carsten Dominik
Subject: [Emacs-diffs] Changes to emacs/lisp/org/org-publish.el,v
Date: Sat, 25 Oct 2008 21:32:58 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Carsten Dominik <cdominik>      08/10/25 21:32:50

Index: lisp/org/org-publish.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-publish.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- lisp/org/org-publish.el     19 Oct 2008 10:21:06 -0000      1.9
+++ lisp/org/org-publish.el     25 Oct 2008 21:32:49 -0000      1.10
@@ -4,7 +4,7 @@
 ;; Author: David O'Toole <address@hidden>
 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: hypermedia, outlines, wp
-;; Version: 6.09a
+;; Version: 6.10c
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -276,8 +276,8 @@
   :group 'org-publish
   :type 'boolean)
 
-(defcustom org-publish-timestamp-directory
-  (convert-standard-filename "~/.org-timestamps/")
+(defcustom org-publish-timestamp-directory (convert-standard-filename 
+                                           "~/.org-timestamps/")
   "Name of directory in which to store publishing timestamps."
   :group 'org-publish
   :type 'directory)
@@ -479,23 +479,28 @@
   (require 'org)
   (unless (file-exists-p pub-dir)
     (make-directory pub-dir t))
-  (let* ((visiting (find-buffer-visiting filename))
-        (plist (cons :buffer-will-be-killed (cons t plist)))
-        (init-buf (or visiting (find-file filename)))
+  (let ((visiting (find-buffer-visiting filename)))
+    (save-excursion
+      (switch-to-buffer (or visiting (find-file filename)))
+      (let* ((plist (cons :buffer-will-be-killed (cons t plist)))
+            (init-buf (current-buffer))
         (init-point (point))
-        (init-buf-string (buffer-string)) export-buf)
+            (init-buf-string (buffer-string))
+            export-buf-or-file)
     ;; run hooks before exporting
     (run-hooks 'org-publish-before-export-hook)
     ;; export the possibly modified buffer
-    (setq export-buf
+       (setq export-buf-or-file
          (funcall (intern (concat "org-export-as-" format))
                   (plist-get plist :headline-levels)
                   nil plist nil nil pub-dir))
-    (set-buffer export-buf)
+       (when (and (bufferp export-buf-or-file)
+                  (buffer-live-p export-buf-or-file))
+         (set-buffer export-buf-or-file)
     ;; run hooks after export and save export
     (and (run-hooks 'org-publish-after-export-hook)
         (if (buffer-modified-p) (save-buffer)))
-    (kill-buffer export-buf)
+         (kill-buffer export-buf-or-file))
     ;; maybe restore buffer's content
     (set-buffer init-buf)
     (when (buffer-modified-p init-buf)
@@ -504,13 +509,18 @@
       (save-buffer)
       (goto-char init-point))
     (unless visiting
-      (kill-buffer init-buf))))
+         (kill-buffer init-buf))))))
 
 (defun org-publish-org-to-latex (plist filename pub-dir)
   "Publish an org file to LaTeX.
 See `org-publish-org-to' to the list of arguments."
   (org-publish-org-to "latex" plist filename pub-dir))
 
+(defun org-publish-org-to-pdf (plist filename pub-dir)
+  "Publish an org file to PDF (via LaTeX).
+See `org-publish-org-to' to the list of arguments."
+  (org-publish-org-to "pdf" plist filename pub-dir))
+
 (defun org-publish-org-to-html (plist filename pub-dir)
   "Publish an org file to HTML.
 See `org-publish-org-to' to the list of arguments."
@@ -667,6 +677,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Interactive publishing functions
 
+;;;###autoload
 (defalias 'org-publish-project 'org-publish)
 
 ;;;###autoload




reply via email to

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