Re: [PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded

Subject: Re: [PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded

Date: Fri, 05 May 2023 12:43:34 +0100

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Mohsin Kaleem


David Bremner <david@tethera.net> writes:

>> diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
>> index 9d0df187..b89a100e 100755
>> --- a/test/T310-emacs.sh
>> +++ b/test/T310-emacs.sh
>> @@ -1030,7 +1030,7 @@ End of search results.
>>  YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
>>  === ERROR ===
>>  YYY/notmuch_fail exited with status 1
>> -command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
>> +command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox
>>  exit status: 1"
>>  
>
> I don't understand why --exclude is defaulting to 'false' here. Isn't
> this a change in behaviour?

You're correct.

This is because the new options notmuch-search-hide-excluded and it
defaults to t, but when we call (notmuch-search) the value used is nil
because we didn't supply one for the search call. If you call
notmuch-search interactively then this isn't an issue, the interactive
spec will substitute the value of the hide-excluded option. This is why
all the tests that use the hello buffer to select the inbox and open a
search in it correctly use the notmuch-search-hide-excluded option. This
test does not do this.

We could workaround this by changing the semantics of the variable. Make
it notmuch-search-show-excluded and default to nil so nothing has to be
changed in existing functions that call notmuch-search. Or we could
switch to using cl-defun and have the default value substituted in the
parameter list. I've never used cl-defun with interactive functions but
long term I think that's the saner solution.

-- 
Mohsin Kaleem
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: