unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] VIM: Respect exclude_tags specified in .notmuch-config
@ 2014-10-17 16:07 Franz Fellner
  2014-10-20 18:12 ` Ian Main
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Franz Fellner @ 2014-10-17 16:07 UTC (permalink / raw)
  To: notmuch

commit 558719b9ea9c218117c448cf4c7bd671de14d968
Author: Franz Fellner <alpine.art.de@gmail.com>
Date:   Fri Oct 17 17:53:58 2014 +0200

    Exclude tags specified by
    notmuch config get search.exclude_tags

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 5c86fcd..b8d11fe 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -647,6 +647,7 @@ ruby << EOF
 	$db_name = nil
 	$all_emails = []
 	$email = $email_name = $email_address = nil
+	$exclude_tags = []
 	$searches = []
 	$threads = []
 	$messages = []
@@ -672,6 +673,8 @@ ruby << EOF
 		# Add the primary to this too as we use it for checking
 		# addresses when doing a reply
 		$all_emails.unshift($email_address)
+		ignore_tags = get_config_item('search.exclude_tags')
+		$exclude_tags = ignore_tags.split("\n")
 	end
 
 	def vim_puts(s)
@@ -924,6 +927,9 @@ ruby << EOF
 
 		def query(*args)
 			q = @db.query(*args)
+			$exclude_tags.each { |t|
+				q.add_tag_exclude(t)
+			}
 			@queries << q
 			q
 		end

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH] VIM: Respect exclude_tags specified in .notmuch-config
  2014-10-17 16:07 [PATCH] VIM: Respect exclude_tags specified in .notmuch-config Franz Fellner
@ 2014-10-20 18:12 ` Ian Main
  2014-10-20 19:26   ` Franz Fellner
  2014-10-20 19:30 ` Franz Fellner
  2015-01-22 12:52 ` [PATCH v2] VIM: Exclude mails tagged with any tag specified in 'notmuch config get search.exclude_tags' in folders list and search list Franz Fellner
  2 siblings, 1 reply; 8+ messages in thread
From: Ian Main @ 2014-10-20 18:12 UTC (permalink / raw)
  To: Franz Fellner; +Cc: notmuch


Thanks Franz!

So this works well in the main searches by not showing anything I have marked
as 'spam'.  However if I force a search for tag:spam and then try to view any
of the messages presented they will not show up because of the way we display
the email..  :-/

I'm not sure what is the best way to fix this..

    Ian

Franz Fellner wrote:
> commit 558719b9ea9c218117c448cf4c7bd671de14d968
> Author: Franz Fellner <alpine.art.de@gmail.com>
> Date:   Fri Oct 17 17:53:58 2014 +0200
> 
>     Exclude tags specified by
>     notmuch config get search.exclude_tags
> 
> diff --git a/vim/notmuch.vim b/vim/notmuch.vim
> index 5c86fcd..b8d11fe 100644
> --- a/vim/notmuch.vim
> +++ b/vim/notmuch.vim
> @@ -647,6 +647,7 @@ ruby << EOF
>  	$db_name = nil
>  	$all_emails = []
>  	$email = $email_name = $email_address = nil
> +	$exclude_tags = []
>  	$searches = []
>  	$threads = []
>  	$messages = []
> @@ -672,6 +673,8 @@ ruby << EOF
>  		# Add the primary to this too as we use it for checking
>  		# addresses when doing a reply
>  		$all_emails.unshift($email_address)
> +		ignore_tags = get_config_item('search.exclude_tags')
> +		$exclude_tags = ignore_tags.split("\n")
>  	end
>  
>  	def vim_puts(s)
> @@ -924,6 +927,9 @@ ruby << EOF
>  
>  		def query(*args)
>  			q = @db.query(*args)
> +			$exclude_tags.each { |t|
> +				q.add_tag_exclude(t)
> +			}
>  			@queries << q
>  			q
>  		end
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] VIM: Respect exclude_tags specified in .notmuch-config
  2014-10-20 18:12 ` Ian Main
@ 2014-10-20 19:26   ` Franz Fellner
  2014-10-20 22:19     ` Ian Main
  0 siblings, 1 reply; 8+ messages in thread
