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