Hi,

So I ran into an annoying bug where if you have an orgmode remember
template like:

        ("Test" ?e "* foo \n %^{Bar}p" "~/org/test.org" "Test")

Currently, if either test.org is not open, or test.org is open but the
buffer is named something else (say, test.org<2>), orgmode will die when
asking for the property (in this case, Bar).

The issue was that in the org-remember-apply-template function, it would
attempt to get the buffer like so:

  (get-buffer (file-name-nondirectory file))

in other words, it would try to get the buffer with the name of
"test.org"... no matter what that buffer was, if exists, or if it was
even called that.

I've attached a patch that fixes the problem.

Thanks,
 - Christopher Allan Webber

diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index ae83bec..193eaec 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -586,6 +586,8 @@ to be run from that hook to function properly."
 	      (let*
 		  ((prop (org-substring-no-properties prompt))
 		   (pall (concat prop "_ALL"))
+                   (file-buffer (or (find-buffer-visiting file)
+                                    (find-file-noselect file)))
 		   (allowed
 		    (with-current-buffer
 			(or (find-buffer-visiting file) (current-buffer))
@@ -593,7 +595,7 @@ to be run from that hook to function properly."
 			  (cdr (assoc pall org-global-properties))
 			  (cdr (assoc pall org-global-properties-fixed)))))
 		   (existing (with-current-buffer
-				 (get-buffer (file-name-nondirectory file))
+				 file-buffer
 			       (mapcar 'list (org-property-values prop))))
 		   (propprompt (concat "Value for " prop ": "))
 		   (val (if allowed
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to