--- /dev/null
+Return-Path: <Sebastian@SSpaeth.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 106064196F2\r
+ for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 01:23:26 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+ tests=[BAYES_00=-1.9] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 7VzZQIAoeLkH for <notmuch@notmuchmail.org>;\r
+ Mon, 26 Apr 2010 01:23:24 -0700 (PDT)\r
+Received: from homiemail-a15.g.dreamhost.com (caiajhbdcbbj.dreamhost.com\r
+ [208.97.132.119])\r
+ by olra.theworths.org (Postfix) with ESMTP id A1F8A4196F0\r
+ for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 01:23:24 -0700 (PDT)\r
+Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch\r
+ [129.132.133.204]) (Authenticated sender: sebastian@sspaeth.de)\r
+ by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPA id 7FDF776C065; \r
+ Mon, 26 Apr 2010 01:23:23 -0700 (PDT)\r
+From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+To: Notmuch developer list <notmuch@notmuchmail.org>\r
+Subject: [PATCH v3 2/4] Integrate notmuch-maildir-fcc into notmuch\r
+Date: Mon, 26 Apr 2010 10:23:16 +0200\r
+Message-Id: <1272270198-28357-2-git-send-email-Sebastian@SSpaeth.de>\r
+X-Mailer: git-send-email 1.7.0.4\r
+In-Reply-To: <m3bpd8tpjk.fsf@x200.gr8dns.org>\r
+References: <m3bpd8tpjk.fsf@x200.gr8dns.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 26 Apr 2010 08:23:26 -0000\r
+\r
+Require notmuch-maildir-fcc and also install it.\r
+Rename all jkr/* functions to notmuch-maildir-fcc-*\r
+\r
+Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+---\r
+ emacs/Makefile.local | 1 +\r
+ emacs/notmuch-maildir-fcc.el | 42 ++++++++++++++++++++++--------------------\r
+ emacs/notmuch.el | 1 +\r
+ 3 files changed, 24 insertions(+), 20 deletions(-)\r
+\r
+diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+index 7537c3d..e446f97 100644\r
+--- a/emacs/Makefile.local\r
++++ b/emacs/Makefile.local\r
+@@ -9,6 +9,7 @@ emacs_sources := \\r
+ $(dir)/notmuch-wash.el \\r
+ $(dir)/notmuch-hello.el \\r
+ $(dir)/notmuch-mua.el \\r
++ $(dir)/notmuch-maildir-fcc.el \\r
+ $(dir)/notmuch-address.el\r
+ \r
+ emacs_images := \\r
+diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el\r
+index 979428e..2117f54 100644\r
+--- a/emacs/notmuch-maildir-fcc.el\r
++++ b/emacs/notmuch-maildir-fcc.el\r
+@@ -28,18 +28,18 @@\r
+ ;;\r
+ ;; (setq message-fcc-handler-function\r
+ ;; '(lambda (destdir)\r
+-;; (jkr/maildir-write-buffer-to-maildir destdir t)))\r
++;; (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))\r
+ ;;\r
+ ;; if you want Fcc'd messages to be marked as new:\r
+ ;;\r
+ ;; (setq message-fcc-handler-function\r
+ ;; '(lambda (destdir)\r
+-;; (jkr/maildir-write-buffer-to-maildir destdir nil)))\r
++;; (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))\r
+ \r
+ \r
+-(defvar jkr/maildir-count 0)\r
++(defvar notmuch-maildir-fcc-count 0)\r
+ \r
+-(defun jkr/maildir-host-fixer (hostname)\r
++(defun notmuch-maildir-fcc-host-fixer (hostname)\r
+ (replace-regexp-in-string "/\\|:"\r
+ '(lambda (s)\r
+ (cond ((string-equal s "/") "\\057")\r
+@@ -49,31 +49,31 @@\r
+ t\r
+ t))\r
+ \r
+-(defun jkr/maildir-make-uniq-maildir-id ()\r
++(defun notmuch-maildir-fcc-make-uniq-maildir-id ()\r
+ (let* ((ct (current-time))\r
+ (timeid (+ (* (car ct) 65536) (cadr ct)))\r
+ (microseconds (caddr ct))\r
+- (hostname (jkr/maildir-host-fixer system-name)))\r
+- (setq jkr/maildir-count (+ jkr/maildir-count 1))\r
++ (hostname (notmuch-maildir-fcc-host-fixer system-name)))\r
++ (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))\r
+ (format "%d.%d_%d_%d.%s"\r
+ timeid\r
+ (emacs-pid)\r
+ microseconds\r
+- jkr/maildir-count\r
++ notmuch-maildir-fcc-count\r
+ hostname)))\r
+ \r
+-(defun jkr/maildir-dir-is-maildir-p (dir)\r
++(defun notmuch-maildir-fcc-dir-is-maildir-p (dir)\r
+ (and (file-exists-p (concat dir "/cur/"))\r
+ (file-exists-p (concat dir "/new/"))\r
+ (file-exists-p (concat dir "/tmp/"))))\r
+ \r
+-(defun jkr/maildir-save-buffer-to-tmp (destdir)\r
++(defun notmuch-maildir-fcc-save-buffer-to-tmp (destdir)\r
+ "Returns the msg id of the message written to the temp directory\r
+ if successful, nil if not."\r
+- (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))\r
++ (let ((msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))\r
+ (while (file-exists-p (concat destdir "/tmp/" msg-id))\r
+- (setq msg-id (jkr/maildir-make-uniq-maildir-id)))\r
+- (cond ((jkr/maildir-dir-is-maildir-p destdir)\r
++ (setq msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))\r
++ (cond ((notmuch-maildir-fcc-dir-is-maildir-p destdir)\r
+ (write-file (concat destdir "/tmp/" msg-id))\r
+ msg-id)\r
+ (t\r
+@@ -81,17 +81,17 @@ if successful, nil if not."\r
+ destdir))\r
+ nil))))\r
+ \r
+-(defun jkr/maildir-move-tmp-to-new (destdir msg-id)\r
++(defun notmuch-maildir-fcc-move-tmp-to-new (destdir msg-id)\r
+ (add-name-to-file\r
+ (concat destdir "/tmp/" msg-id)\r
+ (concat destdir "/new/" msg-id ":2,")))\r
+ \r
+-(defun jkr/maildir-move-tmp-to-cur (destdir msg-id &optional mark-seen)\r
++(defun notmuch-maildir-fcc-move-tmp-to-cur (destdir msg-id &optional mark-seen)\r
+ (add-name-to-file\r
+ (concat destdir "/tmp/" msg-id)\r
+ (concat destdir "/cur/" msg-id ":2," (when mark-seen "S"))))\r
+ \r
+-(defun jkr/maildir-write-buffer-to-maildir (destdir &optional mark-seen)\r
++(defun notmuch-maildir-fcc-write-buffer-to-maildir (destdir &optional mark-seen)\r
+ "Writes the current buffer to maildir destdir. If mark-seen is\r
+ non-nil, it will write it to cur/, and mark it as read. It should\r
+ return t if successful, and nil otherwise."\r
+@@ -99,17 +99,19 @@ return t if successful, and nil otherwise."\r
+ (with-temp-buffer\r
+ (insert-buffer orig-buffer)\r
+ (catch 'link-error\r
+- (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))\r
++ (let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))\r
+ (when msg-id\r
+ (cond (mark-seen\r
+ (condition-case err\r
+- (jkr/maildir-move-tmp-to-cur destdir msg-id t)\r
++ (notmuch-maildir-fcc-move-tmp-to-cur destdir msg-id t)\r
+ (file-already-exists\r
+ (throw 'link-error nil))))\r
+ (t\r
+ (condition-case err\r
+- (jkr/maildir-move-tmp-to-new destdir msg-id)\r
++ (notmuch-maildir-fcc-move-tmp-to-new destdir msg-id)\r
+ (file-already-exists\r
+ (throw 'link-error nil))))))\r
+ (delete-file (concat destdir "/tmp/" msg-id))))\r
+- t)))\r
+\ No newline at end of file\r
++ t)))\r
++\r
++(provide 'notmuch-maildir-fcc)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 378c004..127af2c 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -54,6 +54,7 @@\r
+ (require 'notmuch-lib)\r
+ (require 'notmuch-show)\r
+ (require 'notmuch-mua)\r
++(require 'notmuch-maildir-fcc)\r
+ \r
+ (defcustom notmuch-search-result-format\r
+ `(("date" . "%s ")\r
+-- \r
+1.7.0.4\r
+\r