From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: inserting files within remember templates Date: Wed, 7 Nov 2007 09:42:55 +0100 Message-ID: <31C9500E-1350-48A8-9738-5C7EFC072AB0@science.uva.nl> References: <20071105181739.GB13544@atlantic.linksys.moosehall> <8A730AEC-45F4-4A2F-BD38-24DEBF937445@science.uva.nl> <20071106163647.GC13544@atlantic.linksys.moosehall> <20071106223950.GA6033@atlantic.linksys.moosehall> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IpgV6-0007Wb-OA for emacs-orgmode@gnu.org; Wed, 07 Nov 2007 03:43:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IpgV5-0007Vg-62 for emacs-orgmode@gnu.org; Wed, 07 Nov 2007 03:43:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IpgV5-0007Vd-0k for emacs-orgmode@gnu.org; Wed, 07 Nov 2007 03:43:03 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IpgV4-0007tt-Ao for emacs-orgmode@gnu.org; Wed, 07 Nov 2007 03:43:02 -0500 Received: from ug-out-1314.google.com ([66.249.92.168]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IpgV2-0008C4-Dg for emacs-orgmode@gnu.org; Wed, 07 Nov 2007 03:43:00 -0500 Received: by ug-out-1314.google.com with SMTP id a2so82857ugf for ; Wed, 07 Nov 2007 00:43:00 -0800 (PST) In-Reply-To: <20071106223950.GA6033@atlantic.linksys.moosehall> 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: Adam Spiers Cc: emacs-orgmode@gnu.org On 6Nov2007, at 11:39 PM, Adam Spiers wrote: > On Tue, Nov 06, 2007 at 04:36:47PM +0000, Adam Spiers wrote: > > [snip] > >> This could easily be accomplished if remember templates allowed >> syntax >> such as >> >> ,------ >> | * %T >> | %(shell-command-to-string "grep 'last full' /proc/acpi/battery/ >> BAT0/info") >> `------ > > OK, it turns out that this was easy to implement, and I think the > patch is small enough that it could be accepted even though I haven't > got around to sending back the copyright assignment form yet (sorry - > this *will* happen at some point!) I'll take this patch, thanks. - Carsten > > Diff against 5.13i: > > --- a/org.el Wed Oct 31 09:46:35 2007 +0000 > +++ b/org.el Tue Nov 06 22:30:13 2007 +0000 > @@ -12806,6 +12806,17 @@ to be run from that hook to fucntion pro > (replace-match > (or (eval (intern (concat "v-" (match-string 1)))) "") > t t)) > + ;; %() embedded elisp > + (goto-char (point-min)) > + (while (re-search-forward "%\\((.+)\\)" nil t) > + (goto-char (match-beginning 0)) > + (let ((template-start (point))) > + (forward-char 1) > + (condition-case error > + (let ((result (eval (read (current-buffer))))) > + (delete-region template-start (point)) > + (insert result)) > + (error (message "Error `%s' in remember template" > error))))) > ;; From the property list > (when plist-p > (goto-char (point-min)) > > > There might need to be some debate about how to handle read errors in > the case of invalid syntax. Or perhaps some people already have > `%(...)' within their remember templates for some really unusual > reason, and don't want it interpreted? Though in the latter case, one > could argue that it might make sense to require `%' always to be > escaped as `%%' if used literally, to be on the safe side. > > > _______________________________________________ > 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