[PATCH v2 4/9] emacs: Move search-target logic to `notmuch-search-show-result'
[notmuch-archives.git] / d6 / 40702efa79cfb729adf88eaf9de30cff1baf0f
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 8FBA341733B\r
6         for <notmuch@notmuchmail.org>; Thu, 22 Apr 2010 02:08:06 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \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 zXAkx8SfRBRi for <notmuch@notmuchmail.org>;\r
16         Thu, 22 Apr 2010 02:08:05 -0700 (PDT)\r
17 Received: from homiemail-a13.g.dreamhost.com (caiajhbdccah.dreamhost.com\r
18         [208.97.132.207])\r
19         by olra.theworths.org (Postfix) with ESMTP id 66015417339\r
20         for <notmuch@notmuchmail.org>; Thu, 22 Apr 2010 02:08:05 -0700 (PDT)\r
21 Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch\r
22         [129.132.133.204]) (Authenticated sender: sebastian@sspaeth.de)\r
23         by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPA id C3E076A8058; \r
24         Thu, 22 Apr 2010 02:07:58 -0700 (PDT)\r
25 From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
26 To: Notmuch developer list <notmuch@notmuchmail.org>\r
27 Subject: [PATCH 3/6] notmuch-maildir-fcc: rename all jkr/* functions to\r
28         notmuch-maildir-fcc-*\r
29 Date: Thu, 22 Apr 2010 11:07:28 +0200\r
30 Message-Id: <1271927251-19867-4-git-send-email-Sebastian@SSpaeth.de>\r
31 X-Mailer: git-send-email 1.7.0.4\r
32 In-Reply-To: <87ochbx3er.fsf@SSpaeth.de>\r
33 References: <87ochbx3er.fsf@SSpaeth.de>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.13\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Thu, 22 Apr 2010 09:08:06 -0000\r
47 \r
48 Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
49 ---\r
50  emacs/notmuch-maildir-fcc.el |   38 +++++++++++++++++++-------------------\r
51  1 files changed, 19 insertions(+), 19 deletions(-)\r
52 \r
53 diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el\r
54 index f18ccc8..c91095d 100644\r
55 --- a/emacs/notmuch-maildir-fcc.el\r
56 +++ b/emacs/notmuch-maildir-fcc.el\r
57 @@ -28,18 +28,18 @@\r
58  ;;\r
59  ;;     (setq message-fcc-handler-function \r
60  ;;          '(lambda (destdir) \r
61 -;;          (jkr/maildir-write-buffer-to-maildir destdir t)))\r
62 +;;          (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))\r
63  ;;\r
64  ;; if you want Fcc'd messages to be marked as new:\r
65  ;;\r
66  ;;     (setq message-fcc-handler-function \r
67  ;;          '(lambda (destdir) \r
68 -;;          (jkr/maildir-write-buffer-to-maildir destdir nil)))\r
69 +;;          (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))\r
70  \r
71  \r
72 -(defvar jkr/maildir-count 0)\r
73 +(defvar notmuch-maildir-fcc-count 0)\r
74  \r
75 -(defun jkr/maildir-host-fixer (hostname)\r
76 +(defun notmuch-maildir-fcc-host-fixer (hostname)\r
77    (replace-regexp-in-string "/\\|:"\r
78                             '(lambda (s)\r
79                                  (cond ((string-equal s "/") "\\057")\r
80 @@ -49,31 +49,31 @@\r
81                             t\r
82                             t))\r
83  \r
84 -(defun jkr/maildir-make-uniq-maildir-id ()\r
85 +(defun notmuch-maildir-fcc-make-uniq-maildir-id ()\r
86     (let* ((ct (current-time))\r
87           (timeid (+ (* (car ct) 65536) (cadr ct)))\r
88           (microseconds (caddr ct))\r
89 -         (hostname (jkr/maildir-host-fixer system-name)))\r
90 -     (setq jkr/maildir-count (+ jkr/maildir-count 1))\r
91 +         (hostname (notmuch-maildir-fcc-host-fixer system-name)))\r
92 +     (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))\r
93       (format "%d.%d_%d_%d.%s"\r
94              timeid\r
95              (emacs-pid)\r
96              microseconds\r
97 -            jkr/maildir-count\r
98 +            notmuch-maildir-fcc-count\r
99              hostname)))\r
100  \r
101 -(defun jkr/maildir-dir-is-maildir-p (dir)\r
102 +(defun notmuch-maildir-fcc-dir-is-maildir-p (dir)\r
103    (and (file-exists-p (concat dir "/cur/"))\r
104         (file-exists-p (concat dir "/new/"))\r
105         (file-exists-p (concat dir "/tmp/"))))\r
106  \r
107 -(defun jkr/maildir-save-buffer-to-tmp (destdir)\r
108 +(defun notmuch-maildir-fcc-save-buffer-to-tmp (destdir)\r
109    "Returns the msg id of the message written to the temp directory\r
110  if successful, nil if not."\r
111 -  (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))\r
112 +  (let ((msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))\r
113      (while (file-exists-p (concat destdir "/tmp/" msg-id))\r
114 -      (setq msg-id (jkr/maildir-make-uniq-maildir-id)))\r
115 -    (cond ((jkr/maildir-dir-is-maildir-p destdir)\r
116 +      (setq msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))\r
117 +    (cond ((notmuch-maildir-fcc-dir-is-maildir-p destdir)\r
118            (write-file (concat destdir "/tmp/" msg-id))\r
119            msg-id)\r
120           (t\r
121 @@ -81,17 +81,17 @@ if successful, nil if not."\r
122                      destdir))\r
123            nil))))\r
124  \r
125 -(defun jkr/maildir-move-tmp-to-new (destdir msg-id)\r
126 +(defun notmuch-maildir-fcc-move-tmp-to-new (destdir msg-id)\r
127    (add-name-to-file \r
128     (concat destdir "/tmp/" msg-id)\r
129     (concat destdir "/new/" msg-id ":2,")))\r
130  \r
131 -(defun jkr/maildir-move-tmp-to-cur (destdir msg-id &optional mark-seen)\r
132 +(defun notmuch-maildir-fcc-move-tmp-to-cur (destdir msg-id &optional mark-seen)\r
133    (add-name-to-file \r
134     (concat destdir "/tmp/" msg-id)\r
135     (concat destdir "/cur/" msg-id ":2," (when mark-seen "S"))))\r
136  \r
137 -(defun jkr/maildir-write-buffer-to-maildir (destdir &optional mark-seen)\r
138 +(defun notmuch-maildir-fcc-write-buffer-to-maildir (destdir &optional mark-seen)\r
139    "Writes the current buffer to maildir destdir. If mark-seen is\r
140  non-nil, it will write it to cur/, and mark it as read. It should\r
141  return t if successful, and nil otherwise."\r
142 @@ -99,16 +99,16 @@ return t if successful, and nil otherwise."\r
143      (with-temp-buffer \r
144        (insert-buffer orig-buffer)\r
145        (catch 'link-error\r
146 -       (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))\r
147 +       (let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))\r
148           (when msg-id\r
149             (cond (mark-seen\r
150                    (condition-case err\r
151 -                      (jkr/maildir-move-tmp-to-cur destdir msg-id t)\r
152 +                      (notmuch-maildir-fcc-move-tmp-to-cur destdir msg-id t)\r
153                      (file-already-exists\r
154                       (throw 'link-error nil))))\r
155                   (t \r
156                    (condition-case err\r
157 -                      (jkr/maildir-move-tmp-to-new destdir msg-id)\r
158 +                      (notmuch-maildir-fcc-move-tmp-to-new destdir msg-id)\r
159                      (file-already-exists\r
160                       (throw 'link-error nil))))))\r
161           (delete-file (concat destdir "/tmp/" msg-id))))\r
162 -- \r
163 1.7.0.4\r
164 \r