Re: [PATCH] test/T030-config: Separate stdout and stderr output

2019-03-10 Thread Luis Ressel
On Sun, Mar 10, 2019 at 10:42:59PM +0200, Tomi Ollila wrote:
> On Sun, Mar 10 2019, Luis Ressel wrote:
> 
> >  test_begin_subtest "List all items"
> > -notmuch config list 2>&1 | notmuch_config_sanitize > OUTPUT
> > +notmuch config list 2>OUTPUT-ERR | notmuch_config_sanitize > OUTPUT
> > +echo "" >> OUTPUT
> > +notmuch_config_sanitize < OUTPUT-ERR >> OUTPUT
> 
> IMO the above would be better (model/pattern for further use) as:
> 
>   notmuch config list >STDOUT 2>STDERR
>   { cat STDOUT; echo ""; cat STDERR; } | notmuch_config_sanitize > OUTPUT

Yes, that'd certainly look better.

> (I would like to put that cat-echo-cat into function but naming is hard...)

"concat" perhaps? Or "concat_separator"/"concat_with_separator"?

> alternatives:
> 
>   1) drop , then one cat STDOUT STDERR ... would be enough
> 
>   2) printf '%s\n%s' "$(< STDOUT)" "$(< STDERR)"
> 
>   3) head -1000 STDOUT STDERR
> 
> -- in case of (3) are we sure that all head(1) implementations print the
>filenames (and formats (possible) extra newlines) the same way.
> 
> -- ( (2) brings $(< ...) (faster replacement for $(cat ...) which we
>haven't used in notmuch test suite so far -- but we could!)

Any of those options would be fine with me, with a preference for 2).
As for 3), POSIX specifies the exact header format head should use:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html
(There may be nonconformant implementations anyway, of course.)

Regards,
Luis Ressel
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: how to search for hyphenated words? (was: how to search for Morse code?)

2019-03-10 Thread David Bremner
Gregor Zattler  writes:

>
> How would one search for hyphenated words with notmuch?
>

In special cases, explained in notmuch-search-terms(7), one can use
regexp searches, which are slower, but don't drop punctuation.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test/T030-config: Separate stdout and stderr output

2019-03-10 Thread Tomi Ollila
On Sun, Mar 10 2019, Luis Ressel wrote:

> POSIX doesn't specify the flushing behaviour of the STDOUT stream, so
> it's invalid to assume a particular order between the stdout and stderr
> output. The current test breaks on musl due to this.

> ---
>  test/T030-config.sh | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/test/T030-config.sh b/test/T030-config.sh
> index f36695c6..9404390b 100755
> --- a/test/T030-config.sh
> +++ b/test/T030-config.sh
> @@ -43,7 +43,9 @@ notmuch config set foo.nonexistent
>  test_expect_equal "$(notmuch config get foo.nonexistent)" ""
>  
>  test_begin_subtest "List all items"
> -notmuch config list 2>&1 | notmuch_config_sanitize > OUTPUT
> +notmuch config list 2>OUTPUT-ERR | notmuch_config_sanitize > OUTPUT
> +echo "" >> OUTPUT
> +notmuch_config_sanitize < OUTPUT-ERR >> OUTPUT

IMO the above would be better (model/pattern for further use) as:

  notmuch config list >STDOUT 2>STDERR
  { cat STDOUT; echo ""; cat STDERR; } | notmuch_config_sanitize > OUTPUT

(I would like to put that cat-echo-cat into function but naming is hard...)

alternatives:

  1) drop , then one cat STDOUT STDERR ... would be enough

  2) printf '%s\n%s' "$(< STDOUT)" "$(< STDERR)"

  3) head -1000 STDOUT STDERR

-- in case of (3) are we sure that all head(1) implementations print the
   filenames (and formats (possible) extra newlines) the same way.

