org-export: Use relative path for target filenames

* contrib/lisp/org-export.el (org-export-output-file-name): Use
  relative path for target filenames.
This commit is contained in:
Nicolas Goaziou 2012-10-22 20:58:27 +02:00
parent 4dead66693
commit 9751dc4561
1 changed files with 5 additions and 6 deletions

View File

@ -2675,7 +2675,7 @@ determined."
"EXPORT_FILE_NAME" t)) "EXPORT_FILE_NAME" t))
;; File name may be extracted from buffer's associated ;; File name may be extracted from buffer's associated
;; file, if any. ;; file, if any.
(buffer-file-name (buffer-base-buffer)) (file-name-nondirectory (buffer-file-name (buffer-base-buffer)))
;; 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 (let ((read-file-name-function
(and org-completion-use-ido 'ido-read-file-name))) (and org-completion-use-ido 'ido-read-file-name)))
@ -2683,17 +2683,16 @@ determined."
"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))))))))
;; Build file name. Enforce EXTENSION over whatever user may have ;; Build file name. Enforce EXTENSION over whatever user may have
;; come up with. PUB-DIR, if defined, always has precedence over ;; come up with. PUB-DIR, if defined, always has precedence over
;; any provided path. ;; any provided path.
(cond (cond
(pub-dir (pub-dir
(concat (file-name-as-directory pub-dir) (concat (file-name-as-directory pub-dir)
(file-name-nondirectory base-name) (file-name-nondirectory base-name)
extension)) extension))
((string= (file-name-nondirectory base-name) base-name) ((file-name-absolute-p base-name) (concat base-name extension))
(concat (file-name-as-directory ".") base-name extension)) (t (concat (file-name-as-directory ".") base-name extension)))))
(t (concat base-name extension)))))
(defmacro org-export-with-current-buffer-copy (&rest body) (defmacro org-export-with-current-buffer-copy (&rest body)
"Apply BODY in a copy of the current buffer. "Apply BODY in a copy of the current buffer.