Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man
[notmuch-archives.git] / 83 / 7284120f8ade66b23e8f5eaee179247ac7b636
1 Return-Path: <pieter@praet.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 9AE55429E37\r
6         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:25:48 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id QR1TMh8i7tIb for <notmuch@notmuchmail.org>;\r
16         Thu, 12 Jan 2012 09:25:48 -0800 (PST)\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
18         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 064DA429E30\r
21         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:25:47 -0800 (PST)\r
22 Received: by werm12 with SMTP id m12so1808422wer.26\r
23         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:25:46 -0800 (PST)\r
24 Received: by 10.216.135.208 with SMTP id u58mr254136wei.56.1326389146877;\r
25         Thu, 12 Jan 2012 09:25:46 -0800 (PST)\r
26 Received: from localhost ([109.131.126.209])\r
27         by mx.google.com with ESMTPS id g12sm10093619wiw.10.2012.01.12.09.25.46\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Thu, 12 Jan 2012 09:25:46 -0800 (PST)\r
30 From: Pieter Praet <pieter@praet.org>\r
31 To: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 Subject: [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only\r
33         `notmuch-show's a message if it exists\r
34 Date: Thu, 12 Jan 2012 18:23:44 +0100\r
35 Message-Id: <1326389025-18877-2-git-send-email-pieter@praet.org>\r
36 X-Mailer: git-send-email 1.7.8.1\r
37 In-Reply-To: <1326389025-18877-1-git-send-email-pieter@praet.org>\r
38 References: <874nw0ltwz.fsf@praet.org>\r
39         <1326389025-18877-1-git-send-email-pieter@praet.org>\r
40 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Thu, 12 Jan 2012 17:25:48 -0000\r
54 \r
55 * emacs/notmuch-show.el (notmuch-show-found-target-p): new predicate function\r
56   that uses notmuch(1) 'count' to see if a query turns up any results.\r
57 \r
58 * emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows\r
59   a message/thread if present in the database and otherwise returns an error.\r
60 \r
61 * emacs/notmuch-show.el (notmuch-show-buttonize-links): some deduplication,\r
62   and use new function `notmuch-show-if-found' instead of `notmuch-show'\r
63   to prevent showing a blank screen for Message-Id's which aren't present\r
64   in the database.\r
65 ---\r
66  emacs/notmuch-show.el |   21 ++++++++++++++++++---\r
67  1 files changed, 18 insertions(+), 3 deletions(-)\r
68 \r
69 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
70 index c55a1d1..8f12955 100644\r
71 --- a/emacs/notmuch-show.el\r
72 +++ b/emacs/notmuch-show.el\r
73 @@ -806,11 +806,14 @@ a corresponding notmuch search."\r
74    (save-excursion\r
75      (goto-char start)\r
76      (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+\\1" end t)\r
77 +      (let ((message-id (match-string-no-properties 0))\r
78 +           (string-start (match-beginning 0))\r
79 +           (string-end (match-end 0)))\r
80        ;; remove the overlay created by goto-address-mode\r
81 -      (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)\r
82 -      (make-text-button (match-beginning 0) (match-end 0)\r
83 +      (remove-overlays string-start string-end 'goto-address t)\r
84 +      (make-text-button string-start string-end\r
85                         'action `(lambda (arg)\r
86 -                                  (notmuch-show ,(match-string-no-properties 0)))\r
87 +                                  (notmuch-show-if-found ,message-id))\r
88                         'follow-link t\r
89                         'help-echo "Mouse-1, RET: search for this message"\r
90                         'face goto-address-mail-face))))\r
91 @@ -906,6 +909,18 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
92      (notmuch-kill-this-buffer)\r
93      (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))\r
94  \r
95 +(defun notmuch-show-found-target-p (target)\r
96 +  (let ((args `("count" ,target)))\r
97 +    (> (string-to-number (substring\r
98 +      (with-output-to-string\r
99 +        (apply 'call-process notmuch-command nil standard-output nil args))\r
100 +      0 -1)) 0)))\r
101 +\r
102 +(defun notmuch-show-if-found (target &rest args)\r
103 +  (if (notmuch-show-found-target-p target nil)\r
104 +      (notmuch-show target args)\r
105 +    (error (format "Can't find target: %s" target))))\r
106 +\r
107  (defvar notmuch-show-stash-map\r
108    (let ((map (make-sparse-keymap)))\r
109      (define-key map "c" 'notmuch-show-stash-cc)\r
110 -- \r
111 1.7.8.1\r
112 \r