Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 66 / 3812f755feacd3b6d4b60911179efc2c6c6cf2
1 Return-Path: <dmitry.kurochkin@gmail.com>\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 CEEF3431FBC\r
6         for <notmuch@notmuchmail.org>; Sat,  4 Feb 2012 23:15:32 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, 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 IyQqlkexlLG0 for <notmuch@notmuchmail.org>;\r
17         Sat,  4 Feb 2012 23:15:32 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.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 D7611431FB6\r
22         for <notmuch@notmuchmail.org>; Sat,  4 Feb 2012 23:15:31 -0800 (PST)\r
23 Received: by mail-bk0-f53.google.com with SMTP id 11so4650313bke.26\r
24         for <notmuch@notmuchmail.org>; Sat, 04 Feb 2012 23:15:31 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
27         bh=JPT75zPSVGwHN7gHBViIZRBzPpnwMwDhN+K8p/o1his=;\r
28         b=lcpFmQAT3N26oxXL0+iE+p4FttDRQ5zTnN9PYcCGc3ZVXlh5N2HLZXXyY9P7abcluK\r
29         l9A1XzRLlPuyiU/pLG1cABTqf0Psbk4Usfi9j9wdWYTVLIbR0HBgeTdz8JaeL4NspEPd\r
30         DBGyM16KVc1u9Dy98Kqlk+GTW8zLjT4OWVQ7A=\r
31 Received: by 10.205.124.17 with SMTP id gm17mr6168088bkc.69.1328426131545;\r
32         Sat, 04 Feb 2012 23:15:31 -0800 (PST)\r
33 Received: from localhost ([91.144.186.21])\r
34         by mx.google.com with ESMTPS id x20sm33003859bka.9.2012.02.04.23.15.30\r
35         (version=TLSv1/SSLv3 cipher=OTHER);\r
36         Sat, 04 Feb 2012 23:15:31 -0800 (PST)\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v5 07/12] emacs: add "*" binding for notmuch-show view\r
40 Date: Sun,  5 Feb 2012 11:13:48 +0400\r
41 Message-Id: <1328426033-21480-8-git-send-email-dmitry.kurochkin@gmail.com>\r
42 X-Mailer: git-send-email 1.7.9\r
43 In-Reply-To: <1328426033-21480-1-git-send-email-dmitry.kurochkin@gmail.com>\r
44 References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45         <1328426033-21480-1-git-send-email-dmitry.kurochkin@gmail.com>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Sun, 05 Feb 2012 07:15:33 -0000\r
59 \r
60 The patch adds `notmuch-show-tag-all' function bound to "*" in\r
61 notmuch-show view.  The function is similar to the\r
62 `notmuch-search-tag-all' function for the notmuch-search view: it\r
63 changes tags for all messages in the current thread.\r
64 ---\r
65  emacs/notmuch-show.el |   35 +++++++++++++++++++++++++++++++++++\r
66  1 files changed, 35 insertions(+), 0 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
69 index 48a2a60..faa9f9b 100644\r
70 --- a/emacs/notmuch-show.el\r
71 +++ b/emacs/notmuch-show.el\r
72 @@ -1084,6 +1084,7 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
73         (define-key map "c" 'notmuch-show-stash-map)\r
74         (define-key map "=" 'notmuch-show-refresh-view)\r
75         (define-key map "h" 'notmuch-show-toggle-headers)\r
76 +       (define-key map "*" 'notmuch-show-tag-all)\r
77         (define-key map "-" 'notmuch-show-remove-tag)\r
78         (define-key map "+" 'notmuch-show-add-tag)\r
79         (define-key map "x" 'notmuch-show-archive-thread-then-exit)\r
80 @@ -1181,6 +1182,15 @@ All currently available key bindings:\r
81      (notmuch-show-move-to-message-top)\r
82      t))\r
83  \r
84 +(defun notmuch-show-mapc (function)\r
85 +  "Iterate through all messages in the current thread with\r
86 +`notmuch-show-goto-message-next' and call FUNCTION for side\r
87 +effects."\r
88 +  (save-excursion\r
89 +    (goto-char (point-min))\r
90 +    (loop do (funcall function)\r
91 +         while (notmuch-show-goto-message-next))))\r
92 +\r
93  ;; Functions relating to the visibility of messages and their\r
94  ;; components.\r
95  \r
96 @@ -1233,6 +1243,18 @@ Some useful entries are:\r
97    "Return the message id of the current message."\r
98    (concat "id:\"" (notmuch-show-get-prop :id) "\""))\r
99  \r
100 +(defun notmuch-show-get-messages-ids ()\r
101 +  "Return all message ids of messages in the current thread."\r
102 +  (let ((message-ids))\r
103 +    (notmuch-show-mapc\r
104 +     (lambda () (push (notmuch-show-get-message-id) message-ids)))\r
105 +    message-ids))\r
106 +\r
107 +(defun notmuch-show-get-messages-ids-search ()\r
108 +  "Return a search string for all message ids of messages in the\r
109 +current thread."\r
110 +  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))\r
111 +\r
112  ;; dme: Would it make sense to use a macro for many of these?\r
113  \r
114  (defun notmuch-show-get-filename ()\r
115 @@ -1513,6 +1535,19 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."\r
116                       initial-input (notmuch-show-get-message-id))))\r
117      (apply 'notmuch-show-tag-message tag-changes)))\r
118  \r
119 +(defun notmuch-show-tag-all (&rest tag-changes)\r
120 +  "Change tags for all messages in the current thread.\r
121 +\r
122 +TAG-CHANGES is a list of tag operations for `notmuch-tag'."\r
123 +  (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))\r
124 +  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)\r
125 +  (notmuch-show-mapc\r
126 +   (lambda ()\r
127 +     (let* ((current-tags (notmuch-show-get-tags))\r
128 +           (new-tags (notmuch-update-tags current-tags tag-changes)))\r
129 +       (unless (equal current-tags new-tags)\r
130 +        (notmuch-show-set-tags new-tags))))))\r
131 +\r
132  (defun notmuch-show-add-tag ()\r
133    "Same as `notmuch-show-tag' but sets initial input to '+'."\r
134    (interactive)\r
135 -- \r
136 1.7.9\r
137 \r