From: nicolas.pouillard@gmail.com (Nicolas Pouillard)
Subject: [sup-talk] [PATCH] Allow multi_edit_labels to remove labels using -lab (the "; l" key binding)
Date: Wed, 18 Mar 2009 16:33:08 +0100 [thread overview]
Message-ID: <1237390328-sup-1506@ausone.local> (raw)
In-Reply-To: <1237228536-sup-7811@ausone.local>
This patch conflict with the undo feature, I've locally resolved the merge.
However I don't really know what the best way to share the conflict
resolution.
Excerpts from Nicolas Pouillard's message of Mon Mar 16 19:35:43 +0100 2009:
> Resent..
>
> ---
> lib/sup/modes/thread-index-mode.rb | 19 ++++++++++++++-----
> 1 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
> index 3dd0498..bde61cf 100644
> --- a/lib/sup/modes/thread-index-mode.rb
> +++ b/lib/sup/modes/thread-index-mode.rb
> @@ -448,13 +448,22 @@ EOS
> end
>
> def multi_edit_labels threads
> - user_labels = BufferManager.ask_for_labels :add_labels, "Add labels: ", [], @hidden_labels
> + user_labels = BufferManager.ask_for_labels :labels, "Add/remove labels (use -label to remove): ", [], @hidden_labels
> return unless user_labels
> -
> - hl = user_labels.select { |l| @hidden_labels.member? l }
> +
> + user_labels.map! { |l| (l.to_s =~ /^-/)? [l.to_s.gsub(/^-?/, '').to_sym, true] : [l, false] }
> + hl = user_labels.select { |(l,_)| @hidden_labels.member? l }
> if hl.empty?
> - threads.each { |t| user_labels.each { |l| t.apply_label l } }
> - user_labels.each { |l| LabelManager << l }
> + threads.each do |t|
> + user_labels.each do |(l, to_remove)|
> + if to_remove
> + t.remove_label l
> + else
> + t.apply_label l
> + end
> + end
> + end
> + user_labels.each { |(l,_)| LabelManager << l }
> else
> BufferManager.flash "'#{hl}' is a reserved label!"
> end
>
--
Nicolas Pouillard
next prev parent reply other threads:[~2009-03-18 15:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-16 18:35 Nicolas Pouillard
2009-03-18 15:33 ` Nicolas Pouillard [this message]
2009-03-22 21:21 ` William Morgan
2009-03-23 10:26 ` Nicolas Pouillard
2009-03-23 14:49 ` William Morgan
2009-03-23 15:18 ` Nicolas Pouillard
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1237390328-sup-1506@ausone.local \
--to=nicolas.pouillard@gmail.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox