emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-mode and Gnus integration
@ 2007-05-13 13:02 Alain Picard
  2007-05-14 13:07 ` Alain Picard
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alain Picard @ 2007-05-13 13:02 UTC (permalink / raw)
  To: emacs-orgmode


Hello all.

I've started trying to use the GTD methodology, and have found
org-mode absolutely terrific for this purpose.  However I still
couln't get my mail to work just right (I use Gnus for mail).
What I'm really missing is a way to add "labels", or "tags" to
mail messages, so that I can then narrow the mail buffers to only
those messages matching a tag (e.g. TODO, NEXT, WAITING, etc).

Then I discovered the linking facility; in particular how org-mode
can link directly to a gnus post, so I figured, since I keep my
TODOs in an org file anyhow, I might as well keep the list of
messages requiring actions in there as well, in the form of links.

The following little hack allows to me to file, with 1 keystroke
(I use ">" for "send to the todo list") as a link into my org file.

To use this, you need an entry somewhere in your
file (called *org-email-todo-list-buffer*) which will
match *org-email-todo-tree-header*.


I don't know if anyone else will find this useful, or already
has a better way of handling this sort of thing (I haven't found
it yet, and I did look).

Ideally, I'd like to be able to maybe select different types of
tags directly when entering (e.g. maybe "C-u 1 >" --> WAITING
"C-u 2 >" --> NEXT etc) but I haven't implemented that yet.
I visit my todo file so often it's not a huge burder to just
reclassify all the TODOs rapidly in one go.

Any comments will be welcome.


snippet below.
================================================================
(defvar *org-email-todo-tree-header* "* Email TODOS")
(defvar *org-email-todo-list-buffer* "~/org/work.org")

(defun org-insert-email-as-current-todo ()
  (interactive)
  (let ((link (org-store-link nil)))
    (save-window-excursion
      (find-file *org-email-todo-list-buffer*)
      (goto-char (point-min))
      (let ((point (re-search-forward *org-email-todo-tree-header* (point-max) nil)))
	(org-end-of-subtree t)
	(insert "\n** TODO -- ")
	(insert link))))
  (message "Saved."))

(define-key gnus-summary-mode-map ">" 'org-insert-email-as-current-todo)
================================================================



--
Please read about why Top Posting
is evil at: http://en.wikipedia.org/wiki/Top-posting
and http://www.dickalba.demon.co.uk/usenet/guide/faq_topp.html

Please read about why HTML in email is evil at: http://www.birdhouse.org/etc/evilmail.html

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

* Re: org-mode and Gnus integration
  2007-05-13 13:02 org-mode and Gnus integration Alain Picard
@ 2007-05-14 13:07 ` Alain Picard
  2007-05-14 18:16 ` Bastien
  2007-05-15 11:41 ` Carsten Dominik
  2 siblings, 0 replies; 7+ messages in thread
From: Alain Picard @ 2007-05-14 13:07 UTC (permalink / raw)
  To: emacs-orgmode

Alain Picard <Alain.Picard@memetrics.com> writes:

Apologies about the duplicate post -- something about
first posting on gmane requiring authorization.

                       --ap

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

* Re: org-mode and Gnus integration
  2007-05-13 13:02 org-mode and Gnus integration Alain Picard
  2007-05-14 13:07 ` Alain Picard
@ 2007-05-14 18:16 ` Bastien
  2007-05-15 18:31   ` Carsten Dominik
  2007-05-15 11:41 ` Carsten Dominik
  2 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2007-05-14 18:16 UTC (permalink / raw)
  To: emacs-orgmode

Alain Picard <Alain.Picard@memetrics.com> writes:

> I don't know if anyone else will find this useful, or already has a
> better way of handling this sort of thing (I haven't found it yet, and
> I did look).

Yes, I find it useful, thanks for this!

> Ideally, I'd like to be able to maybe select different types of tags
> directly when entering (e.g. maybe "C-u 1 >" --> WAITING "C-u 2 >" -->
> NEXT etc) but I haven't implemented that yet.  

