소스 검색

Fix return value of `org-publish-find-title'.

My previous patch to remove buffers created just for retrieving the
page title did mess up the return value of this function.  This has
now been fixed.
Carsten Dominik 16 년 전
부모
커밋
cceb998feb
1개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 10 7
      lisp/org-publish.el

+ 10 - 7
lisp/org-publish.el

@@ -674,18 +674,21 @@ Default for INDEX-FILENAME is 'index.org'."
 (defun org-publish-find-title (file)
   "Find the title of file in project."
   (let* ((visiting (find-buffer-visiting file))
-	 (buffer (or visiting (find-file-noselect file))))
+	 (buffer (or visiting (find-file-noselect file)))
+	 title)
     (save-excursion
       (set-buffer buffer)
       (let* ((opt-plist (org-combine-plists (org-default-export-plist)
 					    (org-infile-export-plist))))
-	(or (plist-get opt-plist :title)
-	    (and (not
-		  (plist-get opt-plist :skip-before-1st-heading))
-		 (org-export-grab-title-from-buffer))
-	    (file-name-nondirectory (file-name-sans-extension file)))))
+	(setq title
+	      (or (plist-get opt-plist :title)
+		  (and (not
+			(plist-get opt-plist :skip-before-1st-heading))
+		       (org-export-grab-title-from-buffer))
+		  (file-name-nondirectory (file-name-sans-extension file))))))
     (unless visiting
-      (kill-buffer buffer))))
+      (kill-buffer buffer))
+    title))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Interactive publishing functions