forked from mirrors/org-mode
ox: Small refactoring
* lisp/ox.el (org-export-output-file-name): Small refactoring.
This commit is contained in:
parent
b8f100c14a
commit
75c93f7c21
12
lisp/ox.el
12
lisp/ox.el
|
@ -5983,21 +5983,15 @@ Return file name as a string."
|
||||||
;; property, assuming point is at beginning of said
|
;; property, assuming point is at beginning of said
|
||||||
;; sub-tree.
|
;; sub-tree.
|
||||||
(file-name-sans-extension
|
(file-name-sans-extension
|
||||||
(or (and subtreep
|
(or (and subtreep (org-entry-get nil "EXPORT_FILE_NAME" 'selective))
|
||||||
(org-entry-get
|
|
||||||
(save-excursion
|
|
||||||
(ignore-errors (org-back-to-heading) (point)))
|
|
||||||
"EXPORT_FILE_NAME" 'selective))
|
|
||||||
;; File name may be extracted from buffer's associated
|
;; File name may be extracted from buffer's associated
|
||||||
;; file, if any.
|
;; file, if any.
|
||||||
(and visited-file (file-name-nondirectory visited-file))
|
(and visited-file (file-name-nondirectory visited-file))
|
||||||
;; Can't determine file name on our own: Ask user.
|
;; Can't determine file name on our own: Ask user.
|
||||||
(let ((read-file-name-function
|
|
||||||
(and org-completion-use-ido 'ido-read-file-name)))
|
|
||||||
(read-file-name
|
(read-file-name
|
||||||
"Output file: " pub-dir nil nil nil
|
"Output file: " pub-dir nil nil nil
|
||||||
(lambda (name)
|
(lambda (name)
|
||||||
(string= (file-name-extension name t) extension)))))))
|
(string= (file-name-extension name t) extension))))))
|
||||||
(output-file
|
(output-file
|
||||||
;; Build file name. Enforce EXTENSION over whatever user
|
;; Build file name. Enforce EXTENSION over whatever user
|
||||||
;; may have come up with. PUB-DIR, if defined, always has
|
;; may have come up with. PUB-DIR, if defined, always has
|
||||||
|
@ -6011,7 +6005,7 @@ Return file name as a string."
|
||||||
(t (concat (file-name-as-directory ".") base-name extension)))))
|
(t (concat (file-name-as-directory ".") base-name extension)))))
|
||||||
;; If writing to OUTPUT-FILE would overwrite original file, append
|
;; If writing to OUTPUT-FILE would overwrite original file, append
|
||||||
;; EXTENSION another time to final name.
|
;; EXTENSION another time to final name.
|
||||||
(if (and visited-file (org-file-equal-p visited-file output-file))
|
(if (and visited-file (file-equal-p visited-file output-file))
|
||||||
(concat output-file extension)
|
(concat output-file extension)
|
||||||
output-file)))
|
output-file)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue