]> git.donarmstrong.com Git - don.git/blob - posts/org_mode_mutt_capture.mdwn
use format el
[don.git] / posts / org_mode_mutt_capture.mdwn
1 [[!meta title="Using Mutt with Org Mode (with refile)"]]
2
3 I use [org mode](http://orgmode.org/) extensively, and had added
4 [Zack's](http://upsilon.cc/~zack/) workflow for
5 [integrating mutt with org mode](http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/)
6 to my
7 [~/.emacs](http://git.donarmstrong.com/?p=emacs.git;a=blob;f=.emacs;hb=HEAD)
8 some time ago.
9
10 However, I've been annoyed that refiling closes the org-capture frame
11 before refiling finishes. The following
12 [trivial modification](http://git.donarmstrong.com/?p=emacs.git;a=commitdiff;h=HEAD)
13 to Zack's code (which I previously modified to work with org-mode >=
14 0.8) waits to close the frame until you've finished refiling.
15
16 [[!format el """
17 (require 'org-protocol)
18 (add-hook 'org-capture-mode-hook 'delete-other-windows)
19 (setq my-org-protocol-flag nil)
20 (defadvice org-capture-finalize (after delete-frame-at-end activate)
21   "Delete frame at remember finalization"
22   (progn (if my-org-protocol-flag (delete-frame))
23          (setq my-org-protocol-flag nil)))
24 (defadvice org-capture-refile (around delete-frame-after-refile activate)
25   "Delete frame at remember refile"
26   (if my-org-protocol-flag
27       (progn
28         (setq my-org-protocol-flag nil)
29         ad-do-it
30         (delete-frame))
31     ad-do-it)
32   )
33 (defadvice org-capture-kill (after delete-frame-at-end activate)
34   "Delete frame at remember abort"
35   (progn (if my-org-protocol-flag (delete-frame))
36          (setq my-org-protocol-flag nil)))
37 (defadvice org-protocol-capture (before set-org-protocol-flag activate)
38   (setq my-org-protocol-flag t))
39 """]]
40
41 Now, the frame automatically disappears after you refile it, keeping
42 my refile.org clean.
43
44 [[!tag emacs debian org-mode tech mutt]]