Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / c2 / 4b20d03341e7f10f0de6f6a90a847c1f015c72
1 Return-Path: <amdragon@mit.edu>\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 464EA431FAF\r
6         for <notmuch@notmuchmail.org>; Wed,  9 Oct 2013 07:14:33 -0700 (PDT)\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 QI2Cz-hAIl6c for <notmuch@notmuchmail.org>;\r
16         Wed,  9 Oct 2013 07:14:28 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id 69794431FAE\r
20         for <notmuch@notmuchmail.org>; Wed,  9 Oct 2013 07:14:28 -0700 (PDT)\r
21 X-AuditID: 12074423-b7fc98e0000009a2-5c-525564c306d9\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id E7.CF.02466.3C465525; Wed,  9 Oct 2013 10:14:27 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r99EEQHb006239; \r
27         Wed, 9 Oct 2013 10:14:27 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r99EEPCp021588\r
32         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
33         Wed, 9 Oct 2013 10:14:26 -0400\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1VTuWu-00050f-UC; Wed, 09 Oct 2013 10:14:24 -0400\r
37 Date: Wed, 9 Oct 2013 10:14:24 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH 07/11] emacs: Use notmuch tag --batch for large tag\r
41  queries\r
42 Message-ID: <20131009141424.GP21611@mit.edu>\r
43 References: <1381185201-25197-1-git-send-email-amdragon@mit.edu>\r
44         <1381185201-25197-8-git-send-email-amdragon@mit.edu>\r
45         <87iox6ap58.fsf@nikula.org> <87d2ne28sj.fsf@qmul.ac.uk>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 Content-Disposition: inline\r
49 In-Reply-To: <87d2ne28sj.fsf@qmul.ac.uk>\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)\r
51 X-Brightmail-Tracker:\r
52  H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42IR4hTV1j2cEhpksPSglkXTdGeL1XN5LK7f\r
53         nMnswOyxc9Zddo9b91+zezxbdYs5gDmKyyYlNSezLLVI3y6BK6P55VKmgq+SFTum9rM2MG4Q\r
54         6WLk5JAQMJHoP3eLDcIWk7hwbz2QzcUhJLCPUeLn/A52CGcDo8SP+2+ZIZxTTBLHtzSyQjhL\r
55         GCXmr+1hBOlnEVCReNc1CWwWm4CGxLb9y8HiIgI6ErcPLWAHsZkFrCQatnwAiwsLBEpc3dwO\r
56         NIiDgxeoZk5jGcTMzYwSe45OYgap4RUQlDg58wkLRK+WxI1/L5lA6pkFpCWW/+MACXMCrbrS\r
57         28MKYosCnTDl5Da2CYxCs5B0z0LSPQuhewEj8ypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdM73c\r
58         zBK91JTSTYygQGd3Ud7B+Oeg0iFGAQ5GJR7eDt6QICHWxLLiytxDjJIcTEqivNtjQoOE+JLy\r
59         UyozEosz4otKc1KLDzFKcDArifAaRwPleFMSK6tSi/JhUtIcLErivLc47IOEBNITS1KzU1ML\r
60         UotgsjIcHEoSvD3JQI2CRanpqRVpmTklCGkmDk6Q4TxAw7eB1PAWFyTmFmemQ+RPMSpKifMe\r
61         B0kIgCQySvPgemGJ6BWjONArwry7QKp4gEkMrvsV0GAmoMHbv4eADC5JREhJNTAGrP+oJt/w\r
62         WOPYf5EIE73sPTcPfyyq3pW2dddB5QXWez8miL4+LrQhdFtc9fSieo3ffbu9D0keuD9fTvpG\r
63         6dfe3BlXZbZtecki/mfLVSbO1D8yn9m7v9wPf8J80TxaymPdQ53lmleWdU15KMD8/2J3+7Nj\r
64         q08/Clc4udDv4fpujsi9z5R7O7jMlViKMxINtZiLihMB5Mwz8x8DAAA=\r
65 Cc: notmuch@notmuchmail.org\r
66 X-BeenThere: notmuch@notmuchmail.org\r
67 X-Mailman-Version: 2.1.13\r
68 Precedence: list\r
69 List-Id: "Use and development of the notmuch mail system."\r
70         <notmuch.notmuchmail.org>\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
74 List-Post: <mailto:notmuch@notmuchmail.org>\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
77         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
78 X-List-Received-Date: Wed, 09 Oct 2013 14:14:33 -0000\r
79 \r
80 Quoth Mark Walters on Oct 09 at  8:38 am:\r
81\r
82 > On Wed, 09 Oct 2013, Jani Nikula <jani@nikula.org> wrote:\r
83 > > On Tue, 08 Oct 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
84 > >> (Unfortunately, it's difficult to first demonstrate this problem with\r
85 > >> a known-broken test because modern Linux kernels have argument length\r
86 > >> limits in the megabytes, which makes Emacs really slow!)\r
87 > >> ---\r
88 > >>  emacs/notmuch-lib.el |  8 ++++++++\r
89 > >>  emacs/notmuch-tag.el | 12 ++++++++++--\r
90 > >>  test/emacs           |  8 ++++++++\r
91 > >>  3 files changed, 26 insertions(+), 2 deletions(-)\r
92 > >>\r
93 > >> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
94 > >> index 22156f1..348112b 100644\r
95 > >> --- a/emacs/notmuch-lib.el\r
96 > >> +++ b/emacs/notmuch-lib.el\r
97 > >> @@ -261,6 +261,14 @@ user-friendly queries."\r
98 > >>    "Return a query that matches the message with id ID."\r
99 > >>    (concat "id:" (notmuch-escape-boolean-term id)))\r
100 > >>  \r
101 > >> +(defun notmuch-hex-encode (str)\r
102 > >> +  "Hex-encode STR (e.g., as used by batch tagging).\r
103 > >> +\r
104 > >> +This replaces spaces, percents, and double quotes in STR with\r
105 > >> +%NN where NN is the hexadecimal value of the character."\r
106 > >> +  (replace-regexp-in-string\r
107 > >> +   "[ %\"]" (lambda (match) (format "%%%02x" (aref match 0))) str))\r
108 > >> +\r
109 > >>  ;;\r
110 > >>  \r
111 > >>  (defun notmuch-common-do-stash (text)\r
112 > >> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
113 > >> index 064cfa8..a4eec14 100644\r
114 > >> --- a/emacs/notmuch-tag.el\r
115 > >> +++ b/emacs/notmuch-tag.el\r
116 > >> @@ -242,6 +242,8 @@ from TAGS if present."\r
117 > >>       (error "Changed tag must be of the form `+this_tag' or `-that_tag'")))))\r
118 > >>      (sort result-tags 'string<)))\r
119 > >>  \r
120 > >> +(defconst notmuch-tag-argument-limit 1000)\r
121 > >> +\r
122 > >>  (defun notmuch-tag (query &optional tag-changes)\r
123 > >>    "Add/remove tags in TAG-CHANGES to messages matching QUERY.\r
124 > >>  \r
125 > >> @@ -268,8 +270,14 @@ notmuch-after-tag-hook will be run."\r
126 > >>    tag-changes)\r
127 > >>    (unless (null tag-changes)\r
128 > >>      (run-hooks 'notmuch-before-tag-hook)\r
129 > >> -    (apply 'notmuch-call-notmuch-process "tag"\r
130 > >> -     (append tag-changes (list "--" query)))\r
131 > >> +    (if (<= (length query) notmuch-tag-argument-limit)\r
132 > >> +  (apply 'notmuch-call-notmuch-process "tag"\r
133 > >> +         (append tag-changes (list "--" query)))\r
134 > >> +      ;; Use batch tag mode to avoid argument length limitations\r
135 > >> +      (let ((batch-op (concat (mapconcat #'notmuch-hex-encode tag-changes " ")\r
136 > >> +                        " -- " query)))\r
137 > >> +  (message "Batch tagging with %s" batch-op)\r
138 > >\r
139 > > Why the message?\r
140 > >\r
141 > > Jani.\r
142\r
143 > I had missed that: this message is presumably for debugging as it\r
144 > includes the (possibly megabyte sized) query. I think some message would\r
145 > be sensible as this could be a slow operation so it's probably worth\r
146 > telling the user why the interface has locked.\r
147 \r
148 You're right, this was a leftover debug message.  While I wouldn't\r
149 mind a progress message for long tagging operations, query length\r
150 isn't a good approximation of how long it's going to take.  I was\r
151 planning to include messages on tagging operations in my undo series,\r
152 which I think can do it in a more principled way (assuming I can find\r
153 a clean way to update tags in the UI on undo).\r
154 \r
155 > Best wishes\r
156\r
157 > Mark\r