-- ( (2) brings $(< ...) (faster replacement for $(cat ...) which we
   haven't used in notmuch test suite so far -- but we could!)

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: Ignore subtly different behaviour of the musl libc

2019-03-10 Thread Tomi Ollila


On Tue, Feb 26 2019, Luis Ressel wrote:
...
> --- a/test/T650-regexp-query.sh
> +++ b/test/T650-regexp-query.sh
> @@ -137,10 +137,10 @@ EOF
>  test_expect_equal_file EXPECTED OUTPUT
>  
>  test_begin_subtest "regexp error reporting"
> -notmuch search 'from:/unbalanced[/' 1>OUTPUT 2>&1
> +notmuch search 'from:/unbalanced[/' 2>&1 | sed -e 's/^\(A 
> Xapian[^:]*:\).*/\1/' > OUTPUT

Simpler sed:  sed '/A Xapian/ s/:.*/:/'

>  cat < EXPECTED
>  notmuch search: A Xapian exception occurred
> -A Xapian exception occurred parsing query: Invalid regular expression
> +A Xapian exception occurred parsing query:
>  Query string was: from:/unbalanced[/
>  EOF
>  test_expect_equal_file EXPECTED OUTPUT
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: how do i split my email view (AKA I got a new job)

2019-03-10 Thread Antoine Beaupré
On 2019-03-10 17:54:54, Ralph Seichter wrote:
> * Antoine Beaupré:
>
>> How can I make that "All tags" junk disappear?
>
> If it bugs you that much, you can use the "this page" link in "Customize
> Notmuch or this page".

Ooooh... I remember now! I digged in the source last time we chatted
about this in #notmuch. I did so again and found what I was looking for:

(setq notmuch-hello-tag-list-make-query "tag:unread and not tag:work")

Now I need to figure out how to make schedules in Emacs... :) It looks
like I need to do something with `run-at-time' or something to that
effect:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Timers.html#Timers

I also found out about the "midnight" mode, but that seems to support
only a single time trigger:

https://www.emacswiki.org/emacs/MidnightMode

I also found idle timers, but that seems irrelevant:

https://www.emacswiki.org/emacs/IdleTimers#toc2

Anyone else played with scheduling like this?

In any case, I guess just having a defun that flips that around would be
a good start. :) I'm thinking of something like:

(defun anarcat/notmuch-work-off ()
  (interactive)
  (setq notmuch-hello-tag-list-make-query "tag:unread and not tag:work")
  (notmuch-refresh-this-buffer))

(defun anarcat/notmuch-work-on ()
  (interactive)
  (setq notmuch-hello-tag-list-make-query "tag:unread")
  (notmuch-refresh-this-buffer))

That's actually two defun - and it looks rather silly, mayb there's a
way to make that a toggle somehow?

Anyways, does that look sane?

A.

-- 
When spider webs unite, they can tie up a lion.
- ethiopian proverb
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: Ignore subtly different behaviour of the musl libc

2019-03-10 Thread Luis Ressel
On Mon, Mar 04, 2019 at 08:04:21AM -0400, David Bremner wrote:
> Luis Ressel  writes:
> 
> > ---
> >  test/T030-config.sh   | 6 --
> >  test/T650-regexp-query.sh | 4 ++--
> >  2 files changed, 6 insertions(+), 4 deletions(-)
> >
> 
> In general we want more verbose commit messages for notmuch
> (https://notmuchmail.org/contributing/#index5h2)
> 
> > +test_begin_subtest "List all items (stderr output)"
> > +test_expect_equal "$(notmuch_config_sanitize  > database at MAIL_DIR/.notmuch: No such file or directory"
> > +
> 
> The first change looks OK. Another option would be to cat the two files
> into one in the test with a seperator. That's how the test_C based tests work.
> 

I agree that's nicer, and just submitted an updated patch.

> >  test_begin_subtest "Top level --config=FILE option"
> >  cp "${NOTMUCH_CONFIG}" alt-config
> >  notmuch --config=alt-config config set user.name "Another Name"
> > diff --git a/test/T650-regexp-query.sh b/test/T650-regexp-query.sh
> > index 4085340f..9ba3cd64 100755
> > --- a/test/T650-regexp-query.sh
> > +++ b/test/T650-regexp-query.sh
> > @@ -137,10 +137,10 @@ EOF
> >  test_expect_equal_file EXPECTED OUTPUT
> >  
> >  test_begin_subtest "regexp error reporting"
> > -notmuch search 'from:/unbalanced[/' 1>OUTPUT 2>&1
> > +notmuch search 'from:/unbalanced[/' 2>&1 | sed -e 's/^\(A 
> > Xapian[^:]*:\).*/\1/' > OUTPUT
> >  cat < EXPECTED
> >  notmuch search: A Xapian exception occurred
> > -A Xapian exception occurred parsing query: Invalid regular expression
> > +A Xapian exception occurred parsing query:
> >  Query string was: from:/unbalanced[/
> >  EOF
> 
> This seems to lose the fact that a regexp parsing error occured.  One
> option would be to change the actual error message so the initial
> predictable part of the error message contained some string like
> "regexp".

I don't really think this is a problem. notmuch's test suite is quite
comprehensive, so I don't consider it essential to verify that this
particular Xapian failure is caused by a regex issue as opposed to
another problem.

I could change the test so it accepts both the glibc and musl errors
("Invalid regular expression" and "Missing ']'", respectively), but I
can't say I'm enthusiastic about that. POSIX does not specify the output
of regerror(), and in fact not even which error code should be used here
(musl's regcomp() currently returns REG_EBRACK, while glibc probably
uses the generic REG_BADPAT); thus, the error message may change
arbitrarily during a libc update, or be something else entirely for
another libc implementation.

If you really consider it important to convey the info that there was a
regex parsing error, I can submit a patch to make compile_regex() prefix
the regerror output with "regex error: " or sth like that.

Regards,
Luis Ressel

(Resending due to trouble with my new MUA; apologies if you receive this
mail twice.)
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Add a configure flag to disable rpaths

2019-03-10 Thread Luis Ressel
On Fri, Mar 01, 2019 at 08:39:25AM -0400, David Bremner wrote:
> Tomi Ollila  writes:
> 
> > On Tue, Feb 26 2019, Luis Ressel wrote:
> >
> > although the commit message is a bit terse, this change looks simple and
> > reasonable enough to be pushed (i.e. if i think hard I can see reason
> > for this change even it is not described in commit message ;D)
> >
> 
> For those of us too lazy to think hard, what is the reason? I can add to
> the commit message.
> 

Packagers often disable rpaths wherever possible. They can cause
confusion and, used carelessly, even security issues, and in the vast
majority of cases they're wholly unneccessary. notmuch's usage of rpaths
is rather innocuous, but I would still prefer to disable them when
they're not strictly needed.

Now, notmuch's configure script already tries to detect whether $libdir
is path of the standard library search path and disables -rpath in this
case. However, this detection logic invokes /sbin/ldconfig, which may
not be present on musl-based systems or at least not work as the
configure script expects. On my host, configure thus arrives at the
conclusion it needs to use -rpath even though $libdir is set to
/usr/lib/.

Since it seemed easy and straightforward to just add an option to
explicitly disable rpaths, and I wanted to avoid adding musl-specific
code to the autodetection logic, I decided to go this route.

Cheers,
Luis Ressel

(Resending due to trouble with my new MUA; apologies if you receive this
mail twice.)
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: how do i split my email view (AKA I got a new job)

2019-03-10 Thread Jeremy Nickurak
If it were me, I'd be looking to do something to automatically use a
different configuration at different times of the week. One config would
look like whatever your configuration is, while the other would include the
'work' tag in your 'exclude_tags=' options, so your work email would be
invisible unless you explicitly went looking for it.

Off the top of my head, you could have 2 config files (automatically
created maybe), and you could either tweak the NOTMUCH_CONFIG environment
variable or a --config= option to select one or the other. You could also
look into emacs automation to change the notmuch-command variable to select
one configuration or the other.

On Sun, Mar 10, 2019 at 10:19 AM Antoine Beaupré 
wrote:

> Hello!
>
> So I got a new job, and that means I have a new email address that
> forwards to my regular mail spool. *Normally*, all that junk should end
> up in a separate folder so I am tagging it all as "+work" (there are
> quite a few corner cases which I handle individually, but from here on
> we can assume there's a single tag to identify all that mail).
>
> How do I stay sane during the weekends? There's a *lot* of junk coming
> in that's polluting my "notmuch-hello" view. Here's a "screenshot":
>
>Welcome to notmuch. You have 188 359 messages.
>
> Saved searches: [edit]
>
>   67 inbox259 sent   3 drafts 2 todo
>
> Search:
>.
>
> All tags: [hide]
>
>1 attachment   27 logwatch  3
> work-project
>   72 commit   13 nagios9
> work-admin
>   17 cron124 rapports  3 trac
>   16 lists   147 work151 unread
>
>   Hit `?' for context-sensitive help in any Notmuch screen.
>Customize Notmuch or this page.
>
> How can I make that "All tags" junk disappear? Or, more specifically,
> how do I make it ignore that crowded "work" tag? Bonus points for
> flipping back and forth outside of business hours and weekends. :)
>
> I know I can make a billion saved searches to cover for all those
> cases. But so far I've used a technique where I tag messages instead of
> doing saved searches and it serves me well.
>
> Thanks!
>
> --
> The most prudent course for any society is to start from the
> assumption that the Internet should be fundamentally outside the
> domain of capital.
> - The Internet's Unholy Marriage to Capitalism
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: how do i split my email view (AKA I got a new job)