From: Franz Fellner @ 2014-10-20 19:26 UTC (permalink / raw)
  To: Ian Main, Ian Main; +Cc: notmuch

Ian Main wrote:
> 
> Thanks Franz!
> 
> So this works well in the main searches by not showing anything I have marked
> as 'spam'.  However if I force a search for tag:spam and then try to view any
> of the messages presented they will not show up because of the way we display
> the email..  :-/

Yes, the patch did not work perfectly.
I already fixed that but forgot to send a new PATCH here - Mostly
bacause my git-skills are - ehh - no idea...
I now spent half an hour to somehow get a merged version of those two commits
and ended up with a simple "git diff"...
If you have a good how-to that describes such things I would be happy, because I also
miss the common terms how things are called in git and searching without knowing
what exactly I am looking for is hard...

Here is the commit:
https://github.com/ff2000/notmuch/commit/4fde250b53ce450fec3393d8578458d521a69c91
New patch coming soon.

Franz

> 
> I'm not sure what is the best way to fix this..
> 
>     Ian
> 
> Franz Fellner wrote:
> > commit 558719b9ea9c218117c448cf4c7bd671de14d968
> > Author: Franz Fellner <alpine.art.de@gmail.com>
> > Date:   Fri Oct 17 17:53:58 2014 +0200
> > 
> >     Exclude tags specified by
> >     notmuch config get search.exclude_tags
> > 
> > diff --git a/vim/notmuch.vim b/vim/notmuch.vim
> > index 5c86fcd..b8d11fe 100644
> > --- a/vim/notmuch.vim
> > +++ b/vim/notmuch.vim
> > @@ -647,6 +647,7 @@ ruby << EOF
> >  	$db_name = nil
> >  	$all_emails = []
> >  	$email = $email_name = $email_address = nil
> > +	$exclude_tags = []
> >  	$searches = []
> >  	$threads = []
> >  	$messages = []
> > @@ -672,6 +673,8 @@ ruby << EOF
> >  		# Add the primary to this too as we use it for checking
> >  		# addresses when doing a reply
> >  		$all_emails.unshift($email_address)
> > +		ignore_tags = get_config_item('search.exclude_tags')
> > +		$exclude_tags = ignore_tags.split("\n")
> >  	end
> >  
> >  	def vim_puts(s)
> > @@ -924,6 +927,9 @@ ruby << EOF
> >  
> >  		def query(*args)
> >  			q = @db.query(*args)
> > +			$exclude_tags.each { |t|
> > +				q.add_tag_exclude(t)
> > +			}
> >  			@queries << q
> >  			q
> >  		end
> > _______________________________________________
> > notmuch mailing list
> > notmuch@notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] VIM: Respect exclude_tags specified in .notmuch-config
  2014-10-17 16:07 [PATCH] VIM: Respect exclude_tags specified in .notmuch-config Franz Fellner
  2014-10-20 18:12 ` Ian Main
@ 2014-10-20 19:30 ` Franz Fellner
  2014-11-15  8:15   ` David Bremner
  2015-01-22 12:52 ` [PATCH v2] VIM: Exclude mails tagged with any tag specified in 'notmuch config get search.exclude_tags' in folders list and search list Franz Fellner
  2 siblings, 1 reply; 8+ messages in thread
From: Franz Fellner @ 2014-10-20 19:30 UTC (permalink / raw)
  To: Franz Fellner, notmuch

Exclude mails tagged with any tag specified in
notmuch config get search.exclude_tags
in folders list and search list.

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 5c86fcd..522a366 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -647,6 +647,7 @@ ruby << EOF
 	$db_name = nil
 	$all_emails = []
 	$email = $email_name = $email_address = nil
+	$exclude_tags = []
 	$searches = []
 	$threads = []
 	$messages = []
@@ -672,6 +673,8 @@ ruby << EOF
 		# Add the primary to this too as we use it for checking
 		# addresses when doing a reply
 		$all_emails.unshift($email_address)
+		ignore_tags = get_config_item('search.exclude_tags')
+		$exclude_tags = ignore_tags.split("\n")
 	end
 
 	def vim_puts(s)
