From: Carl Worth Date: Wed, 28 Apr 2010 00:12:16 +0000 (-0700) Subject: Merge branch '0.3.x' immediately after the 0.3.1 release X-Git-Tag: 0.4~152 X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=417274d698b6718621b9f5dec744ab169499f4e3;hp=e9e1466b441769f77391080ee8d08ec1afac7a61;p=notmuch Merge branch '0.3.x' immediately after the 0.3.1 release This brings one bug fix into master that was originally applied directly to the 0.3.x branch. --- diff --git a/NEWS b/NEWS index 40fb900f..9d913791 100644 --- 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 diff --git a/debian/gbp.conf b/debian/gbp.conf index a4794f1c..dba526f6 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -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 diff --git a/emacs/Makefile.local b/emacs/Makefile.local index 00d309cf..86f9b07f 100644 --- a/emacs/Makefile.local +++ b/emacs/Makefile.local @@ -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 index 00000000..d5c96c2b --- /dev/null +++ b/emacs/notmuch-message.el @@ -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 . +;; +;; Authors: Jesse Rosenthal + +(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) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index eb5335ff..4b1baf38 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -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)) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 57f0cc5c..46e18243 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -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) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 488458af..57e11400 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -56,6 +56,7 @@ (require 'notmuch-mua) (require 'notmuch-hello) (require 'notmuch-maildir-fcc) +(require 'notmuch-message) (defcustom notmuch-search-result-format `(("date" . "%s ")