From 8c1fa8e9ac8253ccd9e2030d6b7d4017df770de1 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Mon, 3 Sep 2012 13:39:56 +0200 Subject: [PATCH] Re: [PATCH 4/6] emacs: add support for custom tag changes on message/thread archive --- 81/47a1255da5f68fa0f3c3497d728c57af06e19a | 227 ++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 81/47a1255da5f68fa0f3c3497d728c57af06e19a diff --git a/81/47a1255da5f68fa0f3c3497d728c57af06e19a b/81/47a1255da5f68fa0f3c3497d728c57af06e19a new file mode 100644 index 000000000..eff00e2b7 --- /dev/null +++ b/81/47a1255da5f68fa0f3c3497d728c57af06e19a @@ -0,0 +1,227 @@ +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 AF07F431FB6 + for ; Mon, 3 Sep 2012 04:40:05 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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 a6eOWYq+onqP for ; + Mon, 3 Sep 2012 04:40:05 -0700 (PDT) +Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com + [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A4252431FAF + for ; Mon, 3 Sep 2012 04:40:04 -0700 (PDT) +Received: by eaan10 with SMTP id n10so1867278eaa.26 + for ; Mon, 03 Sep 2012 04:40:03 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=20120113; h=sender:from:to:cc:subject:in-reply-to:organization:references + :user-agent:x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version + :content-type; bh=3wE4iNbSgvt4lTGWlkXf1q2EtUlP+3SzivIJ0FAdM6c=; + b=Hn50WNDzSJjYPoZt7XLIEPPhn7uabg6HuZiFwTKyda37AI8X59EgHNqsW2kaZ9h5DC + Myk4bjd5NrLJqtHkEEB8Ou2a41Qi3i5dgyw3RBMol9hI63k86yoJ0HHB8mPiBS+KJNCZ + +DYJn4bAC1Uxbn/CEw3fL0ravhSot9jLa+rS8ZohehVwq/8IY9B5FYlEdxnjhAeTfOuR + wy7oQRwgeq86MAzEgAeoPbXeGf7bxRCL3/OEgn+JKD86QRzTdhDjrV5wCIIxv288qa8b + YmLw69mEdFSwWcVtCwL21zslLb5n3WyiZVK7AMKctRuDFxwov+4ZIBaaO7F2OvfxozdY 3lvQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=sender:from:to:cc:subject:in-reply-to:organization:references + :user-agent:x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version + :content-type:x-gm-message-state; + bh=3wE4iNbSgvt4lTGWlkXf1q2EtUlP+3SzivIJ0FAdM6c=; + b=kOM60nQjwzvOYza7vbEPjL9WZA/0cjHHHl3AMYrJUuxTueH45wVpEV2fhboNiQaCHs + 3JtxuRfu9IGFd6kiAmER8nEiO14MuUFOzas69TErQk88gcpbXMVvnd/W79IwhddcoAZ6 + ELyBvO6cgEBS48hzd1iYj7ire+9RTAmTPAvUT7Qf1Gb+3Y4Mjp/60NHWDpBwGhCZDOaV + w0G7jCI38qrHx8dXcw7Bt9KqH9RVrUPBpazEDcNUwzHcCcNGin5q86NiRwZD+H5aHRvG + Wpr5RKYjxkm72NxYx82M6USrlpeMY8EWH8OZ7R/khkw8rMuGyeMFMMHGe8a7EewnB6Is + DtDg== +Received: by 10.14.209.129 with SMTP id s1mr21139320eeo.24.1346672403417; + Mon, 03 Sep 2012 04:40:03 -0700 (PDT) +Received: by 10.14.209.129 with SMTP id s1mr21139309eeo.24.1346672403265; + Mon, 03 Sep 2012 04:40:03 -0700 (PDT) +Received: from mpn-glaptop ([2620:0:105f:5:f2de:f1ff:fe35:1a72]) + by mx.google.com with ESMTPS id 9sm35730580eei.12.2012.09.03.04.40.01 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 03 Sep 2012 04:40:02 -0700 (PDT) +Sender: Michal Nazarewicz +From: Michal Nazarewicz +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH 4/6] emacs: add support for custom tag changes on + message/thread archive +In-Reply-To: + <0907a84d74600df18b8663c28c26f9f7bc2f31c2.1346614915.git.jani@nikula.org> +Organization: http://mina86.com/ +References: + <0907a84d74600df18b8663c28c26f9f7bc2f31c2.1346614915.git.jani@nikula.org> +User-Agent: Notmuch/0.14+2~g416b120 (http://notmuchmail.org) Emacs/24.2.50.1 + (x86_64-unknown-linux-gnu) +X-Face: PbkBB1w#)bOqd`iCe"Ds{e+!C7`pkC9a|f)Qo^BMQvy\q5x3?vDQJeN(DS?|-^$uMti[3D*#^_Ts"pU$jBQLq~Ud6iNwAw_r_o_4]|JO?]}P_}Nc&"p#D(ZgUb4uCNPe7~a[DbPG0T~!&c.y$Ur,=N4RT>]dNpd; KFrfMCylc}gc??'U2j,!8%xdD +Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACQElEQVQ4jW3TMWvbQBQHcBk1xE6WyALX1069oZBMlq+ouUwpEQQ6uRjttkWP4CmBgGM0BQLBdPFZYPsyFUo6uEtKDQ7oy/U96XR2Ux8ehH/89Z6enqxBcS7Lg81jmSuujrfCZcLI/TYYvbGj+jbgFpHJ/bqQAUISj8iLyu4LuFHJTosxsucO4jSDNE0Hq3hwK/ceQ5sx97b8LcUDsILfk+ovHkOIsMbBfg43VuQ5Ln9YAGCkUdKJoXR9EclFBhixy3EGVz1K6eEkhxCAkeMMnqoAhAKwhoUJkDrCqvbecaYINlFKSRS1i12VKH1XpUd4qxL876EkMcDvHj3s5RBajHHMlA5iK32e0C7VgG0RlzFPvoYHZLRmAC0BmNcBruhkE0KsMsbEc62ZwUJDxWUdMsMhVqovoT96i/DnX/ASvz/6hbCabELLk/6FF/8PNpPCGqcZTGFcBhhAaZZDbQPaAB3+KrWWy2XgbYDNIinkdWAFcCpraDE/knwe5DBqGmgzESl1p2E4MWAz0VUPgYYzmfWb9yS4vCvgsxJriNTHoIBz5YteBvg+VGISQWUqhMiByPIPpygeDBE6elD973xWwKkEiHZAHKjhuPsFnBuArrzxtakRcISv+XMIPl4aGBUJm8Emk7qBYU8IlgNEIpiJhk/No24jHwkKTFHDWfPniR4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC +X-PGP: 50751FF4 +X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 +Date: Mon, 03 Sep 2012 13:39:56 +0200 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="=-=-=" +X-Gm-Message-State: ALoCoQmmlCKwMvDnCNUo1eWGicHZSIPhcn2Apw53Z7ybJuNozeb9pfMX3wxvMN/7d9Sq244BqZt+doPXmPQXD4EKUhFN0I5dTeUMixMZsKMYoiODUO9dQlR1l3h4EPx2GROMEMkw+qTe46RKQjbrNegsTywuG9xW3S1p3Rh0DArWse6x9uj/FO16A65OVIJU0yG6WkHK94S5 +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: Mon, 03 Sep 2012 11:40:05 -0000 + +--=-=-= +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +Jani Nikula writes: +> Add support for customization of the tag changes that are applied when +> a message or a thread is archived. Instead of hard-coded removal of +> the "inbox" tag, the user can now specify a list of tag changes to +> perform. + +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index ce5ea6f..e701aec 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1748,18 +1748,20 @@ argument, hide all of the messages." +> (defun notmuch-show-archive-thread (&optional unarchive) +> "Archive each message in thread. +>=20=20 +> -Archive each message currently shown by removing the \"inbox\" +> -tag from each. If a prefix argument is given, the messages will +> -be \"unarchived\" (ie. the \"inbox\" tag will be added instead of +> -removed). +> +Archive each message currently shown by applying the tag changes +> +in `notmuch-archive-tags' to each (remove the \"inbox\" tag by +> +default). If a prefix argument is given, the messages will be +> +\"unarchived\", i.e. the tag changes in `notmuch-archive-tags' +> +will be reversed. +>=20=20 +> Note: This command is safe from any race condition of new messages +> being delivered to the same thread. It does not archive the +> entire thread, but only the messages shown in the current +> buffer." +> (interactive "P") +> - (let ((op (if unarchive "+" "-"))) +> - (notmuch-show-tag-all (concat op "inbox")))) +> + (when notmuch-archive-tags + +Strictly speaking (when) should not be needed here (an in the following +changes). Or is it? + +> + (notmuch-show-tag-all +> + (notmuch-tag-change-list notmuch-archive-tags unarchive)))) +>=20=20 +> (defun notmuch-show-archive-thread-then-next () +> "Archive all messages in the current buffer, then show next thread fro= +m search." +> @@ -1774,14 +1776,17 @@ buffer." +> (notmuch-show-next-thread)) +>=20=20 +> (defun notmuch-show-archive-message (&optional unarchive) +> - "Archive the current message (remove \"inbox\" tag). +> + "Archive the current message. +>=20=20 +> -If a prefix argument is given, the message will be +> -\"unarchived\" (ie. the \"inbox\" tag will be added instead of +> -removed)." +> +Archive the current message by applying the tag changes in +> +`notmuch-archive-tags' to it (remove the \"inbox\" tag by +> +default). If a prefix argument is given, the message will be +> +\"unarchived\", i.e. the tag changes in `notmuch-archive-tags' +> +will be reversed." +> (interactive "P") +> - (let ((op (if unarchive "+" "-"))) +> - (notmuch-show-tag-message (concat op "inbox")))) +> + (when notmuch-archive-tags +> + (apply 'notmuch-show-tag-message +> + (notmuch-tag-change-list notmuch-archive-tags unarchive)))) +>=20=20 +> (defun notmuch-show-archive-message-then-next-or-exit () +> "Archive the current message, then show the next open message in the c= +urrent thread. +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index 1c43d3e..64caa3e 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -594,11 +594,19 @@ See `notmuch-tag' for information on the format of = +TAG-CHANGES." +> (notmuch-search-tag "-")) +>=20=20 +> (defun notmuch-search-archive-thread () +> - "Archive the currently selected thread (remove its \"inbox\" tag). +> + "Archive the currently selected thread. +> + +> +Archive each message in the currently selected thread by applying +> +the tag changes in `notmuch-archive-tags' to each (remove the +> +\"inbox\" tag by default). If a prefix argument is given, the +> +messages will be \"unarchived\" (i.e. the tag changes in +> +`notmuch-archive-tags' will be reversed). +>=20=20 +> This function advances the next thread when finished." +> (interactive) +> - (notmuch-search-tag '("-inbox")) +> + (when notmuch-archive-tags +> + (notmuch-search-tag +> + (notmuch-tag-change-list notmuch-archive-tags))) +> (notmuch-search-next-thread)) +>=20=20 +> (defun notmuch-search-update-result (result &optional pos) +> --=20 +> 1.7.9.5 +> + +--=20 +Best regards, _ _ +.o. | Liege of Serenely Enlightened Majesty of o' \,=3D./ `o +..o | Computer Science, Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz = + (o o) +ooo +------------------ooO--(_)--Ooo-- +--=-=-= +Content-Type: multipart/signed; boundary="==-=-="; + micalg=pgp-sha1; protocol="application/pgp-signature" + +--==-=-= +Content-Type: text/plain + + +--==-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.10 (GNU/Linux) + +iQIcBAEBAgAGBQJQRJcMAAoJECBgQBJQdR/0/vAP+QGmFTurOYg3/AZL595B5ABD +JdvclbsN1NTvZM3sJu4qJ9+G1Ewio5SkO9T5d/Ol8IArxz27Lmg1Grq20CpxCJxQ +HzqsSkHu4HGdep57378n0qF3jdcJmaChbzjML0pP+IPng3fgW2r8B2O0R981NbRe +kYF0ZJXnK6PJM1YlkQvjLcEMqV53zW/HpS2R+wVB6Vig5LBaiATW4yDjym+XhMIh +aDXCZsNujd1Rki6Kw7vHUPyr6x56gEf1hM2NkdsWad1+LIIJStwfRME6R3rwKZe5 +8xfDf+GhjxVVLzSZOFE5zAagDBd/ML0FHE5n5hNx9XThMLojODjpalmux1Pul+0p +uStPgdmed5UYsh04SBzPpdEBzIN6mMJ9jq8PjDc1yalIP7CaMBQiO9tBr88p2bF7 +6spKaiwICE45YV0B5wfNeDIaOkpYq/E0QZFuKcQ4CYrOmtk5EoEqyhd0WlZ6hDxu +J28bpvmDZMgjsPITKWuSQBpeL+N0upqPgTuSSgO/LnwBN5KGSnqCcykC79Iz0nst +Xioup3o62Nif0hLluKuqNQ1VRXE9dwlvq6ayRZNQQgrKfehzMkV25PY1bkAYSlBx +U5UwQymTQpX88rsAfCvLz3E6EJesNIkexcYAKNtOrE2vVuf6Q0NdlFa1fW6UxDcw +iL/dt3xsQPlgR/4EB4Xo +=9lOb +-----END PGP SIGNATURE----- +--==-=-=-- + +--=-=-=-- -- 2.26.2