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 404B54196F0 for ; Wed, 28 Apr 2010 11:06:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 8RzJBXODz53d for ; Wed, 28 Apr 2010 11:06:29 -0700 (PDT) Received: from mail-ww0-f53.google.com (mail-ww0-f53.google.com [74.125.82.53]) by olra.theworths.org (Postfix) with ESMTP id 3FEAA431FC1 for ; Wed, 28 Apr 2010 11:06:29 -0700 (PDT) Received: by wwe15 with SMTP id 15so141610wwe.26 for ; Wed, 28 Apr 2010 11:06:28 -0700 (PDT) Received: by 10.216.159.141 with SMTP id s13mr4586390wek.64.1272477987149; Wed, 28 Apr 2010 11:06:27 -0700 (PDT) Received: from ut.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1]) by mx.google.com with ESMTPS id z34sm230022wbv.14.2010.04.28.11.06.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 28 Apr 2010 11:06:25 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 5318459411F; Wed, 28 Apr 2010 19:00:29 +0100 (BST) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Display non-matching authors in italic. Date: Wed, 28 Apr 2010 19:00:27 +0100 Message-Id: <1272477627-10562-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.0 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: Wed, 28 Apr 2010 18:06:30 -0000 In search mode some messages don't match the search criteria. Show their authors names in italic. --- Whilst enjoying knowing which authors match, I disliked the pipe symbol. This is a proposed improvement. emacs/notmuch.el | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 7457da9..0a7a398 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -576,6 +576,22 @@ matching will be applied." (t (setq tags-faces (cdr tags-faces))))))))) +(defun notmuch-search-insert-authors (format-string authors) + (insert (let* ((formatted-sample (format format-string "")) + (formatted-authors (format format-string authors)) + (truncated-string + (if (> (length formatted-authors) + (length formatted-sample)) + (concat (substring authors 0 (- (length formatted-sample) 4)) "... ") + formatted-authors))) + ;; Need to save the match data to avoid interfering with + ;; `notmuch-search-process-filter'. + (save-match-data + (if (string-match "\\(.*\\)|\\(..*\\)" truncated-string) + (concat (match-string 1 truncated-string) "," + (propertize (match-string 2 truncated-string) 'face 'italic)) + truncated-string))))) + (defun notmuch-search-insert-field (field date count authors subject tags) (cond ((string-equal field "date") @@ -583,13 +599,7 @@ matching will be applied." ((string-equal field "count") (insert (format (cdr (assoc field notmuch-search-result-format)) count))) ((string-equal field "authors") - (insert (let* ((format-string (cdr (assoc field notmuch-search-result-format))) - (formatted-sample (format format-string "")) - (formatted-authors (format format-string authors))) - (if (> (length formatted-authors) - (length formatted-sample)) - (concat (substring authors 0 (- (length formatted-sample) 4)) "... ") - formatted-authors)))) + (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors)) ((string-equal field "subject") (insert (format (cdr (assoc field notmuch-search-result-format)) subject))) ((string-equal field "tags") -- 1.7.0