Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B5E97431FD0 for ; Thu, 7 Jul 2011 00:16:13 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5PBJ+8X-tGqS for ; Thu, 7 Jul 2011 00:16:12 -0700 (PDT) Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 5B5E7431FB6 for ; Thu, 7 Jul 2011 00:16:12 -0700 (PDT) Received: by bwg12 with SMTP id 12so715996bwg.26 for ; Thu, 07 Jul 2011 00:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; bh=FmyWoFla9w4G0ks13DxYKt9EN4p7rwUHjK/M7OO5bFk=; b=udivSsn7EJ4qgOiGOtUNmz/1LnFkrN/ng51yXKvPG/VbPLN98z+ki6+0am/dt//O/m i0NHg9gs1rQ9LegpOAgiO8xvfVXaIud+0ZybQtuSfMrhii9wj/PsZb93+xzVGzCWXKWP 5Pt3wz5I6XtPKxPgPpgnp8AlrnRUvGvZyXgdY= Received: by 10.205.65.4 with SMTP id xk4mr431227bkb.21.1310022970880; Thu, 07 Jul 2011 00:16:10 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id lb15sm2079454bkb.1.2011.07.07.00.16.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Jul 2011 00:16:08 -0700 (PDT) From: Dmitry Kurochkin To: Daniel Schoepe , notmuch@notmuchmail.org Subject: Re: [PATCH v2] emacs: Turn id:"" elements into buttons for notmuch searches In-Reply-To: <1309961881-28333-2-git-send-email-daniel.schoepe@googlemail.com> References: <1309896760-378-1-git-send-email-daniel.schoepe@googlemail.com> <1309961881-28333-1-git-send-email-daniel.schoepe@googlemail.com> <1309961881-28333-2-git-send-email-daniel.schoepe@googlemail.com> User-Agent: Notmuch/0.5-321-g41686e2 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Thu, 07 Jul 2011 11:16:03 +0400 Message-ID: <87r5624l3g.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2011 07:16:13 -0000 Hi Daniel. On Wed, 6 Jul 2011 16:18:01 +0200, Daniel Schoepe wrote: > This fixes the minor annoyance that message ids were parsed as mail > addresses by goto-address-mode in notmuch-show buffers. I did not try it yet but it looks like a nice feature. Though I have some questions on the code below. > --- > emacs/notmuch-show.el | 24 +++++++++++++++++++++--- > 1 files changed, 21 insertions(+), 3 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index f96743b..f924d17 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -27,6 +27,7 @@ > (require 'mm-decode) > (require 'mailcap) > (require 'icalendar) > +(require 'goto-addr) > > (require 'notmuch-lib) > (require 'notmuch-query) > @@ -778,6 +779,24 @@ current buffer, if possible." > (defvar notmuch-show-parent-buffer nil) > (make-variable-buffer-local 'notmuch-show-parent-buffer) > > +(defun notmuch-show-buttonise-links (start end) > + "Buttonise URLs and mail addresses between START and END. > + > +This also turns id:\"\"-parts into buttons for > +a corresponding notmuch search." > + (goto-address-fontify-region start end) > + (save-excursion > + (goto-char start) > + (while (re-search-forward "id:\"[^ ]+\"" end t) > + ;; remove the overlay created by goto-address-mode > + (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t) Why do we need to remove `goto-address-mode' overlays if it is not enabled ((goto-address-mode t) is below is removed)? > + (make-text-button (match-beginning 0) (match-end 0) > + 'action `(lambda (arg) > + (notmuch-search ,(match-string-no-properties 0))) > + 'follow-link t > + 'help-echo "Mouse-1, RET: search for this message" > + 'face goto-address-mail-face)))) > + > ;;;###autoload > (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch) > "Run \"notmuch show\" with the given thread ID and display results. > @@ -822,9 +841,8 @@ function is used. " > (notmuch-show-insert-forest > (notmuch-query-get-threads basic-args)))) > > - ;; Enable buttonisation of URLs and email addresses in the > - ;; buffer. > - (goto-address-mode t) `goto-address-mode' creates buttons not only for email addresses but also for URLs. Do we loose it now? Regards, Dmitry > + (jit-lock-register #'notmuch-show-buttonise-links) > + > ;; Act on visual lines rather than logical lines. > (visual-line-mode t) > > -- > 1.7.5.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch