emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: processing pending emails as part of your GTD  system
@ 2008-04-23 15:34 bva
  2008-04-24  3:38 ` Christopher League
  0 siblings, 1 reply; 8+ messages in thread
From: bva @ 2008-04-23 15:34 UTC (permalink / raw)
  To: emacs-orgmode


On 2008-04-23 Wed, at 14:05, emacs-orgmode-request@gnu.org wrote:

>
> Message: 3
> Date: Tue, 22 Apr 2008 12:55:55 -0400
> From: Christopher League <league@contrapunctus.net>
> Subject: Re: [Orgmode] processing pending emails as part of your GTD
> 	system
> To: org-mode mailing list <emacs-orgmode@gnu.org>
> Message-ID: <3D9B5F2E-A15C-45C6-AF49-8E0E62248936@contrapunctus.net>
> Content-Type: text/plain; charset="us-ascii"
>
>
> More relevant to org-mode, I have an emacs-lisp/apple-script combo for
> pasting links to Apple Mail messages into org files:
>
Wow.  Thank you very much for this.

I've tried to do something like this, but I'm a read-only coder.

I've been using Apple's Mail program since I got my first Mac 5 years  
ago, and only recently (since 2007-08) started using GTD and org- 
mode.  I've been very frustrated by some of the time-consuming choices  
I've made to keep Mail and 'projects.org' linked.

How did you know about this ``message://%3c%3e'' schema syntax!?  Is  
there anything else I can do to Mail from within Emacs (or from within  
Quicksilver {see footnote}).  Where can I read more! Is it safe to  
upgrade Mail (i.e. if I upgrade to OS X 10.666 will this script  
break?) It seems that the message is found even if I move it to  
another folder within Mail after generating the link; anything I need  
to be warned about?  I often have two message viewers open (one with  
mailboxes showing and one without, for easier filing {see footnote})  
-- how does your script (or Mail) choose which one is 'selected'?

That's a lot questions ... feel free to redirect me to a resource to  
read first instead of taking your time repeating well-known details of  
Mail's internals.  It's just that the Dictionary of Mail (in Script  
Editor) isn't very comprehensible to me.  I don't speak AppleScript.

Two issues with the the emacs-lisp and applescript.

1) Why doesn't the applescript work for the messages in the first  
folder I tried - my GTD folder?  Messages from the org-mode digest are  
automatically filed to "On My Mac" -> "Reference" -> "GHI" -> "GTD" to  
help keep my inbox clean.  But any message I try to run your script on  
gives me blank "id" properties.

Example: [[message://%3c%3e][Emacs-orgmode Digest, Vol 26, Issue 54]]

when I click on this link in my org-mode file, Mail generates an error  
dialog with the message "No associated application could be found."

Every other message in any other folder I've tried works fine. Strange.

2) The emacs-lisp code calls (yank) which doesn't grab text from the  
Apple Clipboard for me.  I am using "GNU Emacs 22.1.50.1 (powerpc- 
apple-darwin7.9.0, Carbon Version 1.6.0) of 2007-10-02 on  
applecore.inf.ed.ac.uk - Aquamacs Distribution 1.2a" and org-version  
5.23a.  Instead, I modified your code to use (cua-paste).

Now I've just got to figure out where to put this code!  Thank you  
ever so much!

-Ben

{footnote}
I've tried to select multiple messages in Mail and then use  
Quicksilver to re-file them all in one go.  I tested this (I thought)  
then spent hours creating a whole 'Reference' folder hierarchy.  But  
it just doesn't work! If I could find a way for the currently selected  
messages to be passed to Quicksilver AND also use quicksilver to  
select the folders (the search capabilities are great!) maybe I could  
cobble something together.

Right now, I've decided that spending time to automate this isn't  
worth the time saved.

{end footnote}

> (defun cal-grab-mail-links ()
>   (interactive)
>   (call-process "/usr/bin/osascript" nil t nil
>                 "/home/league/Library/Scripts/Applications/Mail/Copy
> Message for OrgMode.scpt")
>   (yank))
> (define-key org-mode-map "\C-cm" 'cal-grab-mail-links)
>
> ;;;;; and the .scpt component:
>
> -- Replace all occurences of one string for another in a text
> -- The trick here is to change the internal delimiter,
> -- spliting and joining the text
> --
> on replaceString(theText, oldString, newString)
> 	set AppleScript's text item delimiters to oldString
> 	set tempList to every text item of theText
> 	set AppleScript's text item delimiters to newString
> 	set theText to the tempList as string
> 	set AppleScript's text item delimiters to ""
> 	return theText
> end replaceString
>
> tell application "Mail"
> 	set _sel to get selection
> 	set _links to {}
> 	repeat with _msg in _sel
> 		set _subj to _msg's subject
> 		set _subj to my replaceString(_subj, "[", "(")
> 		set _subj to my replaceString(_subj, "]", ")")
> 		set _messageURL to "[[message://%3c" & _msg's message id & "%3e][" &
> _subj & "]]"
> 		set end of _links to _messageURL
> 	end repeat
> 	set AppleScript's text item delimiters to return
> 	set the clipboard to (_links as string)
> end tell
>

^ permalink raw reply	[flat|nested] 8+ messages in thread
* processing pending emails as part of your GTD system
@ 2008-04-21  6:55 Pete Phillips
  2008-04-22 16:55 ` Christopher League
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pete Phillips @ 2008-04-21  6:55 UTC (permalink / raw)
  To: org-mode mailing list


This post is slighly off-topic, as it is not directly about org-mode.

As many of you on the list will know, I'm a big fan of David Allen's GTD
system, and over the years I have tweaked my use of MH and MH-E to help
support this use.

One thing I have done is design a method so that I can easily put emails
into a set of 'pending' mail folders, and then get cron to process these
and dump the emails back into my +inbox at appropriate dates.

Having mentioned this on the MH-E list recently, someone asked if I
could share the scripts with them, so I have written this up here:

  http://ccgi.philfam.co.uk/wordpress/2008/04/20/24

I suspect you could extend this to any email system where you have
command line access to your email system. 

Hope you find this useful.
Pete

--
Pete Phillips, Acting Director,     |   http://www.smtl.co.uk/
Surgical Materials Testing Lab,     |   http://www.worldwidewounds.com/
Princess of Wales Hospital, S Wales |   http://www.dressings.org/
Tel/Fax: +44 1656-752820/30         |   pete@smtl.co.uk

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-05-03 21:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23 15:34 processing pending emails as part of your GTD system bva
2008-04-24  3:38 ` Christopher League
  -- strict thread matches above, loose matches on Subject: below --
2008-04-21  6:55 Pete Phillips
2008-04-22 16:55 ` Christopher League
2008-04-23 19:25 ` Erik Hetzner
2008-04-30 21:25 ` Adam Spiers
2008-05-01  6:32   ` Carsten Dominik
2008-05-03 21:32     ` Adam Spiers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).