From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Salazar Subject: Re: Sending and archiving emails with capture... Date: Thu, 15 Mar 2012 17:44:47 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d04428e5c37487c04bb4f00ae Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8ITu-0006hY-P6 for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 17:45:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8ITZ-0008Mo-Ut for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 17:45:10 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:60030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8ITZ-0008MQ-Fn for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 17:44:49 -0400 Received: by werj55 with SMTP id j55so4308723wer.0 for ; Thu, 15 Mar 2012 14:44:47 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jos'h Fuller Cc: emacs-orgmode@gnu.org --f46d04428e5c37487c04bb4f00ae Content-Type: text/plain; charset=ISO-8859-1 Amazing. I tried it and I get "Heading not found on level 1: Emails" I must missing a step? On Thu, Mar 15, 2012 at 5:22 PM, Jos'h Fuller < Jos'h.Fuller@arcproductions.com> wrote: > > Hi! > > Assuming I've got everything set up correctly and this email makes it > to the list, this is in response to Alan E. Davis' question about > sending an email from Emacs and saving a copy in org-mode. > > I make the assumption here that your Emacs is set up to properly send > emails using the ~mail~ command. Also note that my > ~org-capture-templates~ setup has more than just an email template. > > Install the lines below just after your org-mode install. > > To use: > > - Invoke org-capture from any buffer with C-cc. > - Choose the Mail template ([m] key). > - Enter the recipient's address, then [enter]. > - Enter the mail subject, then [enter]. > - Your cursor is positioned at the start of the email. > - Write your email. > - C-c C-c sends it on its way! > > This is very crude and could certainly be improved. However, perhaps > it's a reasonable starting point! > > Jos'h > > > -- snip! > -------------------------------------------------------------------- > > ;; Capture Setup > > (setq org-capture-templates > (quote > (("m" "Mail" entry (file+olp org-default-notes-file "Emails") "** > Email %T > From: Your Name > To: %^{Send mail to} > Subject: %^{Subject} > --text follows this line-- > %? > > > _______________________________________________________________________________ > > This is a signature...") > ("t" "todo" entry (file org-default-notes-file) > "* TODO %?\n%U\n%a\n %i" :clock-in t :clock-resume t) > ("n" "note" entry (file org-default-notes-file) > "* %? :NOTE:\n%U\n%a\n %i" :clock-in t :clock-resume t) > ("h" "Habit" entry (file org-default-notes-file) > "* NEXT %?\n%U\n%a\nSCHEDULED: %t .+1d/3d\n:PROPERTIES:\n:STYLE: > habit\n:REPEAT_TO_STATE: NEXT\n:END:\n %i")))) > > (defun my-finalize-capture () > "This is run from the org-capture-before-finalize hook just > before the indirect buffer is closed. > > If the current local capture is a 'Mail' message, I extract it > and send it on it's way. Because I am cautious, I extract the > text from the org buffer and put it into a private temporary > buffer before sending it as an email. > > This may not be the best way to do this..." > > (message "* Running custom finalize hook...") > > (if (string= "Mail" (org-capture-get :description)) > (save-excursion > (goto-char (org-capture-get :begin-marker t)) > (next-line) ; Skip past org slug line. > (let* ((msg (buffer-substring (point) (org-capture-get :end-marker > t)))) > (with-temp-buffer > (insert msg) > (mail-send) > )) > )) > ) > > (add-hook 'org-capture-before-finalize-hook 'my-finalize-capture) > > (define-key global-map "\C-cc" 'org-capture) > > > _______________________________________________________________________________ > > Jos'h Fuller, Production Programmer > > Arc Productions Ltd. > > p: 416.682.5237 | f: 416.682.5209 | > http://www.arcproductions.com > 230 Richmond Street East | Toronto, ON M5A 1P4 | > > --f46d04428e5c37487c04bb4f00ae Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Amazing.=A0

I tried it and I get "Heading not found= on level 1: Emails"

I must missing a step?


On Thu, Mar 15, 2012= at 5:22 PM, Jos'h Fuller <Jos'h.Fuller@arcproductions.com> wrote:

Hi!

Assuming I've got everything set up correctly and this email makes it to the list, this is in response to Alan E. Davis' question about
sending an email from Emacs and saving a copy in org-mode.

I make the assumption here that your Emacs is set up to properly send
emails using the ~mail~ command. Also note that my
~org-capture-templates~ setup has more than just an email template.

Install the lines below just after your org-mode install.

To use:

=A0- Invoke org-capture from any buffer with C-cc.
=A0- Choose the Mail template ([m] key).
=A0- Enter the recipient's address, then [enter].
=A0- Enter the mail subject, then [enter].
=A0- Your cursor is positioned at the start of the email.
=A0- Write your email.
=A0- C-c C-c sends it on its way!

This is very crude and could certainly be improved. However, perhaps
it's a reasonable starting point!

Jos'h


-- snip! ------------------------------------------------------------------= --

;; Capture Setup

(setq org-capture-templates
=A0 =A0 =A0(quote
=A0 =A0 =A0 (("m" "Mail" entry (file+olp org-default-n= otes-file "Emails") "** Email %T
From: Your Name <yourname@yo= urcompany.com>
To: %^{Send mail to}
Subject: %^{Subject}
--text follows this line--
%?

___________________________________________________________________________= ____

This is a signature...")
=A0 =A0 =A0 =A0("t" "todo" entry (file org-default-not= es-file)
=A0 =A0 =A0 =A0 "* TODO %?\n%U\n%a\n =A0%i" :clock-in t :clock-r= esume t)
=A0 =A0 =A0 =A0("n" "note" entry (file org-default-not= es-file)
=A0 =A0 =A0 =A0 "* %? :NOTE:\n%U\n%a\n =A0%i" :clock-in t :clock= -resume t)
=A0 =A0 =A0 =A0("h" "Habit" entry (file org-default-no= tes-file)
=A0 =A0 =A0 =A0 "* NEXT %?\n%U\n%a\nSCHEDULED: %t .+1d/3d\n:PROPERTIE= S:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n =A0%i"))))

(defun my-finalize-capture ()
=A0"This is run from the org-capture-before-finalize hook just
before the indirect buffer is closed.

If the current local capture is a 'Mail' message, I extract it
and send it on it's way. Because I am cautious, I extract the
text from the org buffer and put it into a private temporary
buffer before sending it as an email.

This may not be the best way to do this..."

=A0(message "* Running custom finalize hook...")

=A0(if (string=3D "Mail" (org-capture-get :description))
=A0 =A0 =A0(save-excursion
=A0 =A0 =A0 =A0(goto-char (org-capture-get :begin-marker t))
=A0 =A0 =A0 =A0(next-line) ; Skip past org slug line.
=A0 =A0 =A0 =A0(let* ((msg (buffer-substring (point) (org-capture-get :end= -marker t))))
=A0 =A0 =A0 =A0 =A0 =A0 =A0(with-temp-buffer
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(insert msg)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(mail-send)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0))
=A0 =A0 =A0 =A0))
)

(add-hook 'org-capture-before-finalize-hook 'my-finalize-capture)
(define-key global-map "\C-cc" 'org-capture)

___________________________________________________________________________= ____

Jos'h Fuller, Production Programmer

Arc Productions Ltd.

p: 416.682.5237 =A0= =A0 =A0 =A0 =A0| f: 41= 6.682.5209 =A0 =A0 | http://www.arcproductions.com
230 Richmond Street East | Toronto, ON M5A 1P4 |


--f46d04428e5c37487c04bb4f00ae--