1 Return-Path: <daniel.schoepe@googlemail.com>
\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 E44C2429E28
\r
6 for <notmuch@notmuchmail.org>; Wed, 6 Jul 2011 07:18:18 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id aL0k2jvJxrcE for <notmuch@notmuchmail.org>;
\r
17 Wed, 6 Jul 2011 07:18:17 -0700 (PDT)
\r
18 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com
\r
19 [209.85.161.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 351ED431FD0
\r
22 for <notmuch@notmuchmail.org>; Wed, 6 Jul 2011 07:18:15 -0700 (PDT)
\r
23 Received: by mail-fx0-f46.google.com with SMTP id 19so138086fxh.19
\r
24 for <notmuch@notmuchmail.org>; Wed, 06 Jul 2011 07:18:14 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=googlemail.com; s=gamma;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=JG1Jr6b1RrobdO5nm4VCBFr0cBDusOlQvg5FdJtXLk4=;
\r
29 b=axJC+CNPYc7ZgjzaUK/iZFnKuzX2/KB97WKIt+I2CKZY4krs+ocvB0I7qevSWaPzvP
\r
30 3UfVADuf6w0Rzsbaflz8WXbvQKtVOVusnaYXn6TWwN8gSkfRMpJSp6wMo/1zbMfbU9Ku
\r
31 FK0a2SAWXIqFeyAmqC05sNYtdJ38bXIv8+nfU=
\r
32 Received: by 10.223.76.219 with SMTP id d27mr13284921fak.87.1309961894880;
\r
33 Wed, 06 Jul 2011 07:18:14 -0700 (PDT)
\r
34 Received: from localhost (dslb-088-069-135-087.pools.arcor-ip.net
\r
36 by mx.google.com with ESMTPS id b3sm6047541fao.44.2011.07.06.07.18.12
\r
37 (version=TLSv1/SSLv3 cipher=OTHER);
\r
38 Wed, 06 Jul 2011 07:18:13 -0700 (PDT)
\r
39 From: Daniel Schoepe <daniel.schoepe@googlemail.com>
\r
40 To: notmuch@notmuchmail.org
\r
41 Subject: [PATCH v2] emacs: Turn id:"<message-id>" elements into buttons for
\r
43 Date: Wed, 6 Jul 2011 16:18:01 +0200
\r
44 Message-Id: <1309961881-28333-2-git-send-email-daniel.schoepe@googlemail.com>
\r
45 X-Mailer: git-send-email 1.7.5.4
\r
46 In-Reply-To: <1309961881-28333-1-git-send-email-daniel.schoepe@googlemail.com>
\r
47 References: <1309896760-378-1-git-send-email-daniel.schoepe@googlemail.com>
\r
48 <1309961881-28333-1-git-send-email-daniel.schoepe@googlemail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Wed, 06 Jul 2011 14:18:19 -0000
\r
63 This fixes the minor annoyance that message ids were parsed as mail
\r
64 addresses by goto-address-mode in notmuch-show buffers.
\r
66 emacs/notmuch-show.el | 24 +++++++++++++++++++++---
\r
67 1 files changed, 21 insertions(+), 3 deletions(-)
\r
69 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
70 index f96743b..f924d17 100644
\r
71 --- a/emacs/notmuch-show.el
\r
72 +++ b/emacs/notmuch-show.el
\r
74 (require 'mm-decode)
\r
76 (require 'icalendar)
\r
77 +(require 'goto-addr)
\r
79 (require 'notmuch-lib)
\r
80 (require 'notmuch-query)
\r
81 @@ -778,6 +779,24 @@ current buffer, if possible."
\r
82 (defvar notmuch-show-parent-buffer nil)
\r
83 (make-variable-buffer-local 'notmuch-show-parent-buffer)
\r
85 +(defun notmuch-show-buttonise-links (start end)
\r
86 + "Buttonise URLs and mail addresses between START and END.
\r
88 +This also turns id:\"<message id>\"-parts into buttons for
\r
89 +a corresponding notmuch search."
\r
90 + (goto-address-fontify-region start end)
\r
93 + (while (re-search-forward "id:\"[^ ]+\"" end t)
\r
94 + ;; remove the overlay created by goto-address-mode
\r
95 + (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
\r
96 + (make-text-button (match-beginning 0) (match-end 0)
\r
97 + 'action `(lambda (arg)
\r
98 + (notmuch-search ,(match-string-no-properties 0)))
\r
100 + 'help-echo "Mouse-1, RET: search for this message"
\r
101 + 'face goto-address-mail-face))))
\r
104 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
\r
105 "Run \"notmuch show\" with the given thread ID and display results.
\r
106 @@ -822,9 +841,8 @@ function is used. "
\r
107 (notmuch-show-insert-forest
\r
108 (notmuch-query-get-threads basic-args))))
\r
110 - ;; Enable buttonisation of URLs and email addresses in the
\r
112 - (goto-address-mode t)
\r
113 + (jit-lock-register #'notmuch-show-buttonise-links)
\r
115 ;; Act on visual lines rather than logical lines.
\r
116 (visual-line-mode t)
\r