From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: mail agenda similar to `diary-mail-entries' Date: Sun, 10 Jun 2007 06:37:00 +0200 Message-ID: <37efcc2becf299377e9227ce37a5ee96@science.uva.nl> References: <87mz0645e7.fsf@pdrechsler.de> <34aed42135ad4a217118ca0168898606@science.uva.nl> <877iqc1z0f.fsf@pdrechsler.de> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HxFAr-0005iz-6J for emacs-orgmode@gnu.org; Sun, 10 Jun 2007 00:37:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HxFAq-0005iM-Gy for emacs-orgmode@gnu.org; Sun, 10 Jun 2007 00:37:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HxFAq-0005hx-7X for emacs-orgmode@gnu.org; Sun, 10 Jun 2007 00:37:08 -0400 Received: from korteweg.uva.nl ([146.50.98.70]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HxFAp-0001EH-Mn for emacs-orgmode@gnu.org; Sun, 10 Jun 2007 00:37:08 -0400 In-Reply-To: <877iqc1z0f.fsf@pdrechsler.de> 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: Patrick Drechsler Cc: emacs-orgmode@gnu.org On Jun 10, 2007, at 1:36, Patrick Drechsler wrote: > Carsten Dominik writes: > >> Untested: >> >> emacs -batch -l ~/.emacs -eval '(org-batch-agenda "a")' \ >> | mail user@address.com >> >> >> With (setq org-agenda-include-diary t), the diary will >> be part of the mailing automatically. > > I am very sorry for the late reply. > > Thank you Carsten for your script! > > The problem I am having with your approach is that `mail' requires a > full blown MTA. what is an MTA? > And since the diary script works fine with Emacs/Gnus > I was wondering if an approach along those lines might work, but to no > avail so far: > > 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)))) In the following two approach you are assuming that (org-batch-agenda "a") would *return* the agenda. It does not. Instead yu are trying to indert the return value of this function (don't even know what it would be...) into the agenda buffer, which is indeed read-only > > ;;; Test 2 > ;;; ERROR: > ;;; Buffer is read-only: # > ;; (defun org-mail () > ;; "Send mail of agenda to myself." > ;; (compose-mail diary-mail-addr "agenda") > ;; (insert (org-batch-agenda "a")) > ;; (call-interactively (get mail-user-agent 'sendfunc))) > Below the same problem as before... > ;;; Test 3: > ;;; ERROR: > ;;; Invalid header line (maybe a continuation line lacks initial > whitespace) > ;; (defun org-mail () > ;; "Send mail of agenda to myself." > ;; (compose-mail diary-mail-addr "agenda") > ;; (insert (org-agenda-list "a")) > ;; (call-interactively (get mail-user-agent 'sendfunc))) > --8<---------------cut here---------------end--------------->8--- Hope this helps. - Carsten