summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-08-08 16:49:17 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2013-08-08 16:49:17 (GMT)
commitef2d475bf8c0995ae8a0ced2c5262f48ad547dad (patch)
tree2dfe629c7b95a5769a2576b00ec6c1f3e683a0ed
parent83b6cfcaec887ad9296f08f97e86e0ec69f73255 (diff)
parentc82cb4f75e42bb1d0eadd13f18967a17598b8d65 (diff)
downloadorg-mode-ef2d475bf8c0995ae8a0ced2c5262f48ad547dad.zip
org-mode-ef2d475bf8c0995ae8a0ced2c5262f48ad547dad.tar.gz
Merge branch 'maint'
Conflicts: lisp/ox.el
-rw-r--r--lisp/ox-publish.el81
-rw-r--r--lisp/ox.el30
2 files changed, 51 insertions, 60 deletions
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index db0ebae..73a160b 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -383,19 +383,19 @@ This splices all the components into the list."
(push p rtn)))
(nreverse (delete-dups (delq nil rtn)))))
-(defvar org-sitemap-sort-files)
-(defvar org-sitemap-sort-folders)
-(defvar org-sitemap-ignore-case)
-(defvar org-sitemap-requested)
-(defvar org-sitemap-date-format)
-(defvar org-sitemap-file-entry-format)
+(defvar org-publish-sitemap-sort-files)
+(defvar org-publish-sitemap-sort-folders)
+(defvar org-publish-sitemap-ignore-case)
+(defvar org-publish-sitemap-requested)
+(defvar org-publish-sitemap-date-format)
+(defvar org-publish-sitemap-file-entry-format)
(defun org-publish-compare-directory-files (a b)
"Predicate for `sort', that sorts folders and files for sitemap."
(let ((retval t))
- (when (or org-sitemap-sort-files org-sitemap-sort-folders)
+ (when (or org-publish-sitemap-sort-files org-publish-sitemap-sort-folders)
;; First we sort files:
- (when org-sitemap-sort-files
- (case org-sitemap-sort-files
+ (when org-publish-sitemap-sort-files
+ (case org-publish-sitemap-sort-files
(alphabetically
(let* ((adir (file-directory-p a))
(aorg (and (string-match "\\.org$" a) (not adir)))
@@ -405,7 +405,7 @@ This splices all the components into the list."
(org-publish-find-title a)) a))
(B (if borg (concat (file-name-directory b)
(org-publish-find-title b)) b)))
- (setq retval (if org-sitemap-ignore-case
+ (setq retval (if org-publish-sitemap-ignore-case
(not (string-lessp (upcase B) (upcase A)))
(not (string-lessp B A))))))
((anti-chronologically chronologically)
@@ -414,17 +414,17 @@ This splices all the components into the list."
(A (+ (lsh (car adate) 16) (cadr adate)))
(B (+ (lsh (car bdate) 16) (cadr bdate))))
(setq retval
- (if (eq org-sitemap-sort-files 'chronologically) (<= A B)
+ (if (eq org-publish-sitemap-sort-files 'chronologically) (<= A B)
(>= A B)))))))
;; Directory-wise wins:
- (when org-sitemap-sort-folders
+ (when org-publish-sitemap-sort-folders
;; a is directory, b not:
(cond
((and (file-directory-p a) (not (file-directory-p b)))
- (setq retval (equal org-sitemap-sort-folders 'first)))
+ (setq retval (equal org-publish-sitemap-sort-folders 'first)))
;; a is not a directory, but b is:
((and (not (file-directory-p a)) (file-directory-p b))
- (setq retval (equal org-sitemap-sort-folders 'last))))))
+ (setq retval (equal org-publish-sitemap-sort-folders 'last))))))
retval))
(defun org-publish-get-base-files-1
@@ -457,7 +457,7 @@ matching the regexp SKIP-DIR when recursing through BASE-DIR."
(or (file-directory-p file)
(and match (string-match match file))))
(directory-files base-dir t)))))
- (if (not org-sitemap-requested) all-files
+ (if (not org-publish-sitemap-requested) all-files
(sort all-files 'org-publish-compare-directory-files)))))
(defun org-publish-get-base-files (project &optional exclude-regexp)
@@ -472,15 +472,15 @@ matching filenames."
(extension (or (plist-get project-plist :base-extension) "org"))
;; sitemap-... variables are dynamically scoped for
;; org-publish-compare-directory-files:
- (org-sitemap-requested
+ (org-publish-sitemap-requested
(plist-get project-plist :auto-sitemap))
(sitemap-filename
(or (plist-get project-plist :sitemap-filename) "sitemap.org"))
- (org-sitemap-sort-folders
+ (org-publish-sitemap-sort-folders
(if (plist-member project-plist :sitemap-sort-folders)
(plist-get project-plist :sitemap-sort-folders)
org-publish-sitemap-sort-folders))
- (org-sitemap-sort-files
+ (org-publish-sitemap-sort-files
(cond ((plist-member project-plist :sitemap-sort-files)
(plist-get project-plist :sitemap-sort-files))
;; For backward compatibility:
@@ -488,18 +488,19 @@ matching filenames."
(if (plist-get project-plist :sitemap-alphabetically)
'alphabetically nil))
(t org-publish-sitemap-sort-files)))
- (org-sitemap-ignore-case
+ (org-publish-sitemap-ignore-case
(if (plist-member project-plist :sitemap-ignore-case)
(plist-get project-plist :sitemap-ignore-case)
org-publish-sitemap-sort-ignore-case))
(match (if (eq extension 'any) "^[^\\.]"
(concat "^[^\\.].*\\.\\(" extension "\\)$"))))
- ;; Make sure `org-sitemap-sort-folders' has an accepted value
- (unless (memq org-sitemap-sort-folders '(first last))
- (setq org-sitemap-sort-folders nil))
+ ;; Make sure `org-publish-sitemap-sort-folders' has an accepted
+ ;; value.
+ (unless (memq org-publish-sitemap-sort-folders '(first last))
+ (setq org-publish-sitemap-sort-folders nil))
(setq org-publish-temp-files nil)
- (if org-sitemap-requested
+ (if org-publish-sitemap-requested
(pushnew (expand-file-name (concat base-dir sitemap-filename))
org-publish-temp-files))
(org-publish-get-base-files-1 base-dir recurse match
@@ -678,10 +679,10 @@ If `:auto-sitemap' is set, publish the sitemap too. If
"sitemap.org"))
(sitemap-function (or (plist-get project-plist :sitemap-function)
'org-publish-org-sitemap))
- (org-sitemap-date-format
+ (org-publish-sitemap-date-format
(or (plist-get project-plist :sitemap-date-format)
org-publish-sitemap-date-format))
- (org-sitemap-file-entry-format
+ (org-publish-sitemap-file-entry-format
(or (plist-get project-plist :sitemap-file-entry-format)
org-publish-sitemap-file-entry-format))
(preparation-function
@@ -775,7 +776,7 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
;; This is common to 'flat and 'tree
(let ((entry
(org-publish-format-file-entry
- org-sitemap-file-entry-format file project-plist))
+ org-publish-sitemap-file-entry-format file project-plist))
(regexp "\\(.*\\)\\[\\([^][]+\\)\\]\\(.*\\)"))
(cond ((string-match-p regexp entry)
(string-match regexp entry)
@@ -791,11 +792,12 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(or visiting (kill-buffer sitemap-buffer))))
(defun org-publish-format-file-entry (fmt file project-plist)
- (format-spec fmt
- `((?t . ,(org-publish-find-title file t))
- (?d . ,(format-time-string org-sitemap-date-format
- (org-publish-find-date file)))
- (?a . ,(or (plist-get project-plist :author) user-full-name)))))
+ (format-spec
+ fmt
+ `((?t . ,(org-publish-find-title file t))
+ (?d . ,(format-time-string org-publish-sitemap-date-format
+ (org-publish-find-date file)))
+ (?a . ,(or (plist-get project-plist :author) user-full-name)))))
(defun org-publish-find-title (file &optional reset)
"Find the title of FILE in project."
@@ -803,17 +805,16 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(and (not reset) (org-publish-cache-get-file-property file :title nil t))
(let* ((org-inhibit-startup t)
(visiting (find-buffer-visiting file))
- (buffer (or visiting (find-file-noselect file)))
- title)
+ (buffer (or visiting (find-file-noselect file))))
(with-current-buffer buffer
(org-mode)
- (setq title
- (or (org-element-interpret-data
- (plist-get (org-export-get-environment) :title))
- (file-name-nondirectory (file-name-sans-extension file)))))
- (unless visiting (kill-buffer buffer))
- (org-publish-cache-set-file-property file :title title)
- title)))
+ (let ((title
+ (let ((property (plist-get (org-export-get-environment) :title)))
+ (if property (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)
+ title)))))
(defun org-publish-find-date (file)
"Find the date of FILE in project.
diff --git a/lisp/ox.el b/lisp/ox.el
index 2465555..9d5b69d 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -112,7 +112,7 @@
(:section-numbers nil "num" org-export-with-section-numbers)
(:select-tags "SELECT_TAGS" nil org-export-select-tags split)
(:time-stamp-file nil "timestamp" org-export-time-stamp-file)
- (:title "TITLE" nil org-export--default-title space)
+ (:title "TITLE" nil nil space)
(:with-archived-trees nil "arch" org-export-with-archived-trees)
(:with-author nil "author" org-export-with-author)
(:with-clocks nil "c" org-export-with-clocks)
@@ -1743,7 +1743,8 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
;; Return final value.
plist))))
;; Read options in the current buffer.
- (setq plist (funcall get-options buffer-file-name nil))
+ (setq plist (funcall get-options
+ (and buffer-file-name (list buffer-file-name)) nil))
;; Parse keywords specified in `org-element-document-properties'
;; and return PLIST.
(dolist (keyword org-element-document-properties plist)
@@ -1758,19 +1759,11 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(defun org-export--get-buffer-attributes ()
"Return properties related to buffer attributes, as a plist."
;; Store full path of input file name, or nil. For internal use.
- (list :input-file (buffer-file-name (buffer-base-buffer))))
-
-(defvar org-export--default-title nil) ; Dynamically scoped.
-(defun org-export-store-default-title ()
- "Return default title for current document, as a string.
-Title is extracted from associated file name, if any, or buffer's
-name."
- (setq org-export--default-title
- (or (let ((visited-file (buffer-file-name (buffer-base-buffer))))
- (and visited-file
+ (let ((visited-file (buffer-file-name (buffer-base-buffer))))
+ (list :input-file visited-file
+ :title (if (not visited-file) (buffer-name (buffer-base-buffer))
(file-name-sans-extension
- (file-name-nondirectory visited-file))))
- (buffer-name (buffer-base-buffer)))))
+ (file-name-nondirectory visited-file))))))
(defun org-export--get-global-options (&optional backend)
"Return global export options as a plist.
@@ -1783,8 +1776,9 @@ process."
(all (append (and backend (org-export-get-all-options backend))
org-export-options-alist)))
(dolist (cell all plist)
- (let ((prop (car cell)))
- (unless (plist-member plist prop)
+ (let ((prop (car cell))
+ (default-value (nth 3 cell)))
+ (unless (or (not default-value) (plist-member plist prop))
(setq plist
(plist-put
plist
@@ -2975,10 +2969,6 @@ Return code as a string."
(and body-only 'body-only))))
(org-export--get-buffer-attributes)))
tree)
- ;; Store default title in `org-export--default-title' so that
- ;; `org-export-get-environment' can access it from buffer's
- ;; copy and then add it properly to communication channel.
- (org-export-store-default-title)
;; Update communication channel and get parse tree. Buffer
;; isn't parsed directly. Instead, a temporary copy is
;; created, where include keywords, macros are expanded and