X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/18b35e2c7a3ff95fb4a07e58c3f57c70c65c0701..732fd4c7e11debd61c97eaaba3038d61e6ec7024:/lisp/org/ox-publish.el diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el index 67a57fa38f..f35df1b2a9 100644 --- a/lisp/org/ox-publish.el +++ b/lisp/org/ox-publish.el @@ -1,5 +1,5 @@ ;;; ox-publish.el --- Publish Related Org Mode Files as a Website -;; Copyright (C) 2006-2013 Free Software Foundation, Inc. +;; Copyright (C) 2006-2015 Free Software Foundation, Inc. ;; Author: David O'Toole ;; Maintainer: Carsten Dominik @@ -228,7 +228,7 @@ If you create a site-map file, adjust the sorting like this: `:sitemap-sort-files' The site map is normally sorted alphabetically. You can - change this behaviour setting this to `anti-chronologically', + change this behavior setting this to `anti-chronologically', `chronologically', or nil. `:sitemap-ignore-case' @@ -805,10 +805,16 @@ Default for SITEMAP-FILENAME is 'sitemap.org'." (visiting (find-buffer-visiting file)) (buffer (or visiting (find-file-noselect file)))) (with-current-buffer buffer - (org-mode) (let ((title - (let ((property (plist-get (org-export-get-environment) :title))) - (if property (org-element-interpret-data property) + (let ((property + (plist-get + ;; protect local variables in open buffers + (if visiting + (org-export-with-buffer-copy (org-export-get-environment)) + (org-export-get-environment)) + :title))) + (if property + (org-no-properties (org-element-interpret-data property)) (file-name-nondirectory (file-name-sans-extension file)))))) (unless visiting (kill-buffer buffer)) (org-publish-cache-set-file-property file :title title) @@ -821,12 +827,14 @@ If FILE is an Org file and provides a DATE keyword use it. In any other case use the file system's modification time. Return time in `current-time' format." (if (file-directory-p file) (nth 5 (file-attributes file)) - (let* ((visiting (find-buffer-visiting file)) + (let* ((org-inhibit-startup t) + (visiting (find-buffer-visiting file)) (file-buf (or visiting (find-file-noselect file nil))) (date (plist-get (with-current-buffer file-buf - (let ((org-inhibit-startup t)) (org-mode)) - (org-export-get-environment)) + (if visiting + (org-export-with-buffer-copy (org-export-get-environment)) + (org-export-get-environment))) :date))) (unless visiting (kill-buffer file-buf)) ;; DATE is either a timestamp object or a secondary string. If it @@ -873,7 +881,7 @@ publishing will be done asynchronously, in another process." ;; project is still a string here. (list (assoc project org-publish-project-alist))))) (if async - (org-export-async-start 'ignore + (org-export-async-start (lambda (results) nil) `(let ((org-publish-use-timestamps-flag (if ',force nil ,org-publish-use-timestamps-flag))) (org-publish-projects ',project-alist))) @@ -891,7 +899,7 @@ optional argument ASYNC, publishing will be done asynchronously, in another process." (interactive "P") (if async - (org-export-async-start 'ignore + (org-export-async-start (lambda (results) nil) `(progn (when ',force (org-publish-remove-all-timestamps)) (let ((org-publish-use-timestamps-flag @@ -913,7 +921,7 @@ asynchronously, in another process." (interactive "P") (let ((file (buffer-file-name (buffer-base-buffer)))) (if async - (org-export-async-start 'ignore + (org-export-async-start (lambda (results) nil) `(let ((org-publish-use-timestamps-flag (if ',force nil ,org-publish-use-timestamps-flag))) (org-publish-file ,file))) @@ -1072,7 +1080,7 @@ publishing directory." Return value is a list of numbers, or nil. This function allows to resolve external fuzzy links like: - [[file.org::*fuzzy][description]" + [[file.org::*fuzzy][description]]" (when org-publish-cache (cdr (assoc (org-split-string (if (eq (aref fuzzy 0) ?*) (substring fuzzy 1) fuzzy)) @@ -1225,8 +1233,9 @@ Returns value on success, else nil." (let ((attr (file-attributes (expand-file-name (or (file-symlink-p file) file) (file-name-directory file))))) - (+ (lsh (car (nth 5 attr)) 16) - (cadr (nth 5 attr))))) + (if (not attr) (error "No such file: \"%s\"" file) + (+ (lsh (car (nth 5 attr)) 16) + (cadr (nth 5 attr)))))) (provide 'ox-publish)