Re: [PATCH 3/6] emacs: modify notmuch-search-tag to not prompt if tags provided as...
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Mon, 2 Apr 2012 08:44:21 +0000 (12:44 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:59 +0000 (09:45 -0800)
22/5493bc9e4ae07e84e475b0a6afe9f5c24819ea [new file with mode: 0644]

diff --git a/22/5493bc9e4ae07e84e475b0a6afe9f5c24819ea b/22/5493bc9e4ae07e84e475b0a6afe9f5c24819ea
new file mode 100644 (file)
index 0000000..e2ab6a9
--- /dev/null
@@ -0,0 +1,135 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\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 0CB21431FC7\r
+       for <notmuch@notmuchmail.org>; Mon,  2 Apr 2012 01:46:05 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 vxrxGQBNc427 for <notmuch@notmuchmail.org>;\r
+       Mon,  2 Apr 2012 01:46:04 -0700 (PDT)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 2DE9D431FC2\r
+       for <notmuch@notmuchmail.org>; Mon,  2 Apr 2012 01:46:04 -0700 (PDT)\r
+Received: by bkwj4 with SMTP id j4so2268844bkw.26\r
+       for <notmuch@notmuchmail.org>; Mon, 02 Apr 2012 01:46:02 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:date:message-id:mime-version\r
+       :content-type; bh=YPx3CbtnXE9A9WQ9+Txqlpc+6iSY5BTzADWCxW1SZ58=;\r
+       b=AbmiHFKval4icQ/E39BXIDI428ENOsoeCWoB4iFg2WyXBl1jIo+lJlPlkwrxb6z8LZ\r
+       Pqgut6oJ+bDKrranlh8BKO+wQtqe49pfXPMyDrbG/omkfmYObIoCb3bFr5LUzdpEzzu3\r
+       iUeW7fiC5lm6khOc6KD+VNblLlS13E0fs2xxGDozVD7RiGNha53qojPG97XxkRoS/8PE\r
+       +liDoyDdmHIe7LxpE7fZqqkTVvS4XPQfBqlVzFtxTbJIN1ZEAATyumAXXNXJLYXl0k/r\r
+       s0eHFhHhAFn2rjvIXLBjZKo1F4tTGEeK3pjcmSkxBY9psG7NjUOCO2bJdWxE/RAa2rJP\r
+       IyNA==\r
+Received: by 10.205.136.12 with SMTP id ii12mr2984691bkc.98.1333356362895;\r
+       Mon, 02 Apr 2012 01:46:02 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id z14sm33708804bky.15.2012.04.02.01.46.01\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 02 Apr 2012 01:46:01 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
+       Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH 3/6] emacs: modify notmuch-search-tag to not prompt if\r
+       tags provided as argument\r
+In-Reply-To: <1333354853-25729-4-git-send-email-jrollins@finestructure.net>\r
+References: <1333354853-25729-1-git-send-email-jrollins@finestructure.net>\r
+       <1333354853-25729-2-git-send-email-jrollins@finestructure.net>\r
+       <1333354853-25729-3-git-send-email-jrollins@finestructure.net>\r
+       <1333354853-25729-4-git-send-email-jrollins@finestructure.net>User-Agent:\r
+       Notmuch/0.12+70~g06ecbeb (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 02 Apr 2012 12:44:21 +0400\r
+Message-ID: <874nt2ikuy.fsf@gmail.com>\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: Mon, 02 Apr 2012 08:46:05 -0000\r
+\r
+Jameson Graef Rollins <jrollins@finestructure.net> writes:\r
+\r
+> If the argument is a full string or a list, the function will assume\r
+> this is a tag string or list and will not prompt the user.  If the\r
+> argument is nil or the exact strings "-" or "+" then the user will be\r
+> prompted.\r
+>\r
+> The function doc is updated accordingly.\r
+> ---\r
+>  emacs/notmuch.el |   16 ++++++++++++----\r
+>  1 files changed, 12 insertions(+), 4 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index 0ab8fc2..3b78584 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -646,13 +646,21 @@ added or removed for all threads in the region from BEG to END."\r
+>         (notmuch-update-tags (notmuch-search-get-tags) tag-changes))\r
+>        (forward-line))))))\r
+>  \r
+> -(defun notmuch-search-tag (&optional initial-input)\r
+> -  "Change tags for the currently selected thread or region."\r
+> +(defun notmuch-search-tag (&optional tags)\r
+> +  "Change tags for the currently selected thread or region.\r
+> +\r
+> +If TAGS is a string or list it will be interpreted as tags to\r
+> +apply to the selected messages.  If TAGS is nil or either of the\r
+> +strings `-' or `+' the user will be prompted to enter tags (with\r
+> +tab completion)."\r
+\r
+The TAGS argument name may be confusing.  Other tagging functions tend\r
+to use TAG-CHANGES for these.  Can you please change the argument name\r
+here for consistency?\r
+\r
+>    (interactive)\r
+>    (let* ((beg (if (region-active-p) (region-beginning) (point)))\r
+>       (end (if (region-active-p) (region-end) (point)))\r
+> -     (search-string (notmuch-search-find-thread-id-region-search beg end))\r
+> -     (tags (notmuch-read-tag-changes initial-input search-string)))\r
+> +     (search-string (notmuch-search-find-thread-id-region-search beg end)))\r
+> +    (if (string-or-null-p tags)\r
+> +    (if (or (string= tags "-") (string= tags "+") (eq tags nil))\r
+\r
+Should we add a check for an empty string?\r
+\r
+Please use `null'.\r
+\r
+> +        (setq tags (notmuch-read-tag-changes tags search-string))\r
+> +      (setq tags (list tags))))\r
+\r
+Should we change `notmuch-tag' to accept strings instead of handling it\r
+here?\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+>      (apply 'notmuch-search-tag-region beg end tags)))\r
+>  \r
+>  (defun notmuch-search-add-tag ()\r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r