org-export: Default title doesn't overwrite a blank #+title keyword

* contrib/lisp/org-export.el (org-export-collect-options): Default
  title is retrieved before in-buffer settings are read.  Also, be
  more careful about indirect buffers.
This commit is contained in:
Nicolas Goaziou 2012-01-12 17:53:47 +01:00
parent a7389dff1e
commit 57f51dce5d
1 changed files with 8 additions and 10 deletions

View File

@ -843,6 +843,13 @@ settings."
(let ((options (org-combine-plists
;; ... from global variables...
(org-export-get-global-options backend)
;; ... from buffer's name (default title)...
`(:title
,(or (let ((file (buffer-file-name (buffer-base-buffer))))
(and file
(file-name-sans-extension
(file-name-nondirectory file))))
(buffer-name (buffer-base-buffer))))
;; ... from an external property list...
ext-plist
;; ... from in-buffer settings...
@ -854,16 +861,7 @@ settings."
(and subtreep
(org-export-get-subtree-options)))))
;; Add initial options.
(setq options (append (org-export-initial-options options)
options))
;; Set a default title if none has been specified so far.
(unless (plist-get options :title)
(setq options (plist-put options :title
(or (and buffer-file-name
(file-name-sans-extension
(file-name-nondirectory
buffer-file-name)))
(buffer-name)))))
(setq options (append (org-export-initial-options options) options))
;; Return plist.
options))