Browse Source

org-export: Fix error when exporting buffers not visiting a file

* contrib/lisp/org-export.el (org-export-output-file-name): Do not
  return an error when exported buffer isn't visiting a file.
Nicolas Goaziou 5 years ago
parent
commit
00eaa4dc97
1 changed files with 2 additions and 1 deletions
  1. 2 1
      contrib/lisp/org-export.el

+ 2 - 1
contrib/lisp/org-export.el

@@ -2675,7 +2675,8 @@ determined."
 		    "EXPORT_FILE_NAME" t))
 	      ;; File name may be extracted from buffer's associated
 	      ;; file, if any.
-	      (file-name-nondirectory (buffer-file-name (buffer-base-buffer)))
+	      (let ((visited-file (buffer-file-name (buffer-base-buffer))))
+		(and visited-file (file-name-nondirectory visited-file)))
 	      ;; Can't determine file name on our own: Ask user.
 	      (let ((read-file-name-function
 		     (and org-completion-use-ido 'ido-read-file-name)))