]> git.notmuchmail.org Git - notmuch/commitdiff
Merge branch '0.3.x' immediately after the 0.3.1 release
authorCarl Worth <cworth@cworth.org>
Wed, 28 Apr 2010 00:12:16 +0000 (17:12 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 28 Apr 2010 00:13:47 +0000 (17:13 -0700)
This brings one bug fix into master that was originally applied
directly to the 0.3.x branch.

NEWS
debian/gbp.conf
emacs/Makefile.local
emacs/notmuch-message.el [new file with mode: 0644]
emacs/notmuch-show.el
emacs/notmuch-wash.el
emacs/notmuch.el

diff --git a/NEWS b/NEWS
index 40fb900f74a939142f6ddee312b81cc203189c14..9d913791ed4e846c06e901d7164a659c60732fb3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+New emacs features
+------------------
+Add a new, optional hook for detecting inline patches
+
+  This hook is disabled by default but can be enabled with a checkbox
+  under ""Notmuch Show Insert Text/Plain Hook" in the notmuch
+  customize interface. It allows for inline patches to be detected and
+  treated as if they were attachments, (with context-sensitive
+  highlighting).
+
+Automatically tag messages as "replied" when sending a reply
+
+  This feature adds a "replied" tag by default, but can easily be
+  customized to add or remove other tags as well. For example, a user
+  might use a tag of "needs-reply" and can configure this feature to
+  automatically remove that tag when replying. See "Notmuch Message
+  Mark Replied" in the notmuch customize interface.
+
 Notmuch 0.3.1 (2010-04-27)
 ==========================
 General bug fixes
index a4794f1ca0797a45dd7a9977541ec392c885382c..dba526f66abc18e2b21fb616eccc75624dbc4958 100644 (file)
@@ -2,10 +2,10 @@
 
 [DEFAULT]
 # The default branch for upstream sources
-upstream-branch = 0.3.x
+upstream-branch = master
 
 # The default branch for the debian patch (no patch in our case)
-debian-branch = 0.3.x
+debian-branch = master
 
 # Directory for performing the build
 export-dir = ./debian-build
index 00d309cffdd5cf0a98f0d0ab8cd0b08b5c0961c6..86f9b07fe64bb46805f18bd3d2ad80c26dc3f0b7 100644 (file)
@@ -11,6 +11,7 @@ emacs_sources := \
        $(dir)/notmuch-mua.el \
        $(dir)/notmuch-address.el \
        $(dir)/notmuch-maildir-fcc.el \
+       $(dir)/notmuch-message.el \
        $(dir)/coolj.el
 
 emacs_images := \
diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el
new file mode 100644 (file)
index 0000000..d5c96c2
--- /dev/null
@@ -0,0 +1,52 @@
+;; notmuch-message.el --- message-mode functions specific to notmuch
+;;
+;; Copyright © Jesse Rosenthal
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; Authors: Jesse Rosenthal <jrosenthal@jhu.edu>
+
+(require 'message)
+(require 'notmuch-mua)
+
+(defcustom notmuch-message-replied-tags '("replied")
+  "Tags to be automatically added to or removed from a message when it is replied to.
+Any tag in the list will be added to a replied message or,
+if it is prefaced with a \"-\", removed.
+
+For example, if you wanted to add a \"replied\" tag and remove
+the \"inbox\" and \"todo\", you would set
+    (\"replied\" \"-inbox\" \"-todo\"\)"
+  :type 'list
+  :group 'notmuch)
+
+(defun notmuch-message-mark-replied ()
+  ;; get the in-reply-to header and parse it for the message id.
+  (let ((rep (mail-header-parse-addresses (message-field-value "In-Reply-To"))))
+    (when (and notmuch-message-replied-tags rep)
+      ;; add a "+" to any tag that is doesn't already begin with a "+"
+      ;; or "-"
+      (let ((tags (mapcar '(lambda (str)
+                            (if (not (string-match "^[+-]" str))
+                                (concat "+" str)
+                              str))
+                         notmuch-message-replied-tags)))
+       (apply 'notmuch-call-notmuch-process "tag"
+              (append tags (list (concat "id:" (car (car rep)))) nil))))))
+
+(add-hook 'message-send-hook 'notmuch-message-mark-replied)
+
+(provide 'notmuch-message)
index eb5335ff2f7f918865d7681fc18a50510e7abce0..4b1baf38dd2a5bcc3fc64145fb15407943be7bd1 100644 (file)
@@ -71,7 +71,8 @@ any given message."
   "Functions used to improve the display of text/plain parts."
   :group 'notmuch
   :type 'hook
-  :options '(notmuch-wash-wrap-long-lines
+  :options '(notmuch-wash-convert-inline-patch-to-part
+            notmuch-wash-wrap-long-lines
             notmuch-wash-tidy-citations
             notmuch-wash-elide-blank-lines
             notmuch-wash-excerpt-citations))
index 57f0cc5cbe4781a14b7897ea475b7bab884fd6ea..46e182435ea24163aafbbf3b436baf7a963002ad 100644 (file)
@@ -23,6 +23,8 @@
 
 (require 'coolj)
 
+(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth))
+
 ;;
 
 (defvar notmuch-wash-signature-regexp
@@ -231,4 +233,40 @@ When doing so, maintaining citation leaders in the wrapped text."
 
 ;;
 
+(require 'diff-mode)
+
+(defvar diff-file-header-re) ; From `diff-mode.el'.
+
+(defun notmuch-wash-convert-inline-patch-to-part (depth)
+  "Convert an inline patch into a fake 'text/x-diff' attachment.
+
+Given that this function guesses whether a buffer includes a
+patch and then guesses the extent of the patch, there is scope
+for error."
+
+  (goto-char (point-min))
+  (if (re-search-forward diff-file-header-re nil t)
+      (progn
+       (beginning-of-line -1)
+       (let ((patch-start (point))
+             (patch-end (point-max))
+             part)
+         (goto-char patch-start)
+         (if (or
+              ;; Patch ends with signature.
+              (re-search-forward notmuch-wash-signature-regexp nil t)
+              ;; Patch ends with bugtraq comment.
+              (re-search-forward "^\\*\\*\\* " nil t))
+             (setq patch-end (match-beginning 0)))
+         (save-restriction
+           (narrow-to-region patch-start patch-end)
+           (setq part (plist-put part :content-type "text/x-diff"))
+           (setq part (plist-put part :content (buffer-string)))
+           (setq part (plist-put part :id -1))
+           (setq part (plist-put part :filename "inline patch"))
+           (delete-region (point-min) (point-max))
+           (notmuch-show-insert-bodypart nil part depth))))))
+
+;;
+
 (provide 'notmuch-wash)
index 488458af98bf516cd55a712ca45567caa49a11e7..57e11400a526cf4b81433430d1ce0f65245f989d 100644 (file)
@@ -56,6 +56,7 @@
 (require 'notmuch-mua)
 (require 'notmuch-hello)
 (require 'notmuch-maildir-fcc)
+(require 'notmuch-message)
 
 (defcustom notmuch-search-result-format
   `(("date" . "%s ")