]> git.donarmstrong.com Git - don.git/blob - posts/org_mode_mutt_capture.mdwn
triple escape the \ to try to get them by the wiki filter
[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      (require 'org-protocol)
17      (add-hook 'org-capture-mode-hook 'delete-other-windows)
18      (setq my-org-protocol-flag nil)
19      (defadvice org-capture-finalize (after delete-frame-at-end activate)
20        "Delete frame at remember finalization"
21        (progn (if my-org-protocol-flag (delete-frame))
22               (setq my-org-protocol-flag nil)))
23      (defadvice org-capture-refile (around delete-frame-after-refile activate)
24        "Delete frame at remember refile"
25        (if my-org-protocol-flag
26            (progn
27              (setq my-org-protocol-flag nil)
28              ad-do-it
29              (delete-frame))
30          ad-do-it)
31        )
32      (defadvice org-capture-kill (after delete-frame-at-end activate)
33        "Delete frame at remember abort"
34        (progn (if my-org-protocol-flag (delete-frame))
35               (setq my-org-protocol-flag nil)))
36      (defadvice org-protocol-capture (before set-org-protocol-flag activate)
37        (setq my-org-protocol-flag t))
38
39 Now, the frame automatically disappears after you refile it, keeping
40 my refile.org clean.
41
42 [[!tag emacs debian org-mode tech mutt]]