From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Allan Webber Subject: Patch to fix bug where remember template dies w/ non-filename buffer name Date: Tue, 03 Nov 2009 19:28:24 -0600 Message-ID: <87ljincc3r.fsf@dustycloud.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N5UfX-0004A9-Ri for emacs-orgmode@gnu.org; Tue, 03 Nov 2009 20:28:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N5UfW-00049N-Iv for emacs-orgmode@gnu.org; Tue, 03 Nov 2009 20:28:15 -0500 Received: from [199.232.76.173] (port=54446 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5UfW-000495-9g for emacs-orgmode@gnu.org; Tue, 03 Nov 2009 20:28:14 -0500 Received: from li28-75.members.linode.com ([75.127.72.75]:37336) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N5UfW-0006Dv-09 for emacs-orgmode@gnu.org; Tue, 03 Nov 2009 20:28:14 -0500 Received: from grumps (localhost [127.0.0.1]) by li28-75.members.linode.com (Postfix) with ESMTP id D6417C571 for ; Wed, 4 Nov 2009 01:28:12 +0000 (UTC) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-remember-fix.diff 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--