浏览代码

ASCII export: Allow to export buffers without a file name

Carsten Dominik 15 年之前
父节点
当前提交
66c72c809b
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 3 0
      lisp/ChangeLog
  2. 4 2
      lisp/org-ascii.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2010-03-25  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-ascii.el (org-export-as-ascii): Catch the case of exporting
+	a buffer with no file name attached.
+
 	* org.el (org-log-refile): New option.
 	(org-log-note-headings): Add a heading for refiling.
 	(org-startup-options): Add keywords for logging of the refile

+ 4 - 2
lisp/org-ascii.el

@@ -227,8 +227,10 @@ publishing directory."
 		    (and (not
 			  (plist-get opt-plist :skip-before-1st-heading))
 			 (org-export-grab-title-from-buffer))
-		    (file-name-sans-extension
-		     (file-name-nondirectory bfname))))
+		    (and (buffer-file-name)
+			 (file-name-sans-extension
+			  (file-name-nondirectory bfname)))
+		    "UNTITLED"))
 	 (email (plist-get opt-plist :email))
 	 (language (plist-get opt-plist :language))
 	 (quote-re0 (concat "^[ \t]*" org-quote-string "\\>"))