Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / a1 / ff97fb255f0110f6d7b46c15e5c7e2530c9e29
1 Return-Path: <dme@dme.org>\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 183C040DBC8\r
6         for <notmuch@notmuchmail.org>; Mon, 15 Nov 2010 05:50:50 -0800 (PST)\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, RCVD_IN_DNSWL_NONE=-0.0001] 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 i0L-K7IhFUbd for <notmuch@notmuchmail.org>;\r
16         Mon, 15 Nov 2010 05:50:39 -0800 (PST)\r
17 Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
18  [74.125.82.41])        by olra.theworths.org (Postfix) with ESMTP id 964C640DBD4       for\r
19  <notmuch@notmuchmail.org>; Mon, 15 Nov 2010 05:50:39 -0800 (PST)\r
20 Received: by wwe15 with SMTP id 15so161683wwe.2\r
21         for <notmuch@notmuchmail.org>; Mon, 15 Nov 2010 05:50:38 -0800 (PST)\r
22 Received: by 10.216.182.75 with SMTP id n53mr6309808wem.41.1289829038683;\r
23         Mon, 15 Nov 2010 05:50:38 -0800 (PST)\r
24 Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com\r
25         [81.149.164.25])\r
26         by mx.google.com with ESMTPS id x23sm3700510weq.34.2010.11.15.05.50.32\r
27         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
28         Mon, 15 Nov 2010 05:50:33 -0800 (PST)\r
29 Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
30         id 26C50594056; Mon, 15 Nov 2010 13:48:17 +0000 (GMT)\r
31 From: David Edmondson <dme@dme.org>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH 1/2] emacs: Turn id:message-id text in messages into links.\r
34 Date: Mon, 15 Nov 2010 13:48:14 +0000\r
35 Message-Id: <1289828895-7594-1-git-send-email-dme@dme.org>\r
36 X-Mailer: git-send-email 1.7.2.3\r
37 In-Reply-To: <87wroeya0o.fsf@ut.hh.sledj.net>\r
38 References: <87wroeya0o.fsf@ut.hh.sledj.net>\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Mon, 15 Nov 2010 13:50:50 -0000\r
52 \r
53 The links simply run `(notmuch-search "id:message-id")'.\r
54 ---\r
55  emacs/notmuch-wash.el |   30 ++++++++++++++++++++++++++++++\r
56  1 files changed, 30 insertions(+), 0 deletions(-)\r
57 \r
58 diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
59 index a7ea5e9..f2755ae 100644\r
60 --- a/emacs/notmuch-wash.el\r
61 +++ b/emacs/notmuch-wash.el\r
62 @@ -288,4 +288,34 @@ for error."\r
63  \r
64  ;;\r
65  \r
66 +(require 'goto-addr)\r
67 +\r
68 +(defvar goto-address-mail-regexp) ; From goto-addr.el.\r
69 +\r
70 +(defun notmuch-wash-button-link-follow (button)\r
71 +  (let ((link (button-get button 'link)))\r
72 +    (when link\r
73 +      (notmuch-search link))))\r
74 +\r
75 +(define-button-type 'notmuch-wash-button-link\r
76 +  'action 'notmuch-wash-button-link-follow\r
77 +  'help-echo "mouse-1, RET: Search for matching messages"\r
78 +  'follow-link t\r
79 +  'face 'font-lock-comment-face)\r
80 +  \r
81 +(defun notmuch-wash-add-notmuch-links (depth)\r
82 +  "Convert notmuch message ids into search buttons."\r
83 +  (goto-char (point-min))\r
84 +  (while (re-search-forward (concat "id:" goto-address-mail-regexp) nil t)\r
85 +    (let* ((start (match-beginning 0))\r
86 +          (end (match-end 0))\r
87 +          (link (buffer-substring start end)))\r
88 +      (goto-char start)\r
89 +      (delete-region start end)\r
90 +      (insert-button link\r
91 +                    'link link\r
92 +                    :type 'notmuch-wash-button-link)\r
93 +      (goto-char end))))\r
94 +;;\r
95 +\r
96  (provide 'notmuch-wash)\r
97 -- \r
98 1.7.2.3\r
99 \r