From: Michal Nazarewicz <mina86@mina86.com>
To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH 1/6] emacs: add helper for tag change list manipulation
Date: Mon, 03 Sep 2012 13:33:55 +0200 [thread overview]
Message-ID: <xa1tipbvwdb0.fsf@mina86.com> (raw)
In-Reply-To: <9dbf16fb95f40812ad246f95b954681bc895ceb2.1346614915.git.jani@nikula.org>
[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]
Jani Nikula <jani@nikula.org> writes:
> Add a helper to create (and optionally reverse) a list of tag changes.
> ---
> emacs/notmuch-tag.el | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index 0c0fc87..c1aeb99 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -140,6 +140,23 @@ notmuch-after-tag-hook will be run."
> ;; in all cases we return tag-changes as a list
> tag-changes)
>
> +(defun notmuch-tag-change-list (tags &optional reverse)
> + "Convert TAGS into a list of tag changes.
> +
> +Add a \"+\" prefix to any tag in TAGS list that doesn't already
> +begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
> +\"+\" prefixes with \"-\" and vice versa in the result."
> + (mapcar (lambda (str)
> + (let ((s (if (not (string-match "^[+-]" str))
> + (concat "+" str)
> + str)))
(if (string-match "^[-+]" str) str (concat "+" str))
Negation only makes things less readable IMO.
> + (if reverse
> + (concat (if (= (string-to-char s) ?-) "+" "-")
> + (substring s 1))
> + s)))
> + tags))
> +
> +
> ;;
>
> (provide 'notmuch-tag)
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--
[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2.2: Type: application/pgp-signature, Size: 835 bytes --]
next prev parent reply other threads:[~2012-09-03 11:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-02 19:57 [PATCH 0/6] emacs: customization for tag changes on archive Jani Nikula
2012-09-02 19:58 ` [PATCH 1/6] emacs: add helper for tag change list manipulation Jani Nikula
2012-09-03 11:33 ` Michal Nazarewicz [this message]
2012-09-03 12:06 ` Jani Nikula
2012-09-06 14:30 ` Tomi Ollila
2012-09-06 15:35 ` Jani Nikula
2012-09-02 19:58 ` [PATCH 2/6] emacs: fix notmuch-message-replied-tags defcustom type Jani Nikula
2012-09-02 19:58 ` [PATCH 3/6] emacs: use new tag change helper to mark messages as replied Jani Nikula
2012-09-02 19:58 ` [PATCH 4/6] emacs: add support for custom tag changes on message/thread archive Jani Nikula
2012-09-03 11:39 ` Michal Nazarewicz
2012-09-03 12:08 ` Jani Nikula
2012-09-03 13:31 ` Michal Nazarewicz
2012-09-02 19:58 ` [PATCH 5/6] emacs: add support for reversing notmuch-search-archive-thread tag changes Jani Nikula
2012-09-02 19:58 ` [PATCH 6/6] emacs: add support for reversing notmuch-show-mark-read " Jani Nikula
2012-09-03 11:41 ` [PATCH 0/6] emacs: customization for tag changes on archive Michal Nazarewicz
2012-09-04 7:02 ` Mark Walters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xa1tipbvwdb0.fsf@mina86.com \
--to=mina86@mina86.com \
--cc=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).