emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Mail files in org
@ 2008-08-28 14:54 Charles Howard
  2008-08-28 14:58 ` Russell Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Charles Howard @ 2008-08-28 14:54 UTC (permalink / raw)
  To: emacs-orgmode


Is it possible to structure a large collection of emails in an org file ? Are there any specific tools for doing this ?

I have used pine for many years but the business of categorizing sensibly into folders the hundreds of mails which 
come each week is out of hand. Googlemail is offering a single file of emails, with (multiple) `tabs' replacing
the functionality of folders. This seems like a great step forward, but I don't like GUIs, and I'm not happy that on 
googlemail it seems not to be possible to download an email to disk with header information. (And I don't want all
my emails permanently on someone else's server.)

Maybe this has been thought of already, but I can't see it anywhere. I've never used mail under emacs (though I've used
emacs for about 12 years). 

What I have in mind is a single text file containing (say) one year's 10^5 emails. I could go through attaching tabs, 
TODO notes, draft replies, rude remarks, tags, ... able to open a specific category ...

If I'm reinventing the wheel, please don't be too harsh. 

Chas
_________________________________________________________________
Win New York holidays with Kellogg’s & Live Search
http://clk.atdmt.com/UKM/go/107571440/direct/01/

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

* Re: Mail files in org
  2008-08-28 14:54 Mail files in org Charles Howard
@ 2008-08-28 14:58 ` Russell Adams
  2008-08-28 15:10   ` Richard G Riley
  2008-08-29  7:31   ` Taru Karttunen
  0 siblings, 2 replies; 14+ messages in thread
From: Russell Adams @ 2008-08-28 14:58 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Aug 28, 2008 at 02:54:22PM +0000, Charles Howard wrote:
> 
> Is it possible to structure a large collection of emails in an org file ? Are there any specific tools for doing this ?
> 
> I have used pine for many years but the business of categorizing sensibly into folders the hundreds of mails which 
> come each week is out of hand. Googlemail is offering a single file of emails, with (multiple) `tabs' replacing
> the functionality of folders. This seems like a great step forward, but I don't like GUIs, and I'm not happy that on 
> googlemail it seems not to be possible to download an email to disk with header information. (And I don't want all
> my emails permanently on someone else's server.)
> 
> Maybe this has been thought of already, but I can't see it anywhere. I've never used mail under emacs (though I've used
> emacs for about 12 years). 
> 
> What I have in mind is a single text file containing (say) one year's 10^5 emails. I could go through attaching tabs, 
> TODO notes, draft replies, rude remarks, tags, ... able to open a specific category ...
> 
> If I'm reinventing the wheel, please don't be too harsh. 

Between Mutt and Mairix I use maildir (one message per file) and
searching to meet my needs.

I'd like to follow up on putting a message ID link in org to open
emails though.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

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

* Re: Mail files in org
  2008-08-28 14:58 ` Russell Adams
@ 2008-08-28 15:10   ` Richard G Riley
  2008-08-28 15:38     ` Russell Adams
  2008-08-28 15:53     ` Bernt Hansen
  2008-08-29  7:31   ` Taru Karttunen
  1 sibling, 2 replies; 14+ messages in thread
From: Richard G Riley @ 2008-08-28 15:10 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Thu, Aug 28, 2008 at 02:54:22PM +0000, Charles Howard wrote:
>> 
>> Is it possible to structure a large collection of emails in an org file ? Are there any specific tools for doing this ?
>> 
>> I have used pine for many years but the business of categorizing sensibly into folders the hundreds of mails which 
>> come each week is out of hand. Googlemail is offering a single file of emails, with (multiple) `tabs' replacing
>> the functionality of folders. This seems like a great step forward, but I don't like GUIs, and I'm not happy that on 
>> googlemail it seems not to be possible to download an email to disk with header information. (And I don't want all
>> my emails permanently on someone else's server.)
>> 
>> Maybe this has been thought of already, but I can't see it anywhere. I've never used mail under emacs (though I've used
>> emacs for about 12 years). 
>> 
>> What I have in mind is a single text file containing (say) one year's 10^5 emails. I could go through attaching tabs, 
>> TODO notes, draft replies, rude remarks, tags, ... able to open a specific category ...
>> 
>> If I'm reinventing the wheel, please don't be too harsh. 
>
> Between Mutt and Mairix I use maildir (one message per file) and
> searching to meet my needs.
>
> I'd like to follow up on putting a message ID link in org to open
> emails though.

This already works if you use Gnus.

>
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

-- 

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

* Re: Mail files in org
  2008-08-28 15:10   ` Richard G Riley
@ 2008-08-28 15:38     ` Russell Adams
  2008-08-28 15:44       ` Paul R
  2008-08-28 15:45       ` Richard G Riley
  2008-08-28 15:53     ` Bernt Hansen
  1 sibling, 2 replies; 14+ messages in thread
From: Russell Adams @ 2008-08-28 15:38 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Aug 28, 2008 at 05:10:46PM +0200, Richard G Riley wrote:
> 
> This already works if you use Gnus.

I adore emacs, but I haven't been sold into it for mail. I used Pine a
decade ago, and moved to Mutt. I like its interface and maildir
support.

I haven't compared it to Gnus in a while, but I'd prefer to just link
to a message than change clients.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

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

* Re: Mail files in org
  2008-08-28 15:38     ` Russell Adams
@ 2008-08-28 15:44       ` Paul R
  2008-08-28 15:45       ` Richard G Riley
  1 sibling, 0 replies; 14+ messages in thread
From: Paul R @ 2008-08-28 15:44 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, 28 Aug 2008 10:38:27 -0500, Russell Adams <RLAdams@AdamsInfoServ.Com> said:

Russell> I adore emacs, but I haven't been sold into it for mail.

Just like emacs, Gnus sucks. And just like emacs, it sucks much less
than alternatives.

-- 
  Paul

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

* Re: Mail files in org
  2008-08-28 15:38     ` Russell Adams
  2008-08-28 15:44       ` Paul R
@ 2008-08-28 15:45       ` Richard G Riley
  2008-08-28 16:07         ` Russell Adams
  1 sibling, 1 reply; 14+ messages in thread
From: Richard G Riley @ 2008-08-28 15:45 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Thu, Aug 28, 2008 at 05:10:46PM +0200, Richard G Riley wrote:
>> 
>> This already works if you use Gnus.
>
> I adore emacs, but I haven't been sold into it for mail. I used Pine a
> decade ago, and moved to Mutt. I like its interface and maildir
> support.

Gnus supports maildir too although recently I moved to an IMAP server
which accesses the maildir format created with procmail on my mail
server.


I did use Mutt for a while but being an emacs user I took the plunge and
went Gnus and never looked back. All the things you are familiar with
integrate nicely (flyspell, org-mode etc). And, of course, Gnus merges
the concept of usenet and email which is great when you get it all
sorted out and configured to your liking. But now its starting to sound
like I am pimping  Gnus. But as an emacs user I would recommend you take
the plunge again and retry Gnus.

>
> I haven't compared it to Gnus in a while, but I'd prefer to just link
> to a message than change clients.

:-;

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

* Re: Mail files in org
  2008-08-28 15:10   ` Richard G Riley
  2008-08-28 15:38     ` Russell Adams
@ 2008-08-28 15:53     ` Bernt Hansen
  2008-08-28 16:07       ` Richard G Riley
  1 sibling, 1 reply; 14+ messages in thread
From: Bernt Hansen @ 2008-08-28 15:53 UTC (permalink / raw)
  To: Richard G Riley; +Cc: emacs-orgmode

Richard G Riley <rileyrgdev@googlemail.com> writes:

> Russell Adams <RLAdams@AdamsInfoServ.Com> writes:
>
>> On Thu, Aug 28, 2008 at 02:54:22PM +0000, Charles Howard wrote:
>>
>> Between Mutt and Mairix I use maildir (one message per file) and
>> searching to meet my needs.
>>
>> I'd like to follow up on putting a message ID link in org to open
>> emails though.
>
> This already works if you use Gnus.

It does?  Can I convert to using message ids somehow?

I'm using Gnus with a local IMAP server (not maildir or Mairix).  All of
my Gnus links are regular folder and article number links.

My Gnus links look like this:

,----
| [[gnus:INBOX.SomeFolder#1053][description of mail goes here]]
`----

I am assuming a message ID link would use the

,----
| Message-ID: <jiljyh9nux.fsf@googlemail.com>
`----

part of the email instead of INBOX.SomeFolder#1053 in the example above.

I don't want email storage on a single local machine because I need
access to my mail from multiple systems and when I'm away with Internet
connectivity -- and using IMAP Works For Me(tm).

Manually synching my 5GB+ of email between multiple systems isn't
something I want to take on at this time.

-Bernt

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

* Re: Mail files in org
  2008-08-28 15:53     ` Bernt Hansen
@ 2008-08-28 16:07       ` Richard G Riley
  2008-08-28 16:11         ` Bernt Hansen
  0 siblings, 1 reply; 14+ messages in thread
From: Richard G Riley @ 2008-08-28 16:07 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Richard G Riley


Bernt Hansen <bernt@norang.ca> writes:

> Richard G Riley <rileyrgdev@googlemail.com> writes:
>
>> Russell Adams <RLAdams@AdamsInfoServ.Com> writes:
>>
>>> On Thu, Aug 28, 2008 at 02:54:22PM +0000, Charles Howard wrote:
>>>
>>> Between Mutt and Mairix I use maildir (one message per file) and
>>> searching to meet my needs.
>>>
>>> I'd like to follow up on putting a message ID link in org to open
>>> emails though.
>>
>> This already works if you use Gnus.
>
> It does?  Can I convert to using message ids somehow?

Allow me to slap my own forehead. Sorry. I was talking about links to
gnus accessed mail. Although since gnus has a fetch by ID function I
guess its not too hard to do?

>
> I'm using Gnus with a local IMAP server (not maildir or Mairix).  All of
> my Gnus links are regular folder and article number links.
>
> My Gnus links look like this:
>
> ,----
> | [[gnus:INBOX.SomeFolder#1053][description of mail goes here]]
> `----
>
> I am assuming a message ID link would use the
>
> ,----
> | Message-ID: <jiljyh9nux.fsf@googlemail.com>
> `----
>
> part of the email instead of INBOX.SomeFolder#1053 in the example above.
>
> I don't want email storage on a single local machine because I need
> access to my mail from multiple systems and when I'm away with Internet
> connectivity -- and using IMAP Works For Me(tm).
>
> Manually synching my 5GB+ of email between multiple systems isn't
> something I want to take on at this time.

Apologies - I was wrong. I do not link using msgid.

>
> -Bernt

-- 

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

* Re: Mail files in org
  2008-08-28 15:45       ` Richard G Riley
@ 2008-08-28 16:07         ` Russell Adams
  2008-08-28 19:52           ` Richard G Riley
  0 siblings, 1 reply; 14+ messages in thread
From: Russell Adams @ 2008-08-28 16:07 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Aug 28, 2008 at 05:45:38PM +0200, Richard G Riley wrote:
> 
> Gnus supports maildir too although recently I moved to an IMAP server
> which accesses the maildir format created with procmail on my mail
> server.
> 

I've recently reorganized my folders to be served up by Dovecot so I
can access my maildir inside VM with Thunderbird. A great hack, and
Mutt compatible!

> I did use Mutt for a while but being an emacs user I took the plunge and
> went Gnus and never looked back. All the things you are familiar with
> integrate nicely (flyspell, org-mode etc). And, of course, Gnus merges
> the concept of usenet and email which is great when you get it all
> sorted out and configured to your liking. But now its starting to sound
> like I am pimping  Gnus. But as an emacs user I would recommend you take
> the plunge again and retry Gnus.

I don't do usenet, and I use emacs as the message editor for Mutt. I
do use BBDB with Mutt via LBDB.

Perhaps I should review Gnus again, any good references or screenshots
of it in operation?


------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

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

* Re: Mail files in org
  2008-08-28 16:07       ` Richard G Riley
@ 2008-08-28 16:11         ` Bernt Hansen
  0 siblings, 0 replies; 14+ messages in thread
From: Bernt Hansen @ 2008-08-28 16:11 UTC (permalink / raw)
  To: Richard G Riley; +Cc: emacs-orgmode

Richard G Riley <rileyrgdev@googlemail.com> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> Richard G Riley <rileyrgdev@googlemail.com> writes:
>>
>>> Russell Adams <RLAdams@AdamsInfoServ.Com> writes:
>>>
>>>> On Thu, Aug 28, 2008 at 02:54:22PM +0000, Charles Howard wrote:
>>>>

<snip>

>>>> I'd like to follow up on putting a message ID link in org to open
>>>> emails though.
>>>
>>> This already works if you use Gnus.
>>
>> It does?  Can I convert to using message ids somehow?
>
> Allow me to slap my own forehead. Sorry. I was talking about links to
> gnus accessed mail. Although since gnus has a fetch by ID function I
> guess its not too hard to do?

<snip>
>
> Apologies - I was wrong. I do not link using msgid.

Thanks for clarifying this.

-Bernt

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

* Re: Mail files in org
  2008-08-28 16:07         ` Russell Adams
@ 2008-08-28 19:52           ` Richard G Riley
  2008-08-29  9:03             ` Tim O'Callaghan
  0 siblings, 1 reply; 14+ messages in thread
From: Richard G Riley @ 2008-08-28 19:52 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Thu, Aug 28, 2008 at 05:45:38PM +0200, Richard G Riley wrote:
>> 
>> Gnus supports maildir too although recently I moved to an IMAP server
>> which accesses the maildir format created with procmail on my mail
>> server.
>> 
>
> I've recently reorganized my folders to be served up by Dovecot so I
> can access my maildir inside VM with Thunderbird. A great hack, and
> Mutt compatible!
>
>> I did use Mutt for a while but being an emacs user I took the plunge and
>> went Gnus and never looked back. All the things you are familiar with
>> integrate nicely (flyspell, org-mode etc). And, of course, Gnus merges
>> the concept of usenet and email which is great when you get it all
>> sorted out and configured to your liking. But now its starting to sound
>> like I am pimping  Gnus. But as an emacs user I would recommend you take
>> the plunge again and retry Gnus.
>
> I don't do usenet, and I use emacs as the message editor for Mutt. I
> do use BBDB with Mutt via LBDB.
>
> Perhaps I should review Gnus again, any good references or screenshots
> of it in operation?

One little picture here showing email and usenet groups with group
specific colouring and then content highlighting with non empty folders.

http://richardriley.net/default/projects/images/gnus_scr.png

and a link to my .gnus here

http://richardriley.net/default/projects/emacs/

Using the built in help function on that files contents would be a big
help I think.

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

* Re: Mail files in org
  2008-08-28 14:58 ` Russell Adams
  2008-08-28 15:10   ` Richard G Riley
@ 2008-08-29  7:31   ` Taru Karttunen
  1 sibling, 0 replies; 14+ messages in thread
From: Taru Karttunen @ 2008-08-29  7:31 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

On 28.08 09:58, Russell Adams wrote:
> I'd like to follow up on putting a message ID link in org to open
> emails though.

This works with mutt and a suitable version of org-mairix (attached).
And a .emacs configuration (needs to be customized) like:

(require 'org-mairix)
(setq org-mairix-mutt-display-command "urxvt -title 'mairix search: %search%' -e mutt -f ~/mail/mairix -e \"push <display-message>\" &"
      org-mairix-display-hook 'org-mairix-mutt-display-results)


- Taru Karttunen

[-- Attachment #2: org-mairix.el --]
[-- Type: text/plain, Size: 13642 bytes --]

;;; org-mairix.el - Support for hooking mairix search into Org for different MUAs
;;
;; Copyright (C) 2007 Georg C. F. Greve
;; mutt support by Adam Spiers <orgmode at adamspiers dot org>
;;
;; Author: Georg C. F. Greve <greve at fsfeurope dot org>
;; Keywords: outlines, hypermedia, calendar, wp, email, mairix
;; Purpose: Integrate mairix email searching into Org mode
;; See http://orgmode.org and http://www.rpcurnow.force9.co.uk/mairix/
;; Version: 0.5
;;
;; This file is Free Software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; It is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
;; License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; USAGE NOTE
;;
;; You will need to configure mairix first, which involves setting up your
;; .mairixrc in your home directory. Once it is working, you should set up
;; your way to display results in your favorite way -- usually a MUA.
;; Currently gnus and mutt are supported.
;;
;; After both steps are done, all you should need to hook mairix, org
;; and your MUA together is to do (require 'org-mairix) in your
;; startup file. Everything can then be configured normally through
;; Emacs customisation.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'org)

;;; The custom variables

(defgroup org-mairix nil
  "Mairix support/integration in org."
  :tag "Org Mairix"
  :group 'org)

(defcustom org-mairix-threaded-links t
  "Should new links be created as threaded links?
If t, links will be stored as threaded searches.
If nil, links will be stored as non-threaded searches."
  :group 'org-mairix
  :type 'boolean)

(defcustom org-mairix-augmented-links nil
  "Should new links be created as augmenting searches?
If t, links will be stored as augmenting searches.
If nil, links will be stored as normal searches.

Attention: When activating this option, you will need
to remove old articles from your mairix results group
in some other way, mairix will not do it for you."
  :group 'org-mairix
  :type 'boolean)

(defcustom org-mairix-display-hook 'org-mairix-gnus-display-results
  "Hook to call to display the results of a successful mairix search.
Defaults to Gnus, feel free to add your own MUAs or methods."
  :group 'org-mairix
  :type 'hook)

(defcustom org-mairix-open-command "mairix %args% '%search%'"
  "The mairix command-line to use. If your paths are set up
correctly, you should not need to change this.

'%search%' will get substituted with the search expression, and
'%args%' with any additional arguments."
  :group 'org-mairix
  :type 'string)

;;; The hooks to integrate mairix into org

(org-add-link-type "mairix" 'org-mairix-open)
(add-hook 'org-store-link-functions 'org-mairix-store-gnus-link)

;;; Generic org-mairix functions

(defun org-mairix-construct-link (message-id)
  "Construct a mairix: hyperlink based on message-id."
  (concat "mairix:"
          (if org-mairix-threaded-links "t:")
          (if org-mairix-augmented-links "a:")
          "@@"
          (org-remove-angle-brackets message-id)))

(defun org-store-mairix-link-props (&rest plist)
  "Take a property list describing a mail, and add mairix link
and description properties so that org can build a mairix link to
it."
  ;; We have to call `org-store-link-props' twice:
  ;;
  ;;   - It extracts 'fromname'/'fromaddress' from 'from' property,
  ;;     and stores the updated plist to `org-store-link-plist'.
  ;;
  ;;   - `org-email-link-description' uses these new properties to
  ;;     build a description from the previously stored plist.  I
  ;;     wrote a tiny patch to `org-email-link-description' so it
  ;;     could take a non-stored plist as an optional 2nd argument,
  ;;     but the plist provided still needs 'fromname'/'fromaddress'.
  ;;
  ;;   - Ideally we would decouple the storing bit of
  ;;     `org-store-link-props' from the extraction bit, but lots of
  ;;     stuff in `org-store-link' which calls it would need to be
  ;;     changed.  Maybe just factor out the extraction so it can be
  ;;     reused separately?
  (let ((mid (plist-get plist :message-id)))
    (apply 'org-store-link-props
           (append plist
                   (list :type "mairix"
                         :link (org-mairix-construct-link mid))))
    (apply 'org-store-link-props
           (append org-store-link-plist
                   (list :description (org-email-link-description))))))

(defun org-mairix-message-send-and-exit-with-link ()
  "Function that can be assigned as an alternative sending function,
it sends the message and then stores a mairix link to it before burying
the buffer just like 'message-send-and-exit' does."
  (interactive)
  (message-send)
  (let* ((message-id (message-fetch-field "Message-Id"))
         (subject (message-fetch-field "Subject"))
         (link (org-mairix-construct-link message-id))
         (desc (concat "Email: '" subject "'")))
    (setq org-stored-links
          (cons (list link desc) org-stored-links)))
  (message-bury (current-buffer)))

(defun org-mairix-open (search)
  "Function to open mairix link.

We first need to split it into its individual parts, and then
extract the message-id to be passed on to the display function
before call mairix, evaluate the number of matches returned, and
make sure to only call display of mairix succeeded in matching."
  (let* ((args ""))
    (if (equal (substring search 0 2) "t:" )
        (progn (setq search (substring search 2 nil))
               (setq args (concat args " --threads"))))
    (if (equal (substring search 0 2) "a:")
        (progn (setq search (substring search 2 nil))
               (setq args (concat args " --augment"))))
    (let ((cmdline (org-mairix-command-substitution
                    org-mairix-open-command search args)))
      (print cmdline)
      (setq retval (shell-command-to-string cmdline))
      (string-match "\[0-9\]+" retval)
      (setq matches (string-to-number (match-string 0 retval)))
      (if (eq matches 0) (message "Link failed: no matches, sorry")
        (message "Link returned %d matches" matches)
        (run-hook-with-args 'org-mairix-display-hook search args)))))

(defun org-mairix-command-substitution (cmd search args)
  "Substitute '%search%' and '%args% in mairix search command."
  (while (string-match "%search%" cmd)
    (setq cmd (replace-match search 'fixedcase 'literal cmd)))
  (while (string-match "%args%" cmd)
    (setq cmd (replace-match args 'fixedcase 'literal cmd)))
  cmd)

;;; Functions necessary for integration of external MUAs.

;; Of course we cannot call `org-store-link' from within an external
;; MUA, so we need some other way of storing a link for later
;; retrieval by org-mode and/or remember-mode.  To do this we use a
;; temporary file as a kind of dedicated clipboard.

(defcustom org-mairix-link-clipboard "~/.org-mairix-link"
  "Pseudo-clipboard file where mairix URLs get copied to by external
applications in order to mimic `org-store-link'.  Used by
`org-mairix-insert-link'."
  :group 'org-mairix
  :type 'string)

;; When we resolve some of the issues with `org-store-link' detailed
;; at <http://thread.gmane.org/gmane.emacs.orgmode/4217/focus=4635>,
;; we might not need org-mairix-insert-link.

(defun org-mairix-insert-link ()
  "Insert link from file defined by `org-mairix-link-clipboard'."
  (interactive)
  (let ((bytes (cadr (insert-file-contents
                      (expand-file-name org-mairix-link-clipboard)))))
    (forward-char bytes)
    (save-excursion
      (forward-char -1)
      (if (looking-at "\n")
          (delete-char 1)))))

;;; Functions necessary for mutt integration

(defgroup org-mairix-mutt nil
  "Use mutt for mairix support in org."
  :tag "Org Mairix Mutt"
  :group 'org-mairix)

(defcustom org-mairix-mutt-display-command
  "xterm -title 'mairix search: %search%' -e 'unset COLUMNS; mutt -f 
~/mail/mairix -e \"push <display-message>\"' &"
  "Command to execute to display mairix search results via mutt within
an xterm.

'%search%' will get substituted with the search expression, and
'%args%' with any additional arguments used in the search."
  :group 'org-mairix-mutt
  :type 'string)

(defun org-mairix-mutt-display-results (search args)
  "Display results of mairix search in mutt, using the command line
defined in `org-mairix-mutt-display-command'."
  ;; By default, async `shell-command' invocations display the temp
  ;; buffer, which is annoying here.  We choose a deterministic
  ;; buffer name so we can hide it again immediately.
  ;; Note: `call-process' is synchronous so not useful here.
  (let ((cmd (org-mairix-command-substitution
              org-mairix-mutt-display-command search args))
        (tmpbufname (generate-new-buffer-name " *mairix-view*")))
    (shell-command cmd tmpbufname)
    (delete-windows-on (get-buffer tmpbufname))))

;;; Functions necessary for gnus integration

(defgroup org-mairix-gnus nil
  "Use gnus for mairix support in org."
  :tag "Org Mairix Gnus"
  :group 'org-mairix)

(defcustom org-mairix-gnus-results-group "nnmaildir:mairix"
  "The group that is configured to hold the mairix search results,
which needs to be setup independently of the org-mairix integration,
along with general mairix configuration."
  :group 'org-mairix-gnus
  :type 'string)

(defcustom org-mairix-gnus-select-display-group-function 
'org-mairix-gnus-select-display-group-function-gg
  "Hook to call to select the group that contains the matching articles.
We should not need this, it is owed to a problem of gnus that people were
not yet able to figure out, see
 http://article.gmane.org/gmane.emacs.gnus.general/65248
 http://article.gmane.org/gmane.emacs.gnus.general/65265
 http://article.gmane.org/gmane.emacs.gnus.user/9596
for reference.

It seems gnus needs a 'forget/ignore everything you think you
know about that group' function. Volunteers?"
  :group 'org-mairix-gnus
  :type 'hook)

(defun org-mairix-store-gnus-link ()
  "Store a link to the current gnus message as a Mairix search for its
Message ID."

  ;; gnus integration
  (when (memq major-mode '(gnus-summary-mode gnus-article-mode))
    (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary))
    (let* ((article (gnus-summary-article-number))
           (header (gnus-summary-article-header article))
           (from (mail-header-from header))
           (message-id (mail-header-id header))
           (subject (gnus-summary-subject-string)))
      (org-store-mairix-link-props :from from
                                   :subject subject
                                   :message-id message-id))))

(defun org-mairix-gnus-display-results (search args)
  "Display results of mairix search in Gnus.

Note: This does not work as cleanly as I would like it to. The
problem being that Gnus should simply reread the group cleanly,
without remembering anything. At the moment it seems to be unable
to do that -- so you're likely to see zombies floating around.

If you can improve this, please do!"
  (if (not (equal (substring search 0 2) "m:" ))
      (error "org-mairix-gnus-display-results: display of search other than 
message-id not implemented yet"))
  (setq message-id (substring search 2 nil))
  (require 'gnus)
  (require 'gnus-sum)
  ;; FIXME: (bzg/gg) We might need to make sure gnus is running here,
  ;;        and to start it in case it isn't running already. Does
  ;;        anyone know a function to do that? It seems main org mode
  ;;        does not do this, either.
  (funcall (cdr (assq 'gnus org-link-frame-setup)))
  (if gnus-other-frame-object (select-frame gnus-other-frame-object))

  ;; FIXME: This is horribly broken. Please see
  ;;  http://article.gmane.org/gmane.emacs.gnus.general/65248
  ;;  http://article.gmane.org/gmane.emacs.gnus.general/65265
  ;;  http://article.gmane.org/gmane.emacs.gnus.user/9596
  ;; for reference.
  ;;
  ;; It seems gnus needs a "forget/ignore everything you think you
  ;; know about that group" function. Volunteers?
  ;;
  ;; For now different methods seem to work differently well for
  ;; different people. So we're playing hook-selection here to make
  ;; it easy to play around until we found a proper solution.
  (run-hook-with-args 'org-mairix-gnus-select-display-group-function)
  (gnus-summary-select-article
   nil t t (car (gnus-find-matching-articles "message-id" message-id))))

(defun org-mairix-gnus-select-display-group-function-gg ()
  "Georg's hack to select a group that gnus (falsely) believes to be
empty to then call rebuilding of the summary. It leaves zombies of
old searches around, though."
  (gnus-group-quick-select-group 0 org-mairix-gnus-results-group)
  (gnus-group-clear-data)
  (gnus-summary-reselect-current-group t t))

(defun org-mairix-gnus-select-display-group-function-bzg ()
  "This is the classic way the org mode is using, and it seems to be
using better for Bastien, so it may work for you."
  (gnus-group-clear-data org-mairix-gnus-results-group)
  (gnus-group-read-group t nil org-mairix-gnus-results-group))

(provide 'org-mairix)

;;; org-mairix.el ends here

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Mail files in org
  2008-08-28 19:52           ` Richard G Riley
@ 2008-08-29  9:03             ` Tim O'Callaghan
  2008-08-29  9:11               ` Manish
  0 siblings, 1 reply; 14+ messages in thread
From: Tim O'Callaghan @ 2008-08-29  9:03 UTC (permalink / raw)
  To: org-mode mailing list

Hi,

Now that Gmail uses statefull mail links, has anyone implemented
linking to Gmail conversations with org?

cheers,

Tim.

2008/8/28 Richard G Riley <rileyrgdev@gmail.com>:
> Russell Adams <RLAdams@AdamsInfoServ.Com> writes:
>
>> On Thu, Aug 28, 2008 at 05:45:38PM +0200, Richard G Riley wrote:
>>>
>>> Gnus supports maildir too although recently I moved to an IMAP server
>>> which accesses the maildir format created with procmail on my mail
>>> server.
>>>
>>
>> I've recently reorganized my folders to be served up by Dovecot so I
>> can access my maildir inside VM with Thunderbird. A great hack, and
>> Mutt compatible!
>>
>>> I did use Mutt for a while but being an emacs user I took the plunge and
>>> went Gnus and never looked back. All the things you are familiar with
>>> integrate nicely (flyspell, org-mode etc). And, of course, Gnus merges
>>> the concept of usenet and email which is great when you get it all
>>> sorted out and configured to your liking. But now its starting to sound
>>> like I am pimping  Gnus. But as an emacs user I would recommend you take
>>> the plunge again and retry Gnus.
>>
>> I don't do usenet, and I use emacs as the message editor for Mutt. I
>> do use BBDB with Mutt via LBDB.
>>
>> Perhaps I should review Gnus again, any good references or screenshots
>> of it in operation?
>
> One little picture here showing email and usenet groups with group
> specific colouring and then content highlighting with non empty folders.
>
> http://richardriley.net/default/projects/images/gnus_scr.png
>
> and a link to my .gnus here
>
> http://richardriley.net/default/projects/emacs/
>
> Using the built in help function on that files contents would be a big
> help I think.
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

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

* Re: Re: Mail files in org
  2008-08-29  9:03             ` Tim O'Callaghan
@ 2008-08-29  9:11               ` Manish
  0 siblings, 0 replies; 14+ messages in thread
From: Manish @ 2008-08-29  9:11 UTC (permalink / raw)
  To: Tim O'Callaghan; +Cc: org-mode mailing list

  On Fri, Aug 29, 2008 at 2:33 PM, Tim O'Callaghan wrote:
  > Hi,
  >
  > Now that Gmail uses statefull mail links, has anyone implemented
  > linking to Gmail conversations with org?

I am using (very basic) links to Gmail like this:

[[http://mail.google.com/mail/?zx=146px97qwhfbg&shva=1/1webfcb784e8a0ec4#starred][Starred]]
[[http://mail.google.com/mail/?zx=14vpa97q8h1bg&shva=1/1lkbfcbs74e1u0hc4#label/L%2Forg-mode][Org
mode]]

Have started looking for some sort of shortcut that can copy the link
to clipboard in one go (possibly formatted for Org.).

-- Manish

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

end of thread, other threads:[~2008-08-29  9:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-28 14:54 Mail files in org Charles Howard
2008-08-28 14:58 ` Russell Adams
2008-08-28 15:10   ` Richard G Riley
2008-08-28 15:38     ` Russell Adams
2008-08-28 15:44       ` Paul R
2008-08-28 15:45       ` Richard G Riley
2008-08-28 16:07         ` Russell Adams
2008-08-28 19:52           ` Richard G Riley
2008-08-29  9:03             ` Tim O'Callaghan
2008-08-29  9:11               ` Manish
2008-08-28 15:53     ` Bernt Hansen
2008-08-28 16:07       ` Richard G Riley
2008-08-28 16:11         ` Bernt Hansen
2008-08-29  7:31   ` Taru Karttunen

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).