1 Return-Path: <Sebastian@SSpaeth.de>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id F28CC418C25
\r
6 for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 12:01:21 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id aErtVyz5I5p5 for <notmuch@notmuchmail.org>;
\r
16 Fri, 23 Apr 2010 12:01:19 -0700 (PDT)
\r
17 Received: from homiemail-a15.g.dreamhost.com (caiajhbdccac.dreamhost.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id E0D534196F5
\r
20 for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 12:01:18 -0700 (PDT)
\r
21 Received: from localhost.localdomain (unknown [195.190.188.219])
\r
22 (Authenticated sender: sebastian@sspaeth.de)
\r
23 by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPA id 7F7D476C069;
\r
24 Fri, 23 Apr 2010 12:01:17 -0700 (PDT)
\r
25 From: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
26 To: Notmuch developer list <notmuch@notmuchmail.org>
\r
27 Subject: [PATCH 2/4] Integrate notmuch-maildir-fcc into notmuch
\r
28 Date: Fri, 23 Apr 2010 21:01:09 +0200
\r
29 Message-Id: <1272049271-20049-2-git-send-email-Sebastian@SSpaeth.de>
\r
30 X-Mailer: git-send-email 1.7.0.4
\r
31 In-Reply-To: <m37hny5kuy.fsf@x200.gr8dns.org>
\r
32 References: <m37hny5kuy.fsf@x200.gr8dns.org>
\r
33 X-BeenThere: notmuch@notmuchmail.org
\r
34 X-Mailman-Version: 2.1.13
\r
36 List-Id: "Use and development of the notmuch mail system."
\r
37 <notmuch.notmuchmail.org>
\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
39 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
41 List-Post: <mailto:notmuch@notmuchmail.org>
\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
45 X-List-Received-Date: Fri, 23 Apr 2010 19:01:22 -0000
\r
47 Require notmuch-maildir-fcc and also install it.
\r
48 Rename all jkr/* functions to notmuch-maildir-fcc-*
\r
50 Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
52 emacs/Makefile.local | 3 ++-
\r
53 emacs/notmuch-maildir-fcc.el | 42 ++++++++++++++++++++++--------------------
\r
54 emacs/notmuch.el | 1 +
\r
55 3 files changed, 25 insertions(+), 21 deletions(-)
\r
57 diff --git a/emacs/Makefile.local b/emacs/Makefile.local
\r
58 index f759c0d..c80e0e3 100644
\r
59 --- a/emacs/Makefile.local
\r
60 +++ b/emacs/Makefile.local
\r
61 @@ -6,7 +6,8 @@ emacs_sources := \
\r
63 $(dir)/notmuch-query.el \
\r
64 $(dir)/notmuch-show.el \
\r
65 - $(dir)/notmuch-wash.el
\r
66 + $(dir)/notmuch-wash.el \
\r
67 + $(dir)/notmuch-maildir-fcc.el
\r
69 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))
\r
71 diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
\r
72 index 979428e..2117f54 100644
\r
73 --- a/emacs/notmuch-maildir-fcc.el
\r
74 +++ b/emacs/notmuch-maildir-fcc.el
\r
77 ;; (setq message-fcc-handler-function
\r
78 ;; '(lambda (destdir)
\r
79 -;; (jkr/maildir-write-buffer-to-maildir destdir t)))
\r
80 +;; (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
\r
82 ;; if you want Fcc'd messages to be marked as new:
\r
84 ;; (setq message-fcc-handler-function
\r
85 ;; '(lambda (destdir)
\r
86 -;; (jkr/maildir-write-buffer-to-maildir destdir nil)))
\r
87 +;; (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))
\r
90 -(defvar jkr/maildir-count 0)
\r
91 +(defvar notmuch-maildir-fcc-count 0)
\r
93 -(defun jkr/maildir-host-fixer (hostname)
\r
94 +(defun notmuch-maildir-fcc-host-fixer (hostname)
\r
95 (replace-regexp-in-string "/\\|:"
\r
97 (cond ((string-equal s "/") "\\057")
\r
102 -(defun jkr/maildir-make-uniq-maildir-id ()
\r
103 +(defun notmuch-maildir-fcc-make-uniq-maildir-id ()
\r
104 (let* ((ct (current-time))
\r
105 (timeid (+ (* (car ct) 65536) (cadr ct)))
\r
106 (microseconds (caddr ct))
\r
107 - (hostname (jkr/maildir-host-fixer system-name)))
\r
108 - (setq jkr/maildir-count (+ jkr/maildir-count 1))
\r
109 + (hostname (notmuch-maildir-fcc-host-fixer system-name)))
\r
110 + (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
\r
111 (format "%d.%d_%d_%d.%s"
\r
115 - jkr/maildir-count
\r
116 + notmuch-maildir-fcc-count
\r
119 -(defun jkr/maildir-dir-is-maildir-p (dir)
\r
120 +(defun notmuch-maildir-fcc-dir-is-maildir-p (dir)
\r
121 (and (file-exists-p (concat dir "/cur/"))
\r
122 (file-exists-p (concat dir "/new/"))
\r
123 (file-exists-p (concat dir "/tmp/"))))
\r
125 -(defun jkr/maildir-save-buffer-to-tmp (destdir)
\r
126 +(defun notmuch-maildir-fcc-save-buffer-to-tmp (destdir)
\r
127 "Returns the msg id of the message written to the temp directory
\r
128 if successful, nil if not."
\r
129 - (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))
\r
130 + (let ((msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
\r
131 (while (file-exists-p (concat destdir "/tmp/" msg-id))
\r
132 - (setq msg-id (jkr/maildir-make-uniq-maildir-id)))
\r
133 - (cond ((jkr/maildir-dir-is-maildir-p destdir)
\r
134 + (setq msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
\r
135 + (cond ((notmuch-maildir-fcc-dir-is-maildir-p destdir)
\r
136 (write-file (concat destdir "/tmp/" msg-id))
\r
139 @@ -81,17 +81,17 @@ if successful, nil if not."
\r
143 -(defun jkr/maildir-move-tmp-to-new (destdir msg-id)
\r
144 +(defun notmuch-maildir-fcc-move-tmp-to-new (destdir msg-id)
\r
146 (concat destdir "/tmp/" msg-id)
\r
147 (concat destdir "/new/" msg-id ":2,")))
\r
149 -(defun jkr/maildir-move-tmp-to-cur (destdir msg-id &optional mark-seen)
\r
150 +(defun notmuch-maildir-fcc-move-tmp-to-cur (destdir msg-id &optional mark-seen)
\r
152 (concat destdir "/tmp/" msg-id)
\r
153 (concat destdir "/cur/" msg-id ":2," (when mark-seen "S"))))
\r
155 -(defun jkr/maildir-write-buffer-to-maildir (destdir &optional mark-seen)
\r
156 +(defun notmuch-maildir-fcc-write-buffer-to-maildir (destdir &optional mark-seen)
\r
157 "Writes the current buffer to maildir destdir. If mark-seen is
\r
158 non-nil, it will write it to cur/, and mark it as read. It should
\r
159 return t if successful, and nil otherwise."
\r
160 @@ -99,17 +99,19 @@ return t if successful, and nil otherwise."
\r
162 (insert-buffer orig-buffer)
\r
164 - (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))
\r
165 + (let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
\r
168 (condition-case err
\r
169 - (jkr/maildir-move-tmp-to-cur destdir msg-id t)
\r
170 + (notmuch-maildir-fcc-move-tmp-to-cur destdir msg-id t)
\r
171 (file-already-exists
\r
172 (throw 'link-error nil))))
\r
174 (condition-case err
\r
175 - (jkr/maildir-move-tmp-to-new destdir msg-id)
\r
176 + (notmuch-maildir-fcc-move-tmp-to-new destdir msg-id)
\r
177 (file-already-exists
\r
178 (throw 'link-error nil))))))
\r
179 (delete-file (concat destdir "/tmp/" msg-id))))
\r
181 \ No newline at end of file
\r
184 +(provide 'notmuch-maildir-fcc)
\r
185 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
186 index e947e5d..8cc71e1 100644
\r
187 --- a/emacs/notmuch.el
\r
188 +++ b/emacs/notmuch.el
\r
191 (require 'notmuch-lib)
\r
192 (require 'notmuch-show)
\r
193 +(require 'notmuch-maildir-fcc)
\r
195 (defcustom notmuch-search-authors-width 20
\r
196 "Number of columns to use to display authors in a notmuch-search buffer."
\r