2019-03-10 Thread Ralph Seichter
* Antoine Beaupré:

> How can I make that "All tags" junk disappear?

If it bugs you that much, you can use the "this page" link in "Customize
Notmuch or this page".

-Ralph
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test/T030-config: Separate stdout and stderr output

2019-03-10 Thread Luis Ressel
POSIX doesn't specify the flushing behaviour of the STDOUT stream, so
it's invalid to assume a particular order between the stdout and stderr
output. The current test breaks on musl due to this.
---
 test/T030-config.sh | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/test/T030-config.sh b/test/T030-config.sh
index f36695c6..9404390b 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -43,7 +43,9 @@ notmuch config set foo.nonexistent
 test_expect_equal "$(notmuch config get foo.nonexistent)" ""
 
 test_begin_subtest "List all items"
-notmuch config list 2>&1 | notmuch_config_sanitize > OUTPUT
+notmuch config list 2>OUTPUT-ERR | notmuch_config_sanitize > OUTPUT
+echo "" >> OUTPUT
+notmuch_config_sanitize < OUTPUT-ERR >> OUTPUT
 
 if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
 config_gpg_path="crypto.gpg_path=gpg
@@ -51,7 +53,6 @@ if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
 fi
 
 cat < EXPECTED
-Error opening database at MAIL_DIR/.notmuch: No such file or directory
 database.path=MAIL_DIR
 user.name=Notmuch Test Suite
 user.primary_email=test_su...@notmuchmail.org
