1 Return-Path: <daniel@schoepe.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 D8A28429E21
\r
6 for <notmuch@notmuchmail.org>; Fri, 28 Oct 2011 07:49:59 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 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 cU++a6a1bOQG for <notmuch@notmuchmail.org>;
\r
17 Fri, 28 Oct 2011 07:49:59 -0700 (PDT)
\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com
\r
19 [209.85.161.53]) (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 253D0431FB6
\r
22 for <notmuch@notmuchmail.org>; Fri, 28 Oct 2011 07:49:59 -0700 (PDT)
\r
23 Received: by faai28 with SMTP id i28so4080599faa.26
\r
24 for <notmuch@notmuchmail.org>; Fri, 28 Oct 2011 07:49:58 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schoepe.org; s=google;
\r
26 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
27 bh=3lWA5wATsBizSqOVY6Z5+b3hXjVUIZhtgzGuWjF1pnw=;
\r
28 b=NdmZ+gfLOmp7y5CDFoxsjAl3v4d6N/nqryGIC5WMH5R1qwaags39mHcVvQ6Fa0j4kQ
\r
29 DdYwZS/dmUSgVFEVLnsQDz8QetA/ShRwsOLxDtnQvFyRP3+5Ew6GeMCUMTA1Wgcc/Yjq
\r
30 Qo6lpc5XbD6DuLx2YjKJq0rx8M7uhVfpf6SPk=
\r
31 Received: by 10.223.17.23 with SMTP id q23mr6616687faa.11.1319813398003;
\r
32 Fri, 28 Oct 2011 07:49:58 -0700 (PDT)
\r
33 Received: from localhost (dslb-178-004-064-120.pools.arcor-ip.net.
\r
35 by mx.google.com with ESMTPS id a21sm17727336fao.18.2011.10.28.07.49.55
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Fri, 28 Oct 2011 07:49:56 -0700 (PDT)
\r
38 From: Daniel Schoepe <daniel@schoepe.org>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH v3] emacs: Turn id:"<message-id>" elements into buttons for
\r
42 Date: Fri, 28 Oct 2011 16:48:58 +0200
\r
43 Message-Id: <1319813338-26790-2-git-send-email-daniel@schoepe.org>
\r
44 X-Mailer: git-send-email 1.7.7
\r
45 In-Reply-To: <1319813338-26790-1-git-send-email-daniel@schoepe.org>
\r
46 References: <1309896760-378-1-git-send-email-daniel.schoepe@googlemail.com>
\r
47 <1319813338-26790-1-git-send-email-daniel@schoepe.org>
\r
48 Cc: Daniel Schoepe <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: Fri, 28 Oct 2011 14:50:00 -0000
\r
63 From: Daniel Schoepe <daniel.schoepe@googlemail.com>
\r
65 This fixes the minor annoyance that message ids were parsed as mail
\r
66 addresses by goto-address-mode in notmuch-show buffers.
\r
68 emacs/notmuch-show.el | 24 +++++++++++++++++++++---
\r
69 1 files changed, 21 insertions(+), 3 deletions(-)
\r
71 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
72 index 8db5435..440e089 100644
\r
73 --- a/emacs/notmuch-show.el
\r
74 +++ b/emacs/notmuch-show.el
\r
76 (require 'mm-decode)
\r
78 (require 'icalendar)
\r
79 +(require 'goto-addr)
\r
81 (require 'notmuch-lib)
\r
82 (require 'notmuch-query)
\r
83 @@ -789,6 +790,24 @@ current buffer, if possible."
\r
84 (defvar notmuch-show-buffer-name nil)
\r
85 (make-variable-buffer-local 'notmuch-show-buffer-name)
\r
87 +(defun notmuch-show-buttonise-links (start end)
\r
88 + "Buttonise URLs and mail addresses between START and END.
\r
90 +This also turns id:\"<message id>\"-parts into buttons for
\r
91 +a corresponding notmuch search."
\r
92 + (goto-address-fontify-region start end)
\r
95 + (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+\\1" end t)
\r
96 + ;; remove the overlay created by goto-address-mode
\r
97 + (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
\r
98 + (make-text-button (match-beginning 0) (match-end 0)
\r
99 + 'action `(lambda (arg)
\r
100 + (notmuch-search ,(match-string-no-properties 0)))
\r
102 + 'help-echo "Mouse-1, RET: search for this message"
\r
103 + 'face goto-address-mail-face))))
\r
106 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
\r
107 "Run \"notmuch show\" with the given thread ID and display results.
\r
108 @@ -839,9 +858,8 @@ function is used. "
\r
109 (notmuch-show-insert-forest
\r
110 (notmuch-query-get-threads basic-args))))
\r
112 - ;; Enable buttonisation of URLs and email addresses in the
\r
114 - (goto-address-mode t)
\r
115 + (jit-lock-register #'notmuch-show-buttonise-links)
\r
117 ;; Act on visual lines rather than logical lines.
\r
118 (visual-line-mode t)
\r