@@ -859,6 +862,9 @@ ruby << EOF
 			end
 			folders.each do |name, search|
 				q = $curbuf.query(search)
+				$exclude_tags.each { |t|
+					q.add_tag_exclude(t)
+				}
 				$searches << search
 				count = count_threads ? q.search_threads.count : q.search_messages.count
 				if name == ''
@@ -874,6 +880,9 @@ ruby << EOF
 		date_fmt = VIM::evaluate('g:notmuch_date_format')
 		q = $curbuf.query(search)
 		q.sort = Notmuch::SORT_NEWEST_FIRST
+		$exclude_tags.each { |t|
+			q.add_tag_exclude(t)
+		}
 		$threads.clear
 		t = q.search_threads
 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH] VIM: Respect exclude_tags specified in .notmuch-config
  2014-10-20 19:26   ` Franz Fellner
@ 2014-10-20 22:19     ` Ian Main
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Main @ 2014-10-20 22:19 UTC (permalink / raw)
  To: Franz Fellner; +Cc: notmuch

Franz Fellner wrote:
> Ian Main wrote:
> > 
> > Thanks Franz!
> > 
> > So this works well in the main searches by not showing anything I have marked
> > as 'spam'.  However if I force a search for tag:spam and then try to view any
> > of the messages presented they will not show up because of the way we display
> > the email..  :-/
> 
> Yes, the patch did not work perfectly.
> I already fixed that but forgot to send a new PATCH here - Mostly
> bacause my git-skills are - ehh - no idea...
> I now spent half an hour to somehow get a merged version of those two commits
> and ended up with a simple "git diff"...
> If you have a good how-to that describes such things I would be happy, because I also
> miss the common terms how things are called in git and searching without knowing
> what exactly I am looking for is hard...
> 
> Here is the commit:
> https://github.com/ff2000/notmuch/commit/4fde250b53ce450fec3393d8578458d521a69c91
> New patch coming soon.
> 
> Franz

If you are working off the same patch that you already posted you would generally
do work on that branch and then you can do:

git add ...
git commit --amend

which commits the new stuff on top of the same commit you already had.

To send to the mailing list, I use:

git format-patch -1
(check the patch output..)
git send-email <filename>

which requires that you have your .gitconfig set up to have the list address
and such.

Also you can look into 'git cherry-pick' to grab commits from other branches
and 'git rebase -i' which allows you to squash commits together.  eg:

git rebase -i HEAD~2

lets you squash the last two patches together by adding 'squash' to the
front of the latest commit.

Hopefully that helps and I didn't misinterpret what you needed.

    Ian



