emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch to fix bug where remember template dies w/ non-filename buffer name
@ 2009-11-04  1:28 Christopher Allan Webber
  2009-11-04 13:10 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Allan Webber @ 2009-11-04  1:28 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-remember-fix.diff --]
[-- Type: text/x-diff, Size: 938 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Patch to fix bug where remember template dies w/ non-filename buffer name
  2009-11-04  1:28 Patch to fix bug where remember template dies w/ non-filename buffer name Christopher Allan Webber
@ 2009-11-04 13:10 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-11-04 13:10 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: emacs-orgmode

Applied, thanks.

- Carsten

On Nov 4, 2009, at 2:28 AM, Christopher Allan Webber wrote:

> 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
>
> <org-remember-fix.diff>_______________________________________________
> 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

- Carsten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-04 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-04  1:28 Patch to fix bug where remember template dies w/ non-filename buffer name Christopher Allan Webber
2009-11-04 13:10 ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).