--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9FF71431FC2\r
+ for <notmuch@notmuchmail.org>; Thu, 22 Aug 2013 23:51:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id zzltq7SrSRsC for <notmuch@notmuchmail.org>;\r
+ Thu, 22 Aug 2013 23:51:42 -0700 (PDT)\r
+Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com\r
+ [74.125.82.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ E121A431FAE for <notmuch@notmuchmail.org>; Thu, 22 Aug 2013 23:51:41 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f53.google.com with SMTP id c11so183845wgh.32\r
+ for <notmuch@notmuchmail.org>; Thu, 22 Aug 2013 23:51:39 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id;\r
+ bh=K9ccgaHX2dCiavz60u1xMMtsNWQM2XCrheoXzBPuZvM=;\r
+ b=tOp4VXKu+vmIf4H0kLrth+I4fGOgxtki905ZI7JuOuSn/hohWasvaVBRL/a06X0g4J\r
+ v7I3d7q/5mTWumahnKo3qiC4Mof3fSQ3YXTyP++CPPDGViqMg+hZRR+rDOiALFT4H1o1\r
+ Bh1o431tKiYfXOPqSN/98mWSCCpRnSxO39FfdAlTaaf2ZlxF2g0sqrK0gj3/krRgLPpS\r
+ ro6lP9ProCay4iVgnGeaQcJbqBhKyD/HExRvp+k03tTwdkf4wk6QW5X4hpaoJ3PxmNhR\r
+ SwIQRSBboHe6f4npTSnSn8O5hG1ahqCoRHF0u0uolVrcJ1t30113HPMlOf8vVof4vlk3\r
+ 5JZg==\r
+X-Received: by 10.180.13.83 with SMTP id f19mr904048wic.54.1377240699303;\r
+ Thu, 22 Aug 2013 23:51:39 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id ei6sm1436523wid.11.1969.12.31.16.00.00\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Thu, 22 Aug 2013 23:51:38 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] make http links into buttons\r
+Date: Fri, 23 Aug 2013 07:51:35 +0100\r
+Message-Id: <1377240695-825-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 23 Aug 2013 06:51:48 -0000\r
+\r
+This patch replaces the use of goto-address-fontify-region with our\r
+own code doing roughly the same thing. The advantage is that we\r
+control how the resulting buttons work. In particular RET on link\r
+activates the button (in my case opening it in an external browser)\r
+and TAB stops at these links.\r
+\r
+\r
+It finds the urls using the goto-address variable for the regexp so it\r
+should make exactly the same links.\r
+\r
+Caveats and queries:\r
+\r
+1) the buttons used now are text buttons rather than overlay "things":\r
+this seems to mean some things like fonts get overridden by\r
+notmuch-wash (observable in cited regions for example).\r
+\r
+2) Email links are also activatable by RET but there are quite a lot\r
+of them (eg all addresses in headers) so I make these buttons\r
+skippable. Possibly they should not be changed as pressing RET in a\r
+show body (to collapse the message) is relatively common so\r
+accidentally composing a mail may be irritating.\r
+\r
+3) the test for id buttonization in emacs-show fails because some\r
+links become buttons. I don't think it is worth updating this\r
+until/unless we have some consensus on how this should all work.\r
+\r
+What do people think?\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+ \r
+---\r
+ emacs/notmuch-show.el | 27 ++++++++++++++++++++++++---\r
+ 1 files changed, 24 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 82b70ba..8aa56e0 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1080,8 +1080,31 @@ See RFC 2392.")\r
+ \r
+ This also turns id:\"<message id>\"-parts and mid: links into\r
+ buttons for a corresponding notmuch search."\r
+- (goto-address-fontify-region start end)\r
+ (save-excursion\r
++ ;; Do urls\r
++ (goto-char start)\r
++ (while (re-search-forward goto-address-url-regexp end t)\r
++ (make-text-button (match-beginning 0) (match-end 0)\r
++ :type 'notmuch-button-type\r
++ 'action #'goto-address-at-point\r
++ 'follow-link t\r
++ 'help-echo "Mouse-1, RET: open this link in browser"\r
++ 'face goto-address-url-face\r
++ 'priority 10\r
++ 'mouse-face goto-address-url-mouse-face))\r
++ ;; do email addresses\r
++ (goto-char start)\r
++ (while (re-search-forward goto-address-mail-regexp end t)\r
++ (make-text-button (match-beginning 0) (match-end 0)\r
++ :type 'notmuch-button-type\r
++ 'action #'goto-address-at-point\r
++ 'follow-link t\r
++ 'help-echo "Mouse-1, RET: mail this address"\r
++ 'face goto-address-mail-face\r
++ 'priority 10\r
++ 'skip t ;; don't make tab stop at all email addresses in headers etc\r
++ 'mouse-face goto-address-mail-mouse-face))\r
++ ;; Do id: and mid: links\r
+ (let (links)\r
+ (goto-char start)\r
+ (while (re-search-forward notmuch-id-regexp end t)\r
+@@ -1096,8 +1119,6 @@ buttons for a corresponding notmuch search."\r
+ (push (list (match-beginning 0) (match-end 0)\r
+ (notmuch-id-to-query mid)) links)))\r
+ (dolist (link links)\r
+- ;; Remove the overlay created by goto-address-mode\r
+- (remove-overlays (first link) (second link) 'goto-address t)\r
+ (make-text-button (first link) (second link)\r
+ :type 'notmuch-button-type\r
+ 'action `(lambda (arg)\r
+-- \r
+1.7.9.1\r
+\r