瀏覽代碼

Fix bug in org-remember.el

Adam Spiers writes:

> The code for handling %^{PROP}p in org-remember templates seems to
> have a bug:
>
> 	     ((equal char "p")
>              (edebug)
> 	      (let*
> 		  ((prop (org-substring-no-properties prompt))
> 		   (pall (concat prop "_ALL"))
> 		   (allowed
> 		    (with-current-buffer
> 			(get-buffer (file-name-nondirectory file))
>
> Here get-buffer can return nil, in which case `org-remember' fails
> with the error:
>
>  Wrong type argument: stringp, nil
>
> It seems to be assuming that the non-directory part of the filename
> corresponds to the buffer name, but this is not guaranteed.  Perhaps I
> noticed it because I am using uniquify.el ?
Carsten Dominik 15 年之前
父節點
當前提交
2ab3ed4c2f
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 5 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-remember.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-11-03  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-remember.el (org-remember-apply-template): Don't depend on
+	buffer name being like file name.
+
 2009-11-02  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-clock.el (org-clock-play-sound): Expand file in

+ 1 - 1
lisp/org-remember.el

@@ -588,7 +588,7 @@ to be run from that hook to function properly."
 		   (pall (concat prop "_ALL"))
 		   (allowed
 		    (with-current-buffer
-			(get-buffer (file-name-nondirectory file))
+			(or (find-buffer-visiting file) (current-buffer))
 		      (or (cdr (assoc pall org-file-properties))
 			  (cdr (assoc pall org-global-properties))
 			  (cdr (assoc pall org-global-properties-fixed)))))