Here is a slightly modified version. I added a docstring and the ability
to be prompted for a keyword.  Of course, it would be better if keywords
where proposed as the history for the prompt, but i didn't find an easy
way to "flatten" the `org-todo-keywords' list.

========================================================================
(defun org-insert-email-as-current-todo (&optional kw)
  "Save a Gnus email into `*org-email-todo-list-buffer*' as a headline.
If prefix is non-nil, ask for a specific keyword."
  (interactive "P")
  (let ((link (org-store-link nil))
	(keyword 
	 (if kw (completing-read "Keyword: " nil nil nil "TODO"))))
    (save-window-excursion
      (find-file *org-email-todo-list-buffer*)
      (goto-char (point-min))
      (let ((point (re-search-forward *org-email-todo-tree-header* (point-max) nil)))
	(org-end-of-subtree t)
	(insert "\n** " keyword " ")
	(insert link))))
  (message "Email saved in %s" *org-email-todo-list-buffer*))
========================================================================

> I visit my todo file so often it's not a huge burder to just
> reclassify all the TODOs rapidly in one go.

Maybe we could cycle through keywords for headlines in a *region*?

And (while i'm at it) maybe we could move up and down a whole set of
headlines by moving the region containing them?  I came accross this
need quite often, but i don't know if it's possible to implement it.

-- 
Bastien

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

* Re: org-mode and Gnus integration
  2007-05-13 13:02 org-mode and Gnus integration Alain Picard
  2007-05-14 13:07 ` Alain Picard
  2007-05-14 18:16 ` Bastien
@ 2007-05-15 11:41 ` Carsten Dominik
  2 siblings, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2007-05-15 11:41 UTC (permalink / raw)
  To: Alain Picard; +Cc: emacs-orgmode

I can see that this is useful.  Another way to implement
something would be a remember template.  Would mean a few more keys to 
press, but it would allow you to add a note about what you need to
do, if necessary.

- Carsten

On May 13, 2007, at 15:02, Alain Picard wrote:

>
> Hello all.
>
> I've started trying to use the GTD methodology, and have found
> org-mode absolutely terrific for this purpose.  However I still
> couln't get my mail to work just right (I use Gnus for mail).
> What I'm really missing is a way to add "labels", or "tags" to
> mail messages, so that I can then narrow the mail buffers to only
> those messages matching a tag (e.g. TODO, NEXT, WAITING, etc).
>
> Then I discovered the linking facility; in particular how org-mode
> can link directly to a gnus post, so I figured, since I keep my
> TODOs in an org file anyhow, I might as well keep the list of
> messages requiring actions in there as well, in the form of links.
>
> The following little hack allows to me to file, with 1 keystroke
> (I use ">" for "send to the todo list") as a link into my org file.
>
> To use this, you need an entry somewhere in your
> file (called *org-email-todo-list-buffer*) which will
> match *org-email-todo-tree-header*.
>
>
> I don't know if anyone else will find this useful, or already
> has a better way of handling this sort of thing (I haven't found
> it yet, and I did look).
>
> Ideally, I'd like to be able to maybe select different types of
> tags directly when entering (e.g. maybe "C-u 1 >" --> WAITING
> "C-u 2 >" --> NEXT etc) but I haven't implemented that yet.
> I visit my todo file so often it's not a huge burder to just
> reclassify all the TODOs rapidly in one go.
>
> Any comments will be welcome.
>
>
> snippet below.
> ================================================================
> (defvar *org-email-todo-tree-header* "* Email TODOS")
> (defvar *org-email-todo-list-buffer* "~/org/work.org")
>
> (defun org-insert-email-as-current-todo ()
>   (interactive)
>   (let ((link (org-store-link nil)))
>     (save-window-excursion
>       (find-file *org-email-todo-list-buffer*)
>       (goto-char (point-min))
>       (let ((point (re-search-forward *org-email-todo-tree-header* 
> (point-max) nil)))
> 	(org-end-of-subtree t)
> 	(insert "\n** TODO -- ")
> 	(insert link))))
>   (message "Saved."))
>
> (define-key gnus-summary-mode-map ">" 
> 'org-insert-email-as-current-todo)
> ================================================================
>
>
>
> --
> Please read about why Top Posting
> is evil at: http://en.wikipedia.org/wiki/Top-posting
> and http://www.dickalba.demon.co.uk/usenet/guide/faq_topp.html
>
> Please read about why HTML in email is evil at: 
> http://www.birdhouse.org/etc/evilmail.html
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

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

* Re: org-mode and Gnus integration
  2007-05-14 18:16 ` Bastien
@ 2007-05-15 18:31   ` Carsten Dominik
  2007-05-16 16:46     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2007-05-15 18:31 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


On May 14, 2007, at 20:16, Bastien wrote:
>

> Here is a slightly modified version. I added a docstring and the 
> ability
> to be prompted for a keyword.  Of course, it would be better if 
> keywords
> where proposed as the history for the prompt, but i didn't find an easy
> way to "flatten" the `org-todo-keywords' list.

`org-todo-keywords-1' is a flat list of all todo keywords,
including the DONE states.
`org-not-done-keywords' is a flat list of the states that
are not done.  Both variables are buffer-local, and you
can get the value only in Org-mode buffers - i.e. you
need to get them from the buffer where you want to
store the note.

- Carsten

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

* Re: org-mode and Gnus integration
  2007-05-15 18:31   ` Carsten Dominik
@ 2007-05-16 16:46     ` Bastien
  2007-05-16 22:33       ` Alain Picard
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2007-05-16 16:46 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Alain Picard

Carsten Dominik <dominik@science.uva.nl> writes:

> On May 14, 2007, at 20:16, Bastien wrote:
>
> `org-todo-keywords-1' is a flat list of all todo keywords,
> including the DONE states.
> `org-not-done-keywords' is a flat list of the states that
> are not done.  

When prefixed, this new version gives choice among not-done states,
taking "TODO" as the default.  

========================================================================
(defun org-insert-email-as-current-todo (&optional kw)
  "Save a Gnus email into `*org-email-todo-list-buffer*' as a headline.
If prefix is non-nil, ask for a specific state."
  (interactive "P")
  (let ((link (org-store-link nil)))
    (save-window-excursion
      (find-file *org-email-todo-list-buffer*)
      (goto-char (point-min))
      (let ((state (if kw (completing-read "State: " 
					   (mapcar (lambda(x) (list x))
						   org-not-done-keywords)
					   nil t "TODO") "TODO"))
	    (point (re-search-forward *org-email-todo-tree-header* 
				      (point-max) nil)))
	(org-end-of-subtree t)
	(insert "\n** " state " " link))))
  (message "Email saved in %s" *org-email-todo-list-buffer*))
========================================================================

-- 
Bastien

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

* Re: org-mode and Gnus integration
  2007-05-16 16:46     ` Bastien
@ 2007-05-16 22:33       ` Alain Picard
  0 siblings, 0 replies; 7+ messages in thread
From: Alain Picard @ 2007-05-16 22:33 UTC (permalink / raw)
  To: Bastien; +Cc: Alain Picard, emacs-orgmode

Bastien <bzg@altern.org> writes:

> When prefixed, this new version gives choice among not-done states,
> taking "TODO" as the default.  

That's _terrific_!  That's just the bit I was missing.  Thanks!

                                --ap

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

end of thread, other threads:[~2007-05-16 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-13 13:02 org-mode and Gnus integration Alain Picard
2007-05-14 13:07 ` Alain Picard
2007-05-14 18:16 ` Bastien
2007-05-15 18:31   ` Carsten Dominik
2007-05-16 16:46     ` Bastien
2007-05-16 22:33       ` Alain Picard
2007-05-15 11:41 ` Carsten Dominik

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