From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick Drechsler Subject: Re: mail agenda similar to `diary-mail-entries' Date: Mon, 11 Jun 2007 13:10:45 +0200 Message-ID: <873b0ylpai.fsf@pdrechsler.de> References: <87mz0645e7.fsf@pdrechsler.de> <34aed42135ad4a217118ca0168898606@science.uva.nl> <877iqc1z0f.fsf@pdrechsler.de> <37efcc2becf299377e9227ce37a5ee96@science.uva.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hxhn0-0001pt-Hi for emacs-orgmode@gnu.org; Mon, 11 Jun 2007 07:10:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hxhmx-0001ph-W1 for emacs-orgmode@gnu.org; Mon, 11 Jun 2007 07:10:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hxhmx-0001pe-S3 for emacs-orgmode@gnu.org; Mon, 11 Jun 2007 07:10:23 -0400 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Hxhmx-0006Zg-DH for emacs-orgmode@gnu.org; Mon, 11 Jun 2007 07:10:23 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Hxhmn-0003wh-5R for emacs-orgmode@gnu.org; Mon, 11 Jun 2007 13:10:13 +0200 Received: from dslb-088-065-081-129.pools.arcor-ip.net ([88.65.81.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Jun 2007 13:10:13 +0200 Received: from patrick by dslb-088-065-081-129.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Jun 2007 13:10:13 +0200 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 Carsten Dominik writes: > On Jun 10, 2007, at 1:36, Patrick Drechsler wrote: > >> Carsten Dominik writes: [...] >> Here is the script I a trying to use: >> >> --8<---------------cut here---------------start------------->8--- >> emacs \ >> --batch \ >> --load ~/.emacs.d/init.el \ >> --load ~/.emacs.d/.gnus \ >> --funcall org-mail >> --8<---------------cut here---------------end--------------->8--- >> >> >> And I have tried this in my ~/.emacs (well, actually >> ~/.emacs.d/init.el, but that should not make a difference): >> >> --8<---------------cut here---------------start------------->8--- >> ;;; Test 1: this sends a message, but only replicates the header in the >> ;;; body. The actual body (the agenda) is not present. >> ;; (defun org-mail () >> ;; "Send mail of agenda to myself." >> ;; (org-batch-agenda "a") >> ;; (compose-mail diary-mail-addr "agenda") >> ;; (insert (buffer-string)) >> ;; (call-interactively (get mail-user-agent 'sendfunc))) > > > When you do `(insert (buffer-string))', then you are already in the > mail buffer, so indeed you are only duplocating the content of the > mail buffer. You need to do something like this: > > (defun org-mail () > "Send mail of agenda to myself." > (org-batch-agenda "a") > (let ((str (buffer-string))) > (compose-mail diary-mail-addr "agenda") > (insert str) > (call-interactively (get mail-user-agent 'sendfunc)))) Thank you very much Carsten! Works like a charm! I also appreciate you taking the time to explain why my Lisp snipplets didn't work. Cheers, Patrick -- "Statistics are like bikinis. What they reveal is suggestive, but what they conceal is vital" --Aaron Levenstein