emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christopher Allan Webber <cwebber@dustycloud.org>
To: emacs-orgmode@gnu.org
Subject: Patch to fix bug where remember template dies w/ non-filename buffer name
Date: Tue, 03 Nov 2009 19:28:24 -0600	[thread overview]
Message-ID: <87ljincc3r.fsf@dustycloud.org> (raw)

[-- 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

             reply	other threads:[~2009-11-04  1:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04  1:28 Christopher Allan Webber [this message]
2009-11-04 13:10 ` Patch to fix bug where remember template dies w/ non-filename buffer name Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ljincc3r.fsf@dustycloud.org \
    --to=cwebber@dustycloud.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).