> > 
> > I'm not sure what is the best way to fix this..
> > 
> >     Ian
> > 
> > Franz Fellner wrote:
> > > commit 558719b9ea9c218117c448cf4c7bd671de14d968
> > > Author: Franz Fellner <alpine.art.de@gmail.com>
> > > Date:   Fri Oct 17 17:53:58 2014 +0200
> > > 
> > >     Exclude tags specified by
> > >     notmuch config get search.exclude_tags
> > > 
> > > diff --git a/vim/notmuch.vim b/vim/notmuch.vim
> > > index 5c86fcd..b8d11fe 100644
> > > --- a/vim/notmuch.vim
> > > +++ b/vim/notmuch.vim
> > > @@ -647,6 +647,7 @@ ruby << EOF
> > >  	$db_name = nil
> > >  	$all_emails = []
> > >  	$email = $email_name = $email_address = nil
> > > +	$exclude_tags = []
> > >  	$searches = []
> > >  	$threads = []
> > >  	$messages = []
> > > @@ -672,6 +673,8 @@ ruby << EOF
> > >  		# Add the primary to this too as we use it for checking
> > >  		# addresses when doing a reply
> > >  		$all_emails.unshift($email_address)
> > > +		ignore_tags = get_config_item('search.exclude_tags')
> > > +		$exclude_tags = ignore_tags.split("\n")
> > >  	end
> > >  
> > >  	def vim_puts(s)
> > > @@ -924,6 +927,9 @@ ruby << EOF
> > >  
> > >  		def query(*args)
> > >  			q = @db.query(*args)
> > > +			$exclude_tags.each { |t|
> > > +				q.add_tag_exclude(t)
> > > +			}
> > >  			@queries << q
> > >  			q
> > >  		end
> > > _______________________________________________
> > > notmuch mailing list
> > > notmuch@notmuchmail.org
> > > http://notmuchmail.org/mailman/listinfo/notmuch
> > 
> > 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] VIM: Respect exclude_tags specified in .notmuch-config
  2014-10-20 19:30 ` Franz Fellner
@ 2014-11-15  8:15   ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2014-11-15  8:15 UTC (permalink / raw)
  To: Franz Fellner, Franz Fellner, notmuch

Franz Fellner <alpine.art.de@gmail.com> writes:

> Exclude mails tagged with any tag specified in
> notmuch config get search.exclude_tags
> in folders list and search list.
>

This seems like an important feature and I'd like to add it.  It needs
rebasing against current master. Also, as a nitpick, please fill the
commit comment to something like 65-75 columns.

Cheers,

d

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] VIM: Exclude mails tagged with any tag specified in 'notmuch config get search.exclude_tags' in folders list and search list.
  2014-10-17 16:07 [PATCH] VIM: Respect exclude_tags specified in .notmuch-config Franz Fellner
  2014-10-20 18:12 ` Ian Main
  2014-10-20 19:30 ` Franz Fellner
@ 2015-01-22 12:52 ` Franz Fellner
  2015-01-22 19:37   ` David Bremner
  2 siblings, 1 reply; 8+ messages in thread
From: Franz Fellner @ 2015-01-22 12:52 UTC (permalink / raw)
  To: notmuch

---
 vim/notmuch.vim | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index cad9517..cb6695a 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -477,6 +477,7 @@ ruby << EOF
 
 	$db_name = nil
 	$email = $email_name = $email_address = nil
+	$exclude_tags = []
 	$searches = []
 	$threads = []
 	$messages = []
@@ -496,6 +497,8 @@ ruby << EOF
 		$email_address = get_config_item('user.primary_email')
 		$email_name = get_config_item('user.name')
 		$email = "%s <%s>" % [$email_name, $email_address]
+		ignore_tags = get_config_item('search.exclude_tags')
+		$exclude_tags = ignore_tags.split("\n")
 	end
 
 	def vim_puts(s)
@@ -637,6 +640,9 @@ ruby << EOF
 			$searches.clear
 			folders.each do |name, search|
 				q = $curbuf.query(search)
+				$exclude_tags.each { |t|
+					q.add_tag_exclude(t)
+				}
 				$searches << search
 				count = count_threads ? q.search_threads.count : q.search_messages.count
 				b << "%9d %-20s (%s)" % [count, name, search]
@@ -648,6 +654,9 @@ ruby << EOF
 		date_fmt = VIM::evaluate('g:notmuch_date_format')
 		q = $curbuf.query(search)
 		q.sort = Notmuch::SORT_NEWEST_FIRST
+		$exclude_tags.each { |t|
+			q.add_tag_exclude(t)
+		}
 		$threads.clear
 		t = q.search_threads
 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] VIM: Exclude mails tagged with any tag specified in 'notmuch config get search.exclude_tags' in folders list and search list.
  2015-01-22 12:52 ` [PATCH v2] VIM: Exclude mails tagged with any tag specified in 'notmuch config get search.exclude_tags' in folders list and search list Franz Fellner
@ 2015-01-22 19:37   ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2015-01-22 19:37 UTC (permalink / raw)
  To: Franz Fellner, notmuch



Thanks Franz. I reformatted the commit message a bit and merged to
master.

d

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-22 19:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-17 16:07 [PATCH] VIM: Respect exclude_tags specified in .notmuch-config Franz Fellner
2014-10-20 18:12 ` Ian Main
2014-10-20 19:26   ` Franz Fellner
2014-10-20 22:19     ` Ian Main
2014-10-20 19:30 ` Franz Fellner
2014-11-15  8:15   ` David Bremner
2015-01-22 12:52 ` [PATCH v2] VIM: Exclude mails tagged with any tag specified in 'notmuch config get search.exclude_tags' in folders list and search list Franz Fellner
2015-01-22 19:37   ` David Bremner

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).