From mboxrd@z Thu Jan  1 00:00:00 1970
From: Adam Spiers <orgmode@adamspiers.org>
Subject: Re: inserting files within remember templates
Date: Tue, 6 Nov 2007 16:36:47 +0000
Message-ID: <20071106163647.GC13544@atlantic.linksys.moosehall>
References: <20071105181739.GB13544@atlantic.linksys.moosehall>
	<8A730AEC-45F4-4A2F-BD38-24DEBF937445@science.uva.nl>
Reply-To: Adam Spiers <orgmode@adamspiers.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1IpRQ5-0000hr-Pw
	for emacs-orgmode@gnu.org; Tue, 06 Nov 2007 11:36:53 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1IpRQ4-0000hO-Ap
	for emacs-orgmode@gnu.org; Tue, 06 Nov 2007 11:36:53 -0500
Received: from [199.232.76.173] (helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1IpRQ4-0000hH-0N
	for emacs-orgmode@gnu.org; Tue, 06 Nov 2007 11:36:52 -0500
Received: from mail.beimborn.com ([70.84.38.100])
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <f5-sendmail@adamspiers.org>) id 1IpRQ3-0004rn-S1
	for emacs-orgmode@gnu.org; Tue, 06 Nov 2007 11:36:52 -0500
Received: from mail.beimborn.com (localhost.localdomain [127.0.0.1])
	by mail.beimborn.com (8.12.11.20060308/8.12.8) with ESMTP id
	lA6GaoVd012332
	for <emacs-orgmode@gnu.org>; Tue, 6 Nov 2007 10:36:50 -0600
Received: from localhost (localhost [[UNIX: localhost]])
	by mail.beimborn.com (8.12.11.20060308/8.12.11/Submit) id
	lA6GaoIS012327
	for emacs-orgmode@gnu.org; Tue, 6 Nov 2007 16:36:50 GMT
Content-Disposition: inline
In-Reply-To: <8A730AEC-45F4-4A2F-BD38-24DEBF937445@science.uva.nl>
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=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: org-mode mailing list <emacs-orgmode@gnu.org>

On Tue, Nov 06, 2007 at 06:41:36AM +0100, Carsten Dominik wrote:
> Setting up remember mode runs a remember-mode-hook, you can use that.

That could be a workaround.

> I would be interested to know what kind of applications you have in mind
> when you want to include a file into a template, or execute elisp code.
> How about a few examples to persuade us that this is needed?

I want to integrate my use of mutt with org-mairix.el and remember.el.
Because mutt is an external application, I need some way of getting a
Message-Id which has been extracted from a message via a mutt helper
back into emacs.  Currently I do this by coding the helper to dump the
Message-Id into ~/.clip-mairix, and then the elisp code inserts the
contents of this file back into the org buffer.  However I would like
it to be inserted via a remember template, hence the request.  Calling
remember via emacsclient might possibly be an alternate way of
achieving the same thing, but I haven't thought about this yet.  If
one were to embed the text being passed from the mutt helper in the
CLI arguments to emacsclient, quoting might end up getting quite
hairy.  Allowing the remember template to extract the message id from
the environment via getenv might be a cleaner solution in that case.

That was the main use case, but I am sure people could think of
others.  Here is another one which is a bit silly but demonstrates the
point (and would be more conveniently invoked from within emacs than
via emacsclient): I have just started maintaining a journal of my
laptop's battery life to see whether it can be extended much by doing
full discharges more regularly.  So every day or two I want to log the
output of commands like:

  grep 'last full' /proc/acpi/battery/BAT0/info

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")
`------