--- /dev/null
+Return-Path: <tom.hirschowitz@univ-savoie.fr>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 5FE5640C425\r
+ for <notmuch@notmuchmail.org>; Fri, 6 Jun 2014 05:21:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id ZdQAviQ+Yj0n for <notmuch@notmuchmail.org>;\r
+ Fri, 6 Jun 2014 05:20:57 -0700 (PDT)\r
+Received: from dsi-mta-out.univ-savoie.fr (dsi-mta-out.univ-savoie.fr\r
+ [193.48.126.73])\r
+ by olra.theworths.org (Postfix) with ESMTP id C9F2340CAF1\r
+ for <notmuch@notmuchmail.org>; Fri, 6 Jun 2014 05:20:56 -0700 (PDT)\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by dsi-mta-out.univ-savoie.fr (Postfix) with ESMTP id 7B26042247\r
+ for <notmuch@notmuchmail.org>; Fri, 6 Jun 2014 14:20:53 +0200 (CEST)\r
+Received: from dsi-mta-out.univ-savoie.fr ([127.0.0.1])\r
+ by localhost (dsi-mta-out.univ-savoie.fr [127.0.0.1]) (amavisd-new,\r
+ port 10026) with ESMTP id HxqaMigslDDh for <notmuch@notmuchmail.org>;\r
+ Fri, 6 Jun 2014 14:20:53 +0200 (CEST)\r
+Received: from dsi-mail-msa1.univ-savoie.fr (dsi-mail-msa1.univ-savoie.fr\r
+ [193.48.126.83])\r
+ by dsi-mta-out.univ-savoie.fr (Postfix) with ESMTP id 68A6E42184\r
+ for <notmuch@notmuchmail.org>; Fri, 6 Jun 2014 14:20:53 +0200 (CEST)\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by dsi-mail-msa1.univ-savoie.fr (Postfix) with ESMTP id 663E714096\r
+ for <notmuch@notmuchmail.org>; Fri, 6 Jun 2014 14:20:53 +0200 (CEST)\r
+X-Virus-Scanned: Debian amavisd-new at dsi-mail-msa1.univ-savoie.fr\r
+Received: from dsi-mail-msa1.univ-savoie.fr ([127.0.0.1])\r
+ by localhost (dsi-mail-msa1.univ-savoie.fr [127.0.0.1]) (amavisd-new,\r
+ port 10024) with ESMTP id cHnncTX7AkJZ for <notmuch@notmuchmail.org>;\r
+ Fri, 6 Jun 2014 14:20:53 +0200 (CEST)\r
+Received: from hirscho.lama.univ-savoie.fr (lama-d186.univ-savoie.fr\r
+ [193.48.123.186])\r
+ by dsi-mail-msa1.univ-savoie.fr (Postfix) with ESMTP id 49FF014093\r
+ for <notmuch@notmuchmail.org>; Fri, 6 Jun 2014 14:20:53 +0200 (CEST)\r
+From: Tom Hirschowitz <tom.hirschowitz@univ-savoie.fr>\r
+To: notmuch@notmuchmail.org\r
+Cc: \r
+Subject: Re: an emacs macro\r
+In-Reply-To: <8761kefdpq.fsf@qmul.ac.uk>\r
+References: <87bnu7k7j3.fsf@hirscho.lama.univ-savoie.fr>\r
+ <8761kefdpq.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.18 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 06 Jun 2014 14:20:53 +0200\r
+Message-ID: <8738fiut3u.fsf@hirscho.lama.univ-savoie.fr>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 06 Jun 2014 12:21:04 -0000\r
+\r
+\r
+Thanks, you were right, although that's what i had tried. No idea what i\r
+did wrong the first time.\r
+\r
+Here's the code in case anyone is interested (i actually tweaked *-add-tag):\r
+\r
+(defun notmuch-search-move (tag-changes &optional beg end) \r
+ "Add the local tag, plus possibly others, given as interactive arguments, \r
+for the current thread or region (defaulting to add)." \r
+ (interactive (notmuch-search-interactive-tag-changes "+")) \r
+ (notmuch-search-tag (cons "+local" tag-changes) beg end)) \r
+\r
+(defun notmuch-tree-move (tag-changes)\r
+ "Add the local tag, plus possibly others, given as interactive arguments, \r
+for the current thread or region (defaulting to add)." \r
+ (interactive\r
+ (list (notmuch-read-tag-changes (notmuch-tree-get-tags) "Tag message" "+")))\r
+ (notmuch-tree-tag (cons "+local" tag-changes)))\r
+\r
+Cheers,\r
+Tom\r
+\r
+Mark Walters <markwalters1009@gmail.com> writes:\r
+\r
+> On Thu, 05 Jun 2014, Tom Hirschowitz <tom.hirschowitz@univ-savoie.fr> wrote:\r
+>> Hi all, \r
+>>\r
+>> I'm trying to define a macro for notmuch/emacs which in show-mode would\r
+>>\r
+>> - prompt the user for tags (possibly starting with "+"),\r
+>>\r
+>> - tag the shown message with these tags plus an additional fixed tag,\r
+>> say "+local".\r
+>>\r
+>> I know next to nothing about emacs/lisp, so I tried to mimick notmuch*.el.\r
+>>\r
+>> Here's my most plausible attempt:\r
+>>\r
+>> (defun notmuch-show-move (tag-changes)\r
+>> "Add the local tag, plus possibly others, given as interactive arguments."\r
+>> (interactive (list (notmuch-read-tag-changes (notmuch-show-get-tags)\r
+>> "Tag message" "+")))\r
+>> (let* ((tag-changes-with-local (cons "+local" tag-changes))\r
+>> (rien (notmuch-tag (notmuch-show-get-message-id) tag-changes-with-local))\r
+>> (current-tags (notmuch-show-get-tags))\r
+>> (new-tags (notmuch-update-tags current-tags tag-changes-with-local)))\r
+>> (unless (equal current-tags new-tags)\r
+>> (notmuch-show-set-tags new-tags))))\r
+>\r
+> Yes this looks fine for notmuch-show. It won't work for search mode as\r
+> notmuch-show- commands basically only work in notmuch-show. I would\r
+> suggest copying notmuch-search-tag and tweaking it to use\r
+> tag-changes-with-local (as you have done for the show version\r
+> above). Something similar should work for tree-mode (ie copy\r
+> notmuch-tree-tag)\r
+>\r
+> I think you will need separate functions for the three modes.\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r