@@ -65,6 +66,8 @@ foo.list=this;is another;list value;
 built_with.compact=something
 built_with.field_processor=something
 built_with.retry_lock=something
+
+Error opening database at MAIL_DIR/.notmuch: No such file or directory
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
-- 
2.19.2

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


how do i split my email view (AKA I got a new job)

2019-03-10 Thread Antoine Beaupré
Hello!

So I got a new job, and that means I have a new email address that
forwards to my regular mail spool. *Normally*, all that junk should end
up in a separate folder so I am tagging it all as "+work" (there are
quite a few corner cases which I handle individually, but from here on
we can assume there's a single tag to identify all that mail).

How do I stay sane during the weekends? There's a *lot* of junk coming
in that's polluting my "notmuch-hello" view. Here's a "screenshot":

   Welcome to notmuch. You have 188 359 messages.

Saved searches: [edit]

  67 inbox259 sent   3 drafts 2 todo

Search: 
  .

All tags: [hide]

   1 attachment   27 logwatch  3 
work-project
  72 commit   13 nagios9 work-admin
  17 cron124 rapports  3 trac
  16 lists   147 work151 unread

  Hit `?' for context-sensitive help in any Notmuch screen.
   Customize Notmuch or this page.

How can I make that "All tags" junk disappear? Or, more specifically,
how do I make it ignore that crowded "work" tag? Bonus points for
flipping back and forth outside of business hours and weekends. :)

I know I can make a billion saved searches to cover for all those
cases. But so far I've used a technique where I tag messages instead of
doing saved searches and it serves me well.

Thanks!

-- 
The most prudent course for any society is to start from the
assumption that the Internet should be fundamentally outside the
domain of capital.
- The Internet's Unholy Marriage to Capitalism
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch