Re: [PATCH 3/3] emacs/show: use n-s-i-headerline to update tags

2022-11-15 Thread Tomi Ollila
On Tue, Nov 15 2022, David Bremner wrote:

> Tomi Ollila  writes:
>
>>
>> and then grepping thru notmuch source code:
>>
>> notmuch-tree.el:497:  (delete-region (point) (1+ (line-end-position)))
>>
>> -- it looks to me this could be simpler and faster alternative.
>>
>
> Applied to master with your suggested modification. Thanks for the
> review.

Great! now it works...

(insert " " (notmuch-version)) notmuch version 0.37+27~gff8ef59

Tomi

>
> d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 3/3] emacs/show: use n-s-i-headerline to update tags

2022-11-13 Thread Tomi Ollila
On Fri, Nov 11 2022, David Bremner wrote:

> Although this has more steps than the previous regular expression
> search and replace, it should be more robust against changes in the
> headerline format, such as the inclusion of duplicate numbers (which
> broke the previous version).
> ---
>  emacs/notmuch-show.el | 22 ++
>  1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 5fb5ab31..c4e88be2 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -452,14 +452,20 @@ operation on the contents of the current buffer."
>  (defun notmuch-show-update-tags (tags)
>"Update the displayed tags of the current message."
>(save-excursion
> -(goto-char (notmuch-show-message-top))
> -(when (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
> -  (let ((inhibit-read-only t))
> - (replace-match (concat "("
> -(notmuch-tag-format-tags
> - tags
> - (notmuch-show-get-prop :orig-tags))
> -")"))
> +(let ((inhibit-read-only t)
> +   (start (notmuch-show-message-top))
> +   (depth (notmuch-show-get-prop :depth))
> +   (orig-tags (notmuch-show-get-prop :orig-tags))
> +   (props (notmuch-show-get-message-properties))
> +   (extent (notmuch-show-message-extent)))
> +  (goto-char start)
> +  (notmuch-show-insert-headerline props depth tags orig-tags)
> +  (put-text-property start (1+ start)
> +  :notmuch-message-properties props)
> +  (put-text-property (car extent) (cdr extent) :notmuch-message-extent 
> extent)
> +  ;; delete original headerline, but do not save to kill ring
> +  (delete-region
> +   (point) (save-excursion (end-of-line nil) (1+ (point)))

Series looks good to me (as much as I understand it)

This last changed line got me checking docstring of (line-end-position),
which says:

 -- line-end-position is a built-in function in ‘C source code’.
 -- Probably introduced at or before Emacs version 20.4.
 -- This function does not change global state, including the match data.

and then grepping thru notmuch source code:

notmuch-tree.el:497:  (delete-region (point) (1+ (line-end-position)))

-- it looks to me this could be simpler and faster alternative.

Tomi

PS: something that is nasty but probably does not hit here (there is
newline always)

(delete-region (line-end-position) 100)
-> Debugger entered--Lisp error: (args-out-of-range # 215 
100

>  
>  (defun notmuch-clean-address (address)
>"Try to clean a single email ADDRESS for display. Return a cons
> -- 
> 2.35.1
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: fix notmuch-show-update-tags to support duplicate files

2022-11-06 Thread Tomi Ollila
On Sat, Nov 05 2022, David Bremner wrote:

> Tomi Ollila  writes:
>
>
>> Is this getting too complex (well, we may have other stuff with
>> similar complexity there ;/) ?
>>
>> Is there any better solutions ?
>
> I want to try redrawing the whole headerline. It should be more robust
> against headerline format changes, but replacing the headerline has its
> own complexities. I guess once I get something working, we can compare.

I agree -- there should be one (1) function that takes care of drawing 
the headerline. this could get ouf-of-control easier when done different
ways in places far, far away...

now that I think of it, narrowing may not bring any advantage, but function
which writes headerline to current (point) -- when doing initial drawing
nothing has to be done beforehand, in case of updating, first delete line
and then redraw...

Tomi

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] cli: add options --offset and --limit to notmuch show

2022-10-14 Thread Tomi Ollila
On Wed, Oct 12 2022, Robin Jarry wrote:

> Hi Tomi,
>
> Tomi Ollila, Oct 12, 2022 at 21:39:
>> > diff --git a/notmuch-show.c b/notmuch-show.c
>> > index ee9efa7448d7..ad31e0123268 100644
>> > --- a/notmuch-show.c
>> > +++ b/notmuch-show.c
>> > @@ -1159,6 +1159,18 @@ do_show_threaded (void *ctx,
>> >  notmuch_thread_t *thread;
>> >  notmuch_messages_t *messages;
>> >  notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
>> > +int i;
>> > +
>> > +if (params->offset < 0) {
>> > +  unsigned count;
>> > +  notmuch_status_t s = notmuch_query_count_threads (query, );
>> > +  if (print_status_query ("notmuch search", query, s))
>> > +  return 1;
>> > +
>> > +  params->offset += count;
>> > +  if (params->offset < 0)
>>
>> this check and setting it to 0 is mystic to me, probably same code as in
>> search (?) probably it is good (?) (will not comment the same below)
>
> Yes, I copy/pasted that code from notmuch-search.c. I believe this to
> handle the case where:
>
> --limit=N && --offset=-M && M > count
>
> After adding count to offset, you may end up with a negative offset
> which makes the loop exit condition invalid and the --limit value would
> not be enforced as expected:
>
> i < params->offset + params->limit
>
>> > diff --git a/test/T131-show-limiting.sh b/test/T131-show-limiting.sh
>> > new file mode 100755
>> > index ..a3da35944a3e
>> > --- /dev/null
>> > +++ b/test/T131-show-limiting.sh
>> > @@ -0,0 +1,81 @@
>> > +#!/usr/bin/env bash
>> > +test_description='"notmuch show" --offset and --limit parameters'
>> > +. $(dirname "$0")/test-lib.sh || exit 1
>> > +
>> > +add_email_corpus
>> > +
>> > +function show() {
>>
>> 'function' not used in other function defitions in other files, so this is
>> inconsistent (otherwise the content looks "better" than what I see usual ;D)
>
> I concur that this is a bash-only construct. I could remove the function
> keyword and we would have the same result.

Bash constructs are allowed (even perhaps encouraged in many cases), I just
care about consistency (it is easier to browse through large set of files
if there is not too much differenct constructs used)

In case of 'function' it also works in zsh (and probably ksh). I have
started to use in all (except one, I just noticed) function definitions
in my zshrc. I recall I had a problem which using function fixed
-- probably related to something with

   ff () { ...; }
   alias ff='noglob ff'

which did not exactly worked like it should have. function ff () { ...; }
fixed that case (cannot remember exact details, changed 2021-03-08 w/
somewhat vague git commit message (in private dotdir repo :)))


>
>> > +test_begin_subtest "${outp}: offset = 0"
>>
>> inconsistent ${outp} (where $outp used elsewhere) ...  
>
> Indeed. I had removed all the ${} except this one. For consistency with
> the other test scripts, I could add them back everywhere. I don't mind
> either way.

I personally prefer w/o {} in trivial cases, shorter and clearer to read
(and use $FOO''bar instead of ${FOO}bar when such need arrives ;/). that
is such a small difference (IMO) that either goes...

>
> I'll hold off for other remarks before sending a v2.
>
> Cheers,

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] cli: add options --offset and --limit to notmuch show

2022-10-12 Thread Tomi Ollila
On Wed, Oct 12 2022, Robin Jarry wrote:

> notmuch search does not output header values. However, when browsing
> through a large email corpus, it can be time saving to be able to
> paginate without running notmuch show for each message/thread.
>
> Add --offset and --limit options to notmuch show. This is inspired from
> commit 796b629c3b82 ("cli: add options --offset and --limit to notmuch
> search").
>
> Update man page, shell completion and add a test case to ensure it works
> as expected.
>
> Cc: Tim Culverhouse 
> Signed-off-by: Robin Jarry 
> ---
>  completion/notmuch-completion.bash |  2 +-
>  completion/zsh/_notmuch|  2 +
>  doc/man1/notmuch-show.rst  |  9 
>  notmuch-client.h   |  2 +
>  notmuch-show.c | 49 +++---
>  test/T131-show-limiting.sh | 81 ++
>  6 files changed, 138 insertions(+), 7 deletions(-)
>  create mode 100755 test/T131-show-limiting.sh
>
> diff --git a/completion/notmuch-completion.bash 
> b/completion/notmuch-completion.bash
> index 0022b54bff5d..3748846edf83 100644
> --- a/completion/notmuch-completion.bash
> +++ b/completion/notmuch-completion.bash
> @@ -530,7 +530,7 @@ _notmuch_show()
>  ! $split &&
>  case "${cur}" in
>   -*)
> - local options="--entire-thread= --format= --exclude= --body= 
> --format-version= --part= --verify --decrypt= --include-html 
> ${_notmuch_shared_options}"
> + local options="--entire-thread= --format= --exclude= --body= 
> --format-version= --part= --verify --decrypt= --include-html --limit= 
> --offset= ${_notmuch_shared_options}"
>   compopt -o nospace
>   COMPREPLY=( $(compgen -W "$options" -- ${cur}) )
>   ;;
> diff --git a/completion/zsh/_notmuch b/completion/zsh/_notmuch
> index e207d90b7202..0bdd7f772a7a 100644
> --- a/completion/zsh/_notmuch
> +++ b/completion/zsh/_notmuch
> @@ -245,6 +245,8 @@ _notmuch_show() {
>  '--exclude=[respect excluded tags setting]:exclude tags:(true false)' \
>  '--body=[output body]:output body content:(true false)' \
>  '--include-html[include text/html parts in the output]' \
> +'--limit=[limit the number of displayed results]:limit: ' \
> +'--offset=[skip displaying the first N results]:offset: ' \
>  '*::search term:_notmuch_search_term'
>  }
>  
> diff --git a/doc/man1/notmuch-show.rst b/doc/man1/notmuch-show.rst
> index 2c0a0de6ad16..c13d94de0244 100644
> --- a/doc/man1/notmuch-show.rst
> +++ b/doc/man1/notmuch-show.rst
> @@ -130,6 +130,15 @@ Supported options for **show** include
> By default, results will be displayed in reverse chronological
> order, (that is, the newest results will be displayed first).
>  
> +.. option:: --offset=[-]N
> +
> +   Skip displaying the first N results. With the leading '-', start
> +   at the Nth result from the end.
> +
> +.. option:: --limit=N
> +
> +   Limit the number of displayed results to N.
> +
>  .. option:: --verify
>  
> Compute and report the validity of any MIME cryptographic
> diff --git a/notmuch-client.h b/notmuch-client.h
> index 21b49908ae24..1a87240d3c21 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -77,6 +77,8 @@ typedef struct notmuch_show_params {
>  bool output_body;
>  int duplicate;
>  int part;
> +int offset;
> +int limit;
>  _notmuch_crypto_t crypto;
>  bool include_html;
>  GMimeStream *out_stream;
> diff --git a/notmuch-show.c b/notmuch-show.c
> index ee9efa7448d7..ad31e0123268 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -1159,6 +1159,18 @@ do_show_threaded (void *ctx,
>  notmuch_thread_t *thread;
>  notmuch_messages_t *messages;
>  notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
> +int i;
> +
> +if (params->offset < 0) {
> + unsigned count;
> + notmuch_status_t s = notmuch_query_count_threads (query, );
> + if (print_status_query ("notmuch search", query, s))
> + return 1;
> +
> + params->offset += count;
> + if (params->offset < 0)

this check and setting it to 0 is mystic to me, probably same code as in
search (?) probably it is good (?) (will not comment the same below)

> + params->offset = 0;
> +}
>  
>  status = notmuch_query_search_threads (query, );
>  if (print_status_query ("notmuch show", query, status))
> @@ -1166,11 +1178,16 @@ do_show_threaded (void *ctx,
>  
>  sp->begin_list (sp);
>  
> -for (;
> -  notmuch_threads_valid (threads);
> -  notmuch_threads_move_to_next (threads)) {
> +for (i = 0;
> +  notmuch_threads_valid (threads) && (params->limit < 0 || i < 
> params->offset + params->limit);
> +  notmuch_threads_move_to_next (threads), i++) {
>   thread = notmuch_threads_get (threads);
>  
> + if (i < params->offset) {
> + notmuch_thread_destroy (thread);
> + continue;
> + }
> +
>   messages = notmuch_thread_get_toplevel_messages (thread);
>  

Re: Test failure in Ubuntu 22.04 and 22.10 (new test)

2022-10-10 Thread Tomi Ollila
On Thu, Oct 06 2022, Michael J. Gruber wrote:

> Am Do., 6. Okt. 2022 um 18:34 Uhr schrieb David Bremner :
>>
>> Michael J Gruber  writes:
>>
>> >
>> > Yes, lto-wrapper calls make.
>> >
>> > Are we compiling test functions on the fly during the test? In that
>> > case we need to make sure that each test depends on the build
>> > products, or else the test helper compilation and its users might run
>> > in parallel ...
>>
>> Yes, we compile C code on the fly during the run of the tests. I'm not
>> really clear on what race condition you are anticipating, as neither the
>> compilation nor the other parts of the test are directly run by make.
>> Execution is sequential within each T*.sh file. Unless gcc is returning
>> before it has finished compilation (which I think we'd all agree would
>> be gcc bug), I don't see how a race can arise there. One thing I can
>> imagine happening is gcc's recursive invocation of make somehow fails
>> under make -j, possibly something to do with violated assumptions about
>> the jobserver and/or environment variables.
>
> What I mean is:
> make calls T*.sh
> T*.sh calls gcc
> gcc calls make (for lto)
>
> Could it be that within a parallel make session, that gcc-make-call
> gets delegated to the master make jobserver and thus gcc returns too
> early? Wild speculation, I admit.

Like David said, that would be bug in gcc... (nasty one I'd admit, how
can one expect that the world around has set make to run its jobs
parallely (if that is the case))

anyway, one could try unset MAKEFLAGS in ... test-lib.sh and see
if that helps (perhaps also MFLAGS))

$ printf %s\\n all: $'\tenv' | make -j -f /dev/stdin | sort | grep FLA
MAKEFLAGS= -j4 --jobserver-auth=4,5
MFLAGS=-j4 --jobserver-auth=4,5

> I haven't checked the code, but having those testhelpers as
> prerequisites of the test scripts may help in that case.
>
> Michael

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: fix notmuch-show-update-tags to support duplicate files

2022-09-22 Thread Tomi Ollila
With duplicate files, the headerlines of messages in notmuch-show
buffer contains (initially) 1/n at the end of line.

Update the regexp used to search and replace tag changes to
match the current line -- drop unnecessary capturing of the
(tags), but capture the duplicates indicator.

Update the headerline pretty much like notmuch-show-insert-headerline
does, like the changes introduced mostly in commit 5ea5a5557d9a.
---

Is this getting too complex (well, we may have other stuff with
similar complexity there ;/) ?

Is there any better solutions ?

 emacs/notmuch-show.el | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ec998ede..0527c3a5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -453,13 +453,20 @@ (defun notmuch-show-update-tags (tags)
   "Update the displayed tags of the current message."
   (save-excursion
 (goto-char (notmuch-show-message-top))
-(when (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
-  (let ((inhibit-read-only t))
-   (replace-match (concat "("
-  (notmuch-tag-format-tags
-   tags
-   (notmuch-show-get-prop :orig-tags))
-  ")"))
+(when (re-search-forward "([^()]*) *\\([^()]*\\)$" (line-end-position) t)
+  (let ((inhibit-read-only t)
+   (tags-str (notmuch-tag-format-tags
+  tags (notmuch-show-get-prop :orig-tags)))
+   (txt (match-string 1)))
+   (replace-match (concat "(" tags-str ")"
+  (and (string-lessp "" txt)
+   (notmuch-show-spaces-n
+(max 0 (- (window-width)
+  (- (match-beginning 0)
+ (notmuch-show-message-top))
+  (length tags-str)
+  (length txt) 3
+  txt))
 
 (defun notmuch-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return a cons
-- 
2.30.2

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: add notmuch-search-edit-search and notmuch-tree-edit-search

2022-09-18 Thread Tomi Ollila
...and bind these to "E" in their respective keymaps.

Expected to be called interactively, then using read-from-minibuffer
with current search string as initial contents for editing.
(Noninteractive use makes little sense, but is supported.)

With this one can expand (as an opposite to limit) their
query and have e.g. (some of their) saved searches as search
"templates".

While at it, removed `(defvar notmuch-search-query-string)` from
notmuch-tree.el; it is unused (`notmuch-tree-basic-query` is used
instead).

Thanks to Jose Antonio Ortega Ruiz for his example for notmuch-tree
code, and better interactive use.
---
 emacs/notmuch-tree.el | 19 ---
 emacs/notmuch.el  |  7 +++
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 7ceddee2..b3c2c992 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -45,9 +45,6 @@
 (declare-function notmuch-search-previous-thread "notmuch" ())
 (declare-function notmuch-tree-from-search-thread "notmuch" ())
 
-;; the following variable is defined in notmuch.el
-(defvar notmuch-search-query-string)
-
 ;; this variable distinguishes the unthreaded display from the normal tree 
display
 (defvar-local notmuch-tree-unthreaded nil
   "A buffer local copy of argument unthreaded to the function notmuch-tree.")
@@ -399,6 +396,7 @@ (defvar notmuch-tree-mode-map
 (define-key map "V" 'notmuch-tree-view-raw-message)
 (define-key map "l" 'notmuch-tree-filter)
 (define-key map "t" 'notmuch-tree-filter-by-tag)
+(define-key map "E" 'notmuch-tree-edit-search)
 
 ;; The main tree view bindings
 (define-key map (kbd "RET") 'notmuch-tree-show-message)
@@ -1265,6 +1263,21 @@ (defun notmuch-tree-filter-by-tag (tag)
  nil
  notmuch-search-oldest-first)))
 
+(defun notmuch-tree-edit-search (query)
+  "Edit the current search"
+  (interactive (list (read-from-minibuffer "Edit search: "
+  notmuch-tree-basic-query)))
+  (let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto)))
+(notmuch-tree-close-message-window)
+(notmuch-tree query
+ notmuch-tree-query-context
+ nil
+ nil
+ nil
+ notmuch-tree-unthreaded
+ nil
+ notmuch-search-oldest-first)))
+
 ;;; _
 
 (provide 'notmuch-tree)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5cb7acd2..26181758 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -190,6 +190,7 @@ (defvar notmuch-search-mode-map
 (define-key map "c" 'notmuch-search-stash-map)
 (define-key map "t" 'notmuch-search-filter-by-tag)
 (define-key map "l" 'notmuch-search-filter)
+(define-key map "E" 'notmuch-search-edit-search)
 (define-key map [mouse-1] 'notmuch-search-show-thread)
 (define-key map "k" 'notmuch-tag-jump)
 (define-key map "*" 'notmuch-search-tag-all)
@@ -1156,6 +1157,12 @@ (defun notmuch-search-by-tag (tag)
(list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
   (notmuch-search (concat "tag:" tag)))
 
+(defun notmuch-search-edit-search (query)
+  "Edit the current search"
+  (interactive (list (read-from-minibuffer "Edit search: "
+  notmuch-search-query-string)))
+  (notmuch-search query notmuch-search-oldest-first))
+
 ;;;###autoload
 (defun notmuch ()
   "Run notmuch and display saved searches, known tags, etc."
-- 
2.34.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] test: compute expected keyid from fingerprint

2022-09-16 Thread Tomi Ollila
On Mon, Sep 12 2022, Daniel Kahn Gillmor wrote:

> On Sun 2022-09-11 23:50:18 +0200, Justus Winter wrote:
>> Tomi Ollila  writes:
>>
>>> On Fri, Sep 09 2022, Justus Winter wrote:
>>>
>>>> ---
>>>>  test/T350-crypto.sh | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
>>>> index 3c6626b4..721cbfdd 100755
>>>> --- a/test/T350-crypto.sh
>>>> +++ b/test/T350-crypto.sh
>>>> @@ -467,7 +467,7 @@ expected='[[[{"id": "X",
>>>>   "Date": "Sat, 01 Jan 2000 12:00:00 +"},
>>>>   "body": [{"id": 1,
>>>>   "sigstatus": [{"status": "error",
>>>> - "keyid": "6D92612D94E46381",
>>>> + "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'",
>>>
>>> The "bashism" (works also in zsh) ${FINGERPRINT:24} works here
>>> (and has been used in other lines in this file
>>
>> Interesting.  FTR, I saw this method being used elsewhere and simply
>> copied it.  If that'd prevent merging the change, I'd actually prefer
>> introducing a variable KEYID that is set explicitly in the test library.
>> The reason for that is that in v5 OpenPGP, the keyid will be computed
>> differently.
>
> I don't think this should prevent merging the change -- Tomi is just
> offering an efficiency improvement.

Right, especially if it is consistent w/ code somewhere else.

(and it sure looks like: grep cut' ' test/* shows consistent usage)

Tomi

>
> i'd also be happy with the introduction of an explicitly-set KEYID
> variable.  These could be distinct changes.
>
>--dkg
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: "-1 tests skipped"

2022-09-16 Thread Tomi Ollila
On Sun, Sep 11 2022, Daniel Kahn Gillmor wrote:

> I'm running the test suite on notmuch master
> (8eabd6388ecb7bea8246a9ba6943a0432d23406e), and i see the following
> report:
>
> ```
> All 1758 tests behaved as expected (12 expected failures).
> -1 tests skipped.
> All tests in 2 files skipped.
> ```

yes, that may happen... cannot recall when ;D

Tomi

>
> -1 tests skipped is pretty strange!
>
> I haven't tracked it down to fix the counting yet, but i thought i'd
> report it in case it's not known.  i see some commentary about weird
> aggregate results from the test suite from last year in the thread
> anchored in id:20210517081109.31897-1-tomi.oll...@iki.fi but haven't
> looked deep enough to see whether that's the same thing.
>
>--dkg
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] test: compute expected keyid from fingerprint

2022-09-11 Thread Tomi Ollila
On Fri, Sep 09 2022, Justus Winter wrote:

> ---
>  test/T350-crypto.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
> index 3c6626b4..721cbfdd 100755
> --- a/test/T350-crypto.sh
> +++ b/test/T350-crypto.sh
> @@ -467,7 +467,7 @@ expected='[[[{"id": "X",
>   "Date": "Sat, 01 Jan 2000 12:00:00 +"},
>   "body": [{"id": 1,
>   "sigstatus": [{"status": "error",
> - "keyid": "6D92612D94E46381",
> + "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'",

The "bashism" (works also in zsh) ${FINGERPRINT:24} works here
(and has been used in other lines in this file

Tomi

>   "errors": {"key-revoked": true}}],
>   "content-type": "multipart/signed",
>   "content": [{"id": 2,
> -- 
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs/show: use read-shell-command instead of read-string

2022-08-31 Thread Tomi Ollila
On Tue, Aug 30 2022, Antoine Beaupré wrote:

> This enables auto-completion of commands, something which plain
> read-string does not do. It's otherwise a drop-in
> replacement. According to `C-h f`, read-shell-command was introduced
> in Emacs 23.1 or earlier.

LGTM.

Tomi

> ---
>  emacs/notmuch-show.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 2dcef981..ec998ede 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -2192,7 +2192,7 @@ message."
>(interactive (let ((query-string (if current-prefix-arg
>  "Pipe all open messages to command: "
>"Pipe message to command: ")))
> -  (list current-prefix-arg (read-string query-string
> +  (list current-prefix-arg (read-shell-command query-string
>(let (shell-command)
>  (if entire-thread
>   (setq shell-command
> -- 
> 2.30.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: new notmuch-tree-process-exit-functions

2022-08-21 Thread Tomi Ollila
On Sun, Aug 21 2022, j...@gnu.org wrote:

> Hook run when the tree insertion process finishes its job.
>
> --

LGTM. I (also would have chosen this name instead of the *sentinel* one)

Tomi


> This patch supersedes , but
> changing the new variable name.
>
> Right now, it can be used for silly things like removing or changing
> the the "End of search." hardcoded message in the tree buffer.  But
> also for more sophisticated things like folding all threads in add-ons
> like my outline mode for tree buffers (to be submitted).
>
> Signed-off-by: jao 
> ---
>  emacs/notmuch-tree.el | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index f63ac9a5..7ceddee2 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -1084,6 +1084,12 @@ Complete list of currently available key bindings:
>(setq buffer-read-only t)
>(setq truncate-lines t))
>  
> +(defvar notmuch-tree-process-exit-functions nil
> +  "Functions called when the process inserting a tree of results finishes.
> +
> +Functions in this list are called with one argument, the process
> +object, and with the tree results buffer as the current buffer.")
> +
>  (defun notmuch-tree-process-sentinel (proc _msg)
>"Add a message to let user know when \"notmuch tree\" exits."
>(let ((buffer (process-buffer proc))
> @@ -1102,7 +1108,8 @@ Complete list of currently available key bindings:
>   (insert "End of search results.")
>   (unless (= exit-status 0)
> (insert (format " (process returned %d)" exit-status)))
> - (insert "\n")
> + (insert "\n"
> +   (run-hook-with-args 'notmuch-tree-process-exit-functions proc))
>  
>  (defun notmuch-tree-process-filter (proc string)
>"Process and filter the output of \"notmuch show\" for tree view."
> -- 
> 2.37.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: new notmuch-tree-process-hook

2022-08-16 Thread Tomi Ollila
On Tue, Aug 16 2022, j...@gnu.org wrote:

> Hook run when the tree insertion process finishes its job.
>
> --
>
> Right now, it can be used for silly things like removing or changing
> the the "End of search." hardcoded message in the tree buffer.  But
> also for more sophisticated things like folding all threads in add-ons
> like my outline mode for tree buffers (to be submitted).

2 things:

- is the name matching to the functionality enough
- IIRC if "hook" function takes args it should not be named as *-hook (?)
  (but *-functions)

Tomi



>
> Signed-off-by: jao 
> ---
>  emacs/notmuch-tree.el | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index f63ac9a5..265f7c1f 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -1084,6 +1084,12 @@ Complete list of currently available key bindings:
>(setq buffer-read-only t)
>(setq truncate-lines t))
>  
> +(defvar notmuch-tree-process-hook nil
> +  "Hook executed when the process inserting a tree of results finishes.
> +
> +Functions in this hook are called with one argument, the process
> +object, with the tree results buffer as the current buffer.")
> +
>  (defun notmuch-tree-process-sentinel (proc _msg)
>"Add a message to let user know when \"notmuch tree\" exits."
>(let ((buffer (process-buffer proc))
> @@ -1102,7 +1108,8 @@ Complete list of currently available key bindings:
>   (insert "End of search results.")
>   (unless (= exit-status 0)
> (insert (format " (process returned %d)" exit-status)))
> - (insert "\n")
> + (insert "\n"
> +   (run-hook-with-args 'notmuch-tree-process-hook proc))
>  
>  (defun notmuch-tree-process-filter (proc string)
>"Process and filter the output of \"notmuch show\" for tree view."
> -- 
> 2.37.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test: increase cffi timeout

2022-08-15 Thread Tomi Ollila
On Sun, Aug 14 2022, michaeljgruber wrote:

> From: Michael J Gruber 
>
> By default, the test suite uses 2min for other tests and 5s for cffi
> tests. Sporadically, this leads to test failures caused by the timeout
> on slower or loaded test infrastructure (as seen on ppc64le in Fedora's
> infrastructure during branch time).
>
> Increase the cffi timeout to the same 2m=120s.
>
> Signed-off-by: Michael J Gruber 
> ---
> It's the first time I encountered this on Fedora's infrastructure during
> a test build. In any case, having the timeouts similar may make sense in
> general, unless we typically run into them in normal (local) use.
>
>  bindings/python-cffi/tests/conftest.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bindings/python-cffi/tests/conftest.py 
> b/bindings/python-cffi/tests/conftest.py
> index 6835fd30..fe90c787 100644
> --- a/bindings/python-cffi/tests/conftest.py
> +++ b/bindings/python-cffi/tests/conftest.py
> @@ -43,7 +43,7 @@ def notmuch(maildir):
>  env = os.environ.copy()
>  env['NOTMUCH_CONFIG'] = str(cfg_fname)
>  proc = subprocess.run(cmd,
> -  timeout=5,
> +  timeout=120,

LGTM.

Tomi

>env=env)
>  proc.check_returncode()
>  return run
> -- 
> 2.37.2.596.g72ccb331cf
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Embed elisp.py from flycheck, use it in notmuch-emacs doc

2022-08-10 Thread Tomi Ollila
On Sun, Jul 31 2022, David Bremner wrote:

> After finding myself spending a while trying to re-create one of the
> features [0] of the el sphinx domain used in flycheck, I decided to try
> just converting the docs to use that sphinx extension.
>
> As I remarked in 2018 [1], there doesn't seem to be a distributed
> version of this sphinx extension. It also seems like the use-case in
> notmuch is a bit different in terms of what we want to put in the
> index, but perhaps someone better at sphinx than I could do those
> customizations without modifying the extension (as this series does).
>
> Overall I think the quality of the resulting HTML documentation is
> quite nice. The change in the info documentation is less clear.  This
> may also be tweakable, but in the first version the info docs seem
> more verbose than necessary (e.g. writing "Key Binding" everywhere) On
> the other hand, if it encourages people (e.g. me) to document things,
> then it's probably a win overall.
>
> [0]: documenting both a keybinding and a function name with the same
> directive, with nice index entries.

This series is probably good; at least it does not break software
(and if doc quality (or making of it) gets better then good :D)

Tomi

>
> [1]: id:20180521200856.17103-1-da...@tethera.net
>
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/2] emacs/show: restrict inlined mimetypes on refresh.

2022-08-10 Thread Tomi Ollila
On Mon, Aug 01 2022, David Bremner wrote:

> This fixes the bug reported by Al [1]. Essentially apply the same fix
> as [2] in a different place.
>
> [1]: id:877d41nmr1@gmail.com
> [2]: 90a7c1af368a527700dcde9b0dcbd760afc7bd92

LGTM.

Tomi


> ---
>  emacs/notmuch-show.el   | 1 +
>  test/T450-emacs-show.sh | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 1bc3b319..c072e81d 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1528,6 +1528,7 @@ non-nil) then the state of the buffer (open/closed 
> messages) is
>  reset based on the original query."
>(interactive "P")
>(let ((inhibit-read-only t)
> + (mm-inline-override-types (notmuch--inline-override-types))
>   (state (unless reset-state
>(notmuch-show-capture-state
>  ;; `erase-buffer' does not seem to remove overlays, which can lead
> diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
> index b77f8c0e..e161ee4f 100755
> --- a/test/T450-emacs-show.sh
> +++ b/test/T450-emacs-show.sh
> @@ -339,7 +339,6 @@ EOF
>  test_expect_equal_file EXPECTED OUTPUT
>  
>  test_begin_subtest "tar not inlined by default on refresh"
> -test_subtest_known_broken
>  test_emacs '(notmuch-show "id:874llc2bkp@curie.anarc.at")
>  (notmuch-show-refresh-view)
>   (test-visible-output "OUTPUT")'
> -- 
> 2.35.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 6/9] test: Add test cases for new exclude option

2022-08-08 Thread Tomi Ollila
On Sun, Aug 07 2022, Mohsin Kaleem wrote:

> ---
>  test/T461-emacs-search-exclude.sh | 99 +++
>  .../notmuch-search-tag-inbox-with-excluded| 25 +
>  .../notmuch-search-tag-inbox-without-excluded | 21 
>  .../notmuch-tree-tag-inbox-with-excluded  | 53 ++
>  .../notmuch-tree-tag-inbox-without-excluded   | 49 +
>  5 files changed, 247 insertions(+)
>  create mode 100755 test/T461-emacs-search-exclude.sh
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
>
> diff --git a/test/T461-emacs-search-exclude.sh 
> b/test/T461-emacs-search-exclude.sh
> new file mode 100755
> index ..bf558847
> --- /dev/null
> +++ b/test/T461-emacs-search-exclude.sh
> @@ -0,0 +1,99 @@
> +#!/usr/bin/env bash
> +
> +test_description="exclude options persist between Emacs search and tree 
> modes"
> +. $(dirname "$0")/test-lib.sh || exit 1
> +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
> +
> +EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
> +
> +test_require_emacs
> +add_email_corpus
> +notmuch config set search.exclude_tags deleted
> +notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
> +
> +# Basic test cases just asserting exclude option is working and consistent.
> +
> +test_begin_subtest "Search doesn't contain excluded mail by default"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> + (test-output)
> + (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded 
> OUTPUT
> +
> +test_begin_subtest "Toggling exclude in search will show excluded mail"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> +  (notmuch-search-toggle-exclude)

It looks like tab width was not 8 when these (notmuch-search-toggle-exclude)
were added, accidentally indented w/ leading space, not tab ;/

(ditto for all other (notmuch-search-toggle-exclude), rest of the content
removed.)

> + (notmuch-test-wait)

Otherwise, in this large set of changes, I could not see anything alarming,
but I did not test (I even don't know how, as I don't have excludes...)

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Create tags from folders

2022-08-08 Thread Tomi Ollila
On Sun, Aug 07 2022, Notmuch mailinglist wrote:

> Hello,
>
> I've managed to get mbsync, notmuch and neomutt all setup. But its now time 
> for fine tuning and tinkering.
> My email is from Protonmail and I use sieve filters to organise my mail as 
> needed into folders.
> Mbsync creates a folder structure which mirrors what is on my proton mail 
> account.
> But is it possible for notmuch to create tags based on the folders within my 
> mail directory and tagging the mails..
>
> Basically what I want is
> "if mail in folder1 tag as folder1"
>
> Hope this makes sense.

The question one can make based on the other reply is why tag based on
folders, and just not use folder queries finding the mails in these
folders.

It is kinda duplicate information to have mail tagged with same name
as the folder it is located in... but there may be reasons one would
like to do such a thing -- and at least I am interested (at least a bit)
why.

Tomi

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] notmuch.c: add missing trailing newlines in two error messages

2022-07-31 Thread Tomi Ollila
Removed duplicate error check (and the message) in 3rd case where
the same error message (w/o trailing newline) was present.

In case of test/T040-setup.sh, command substitution deletes
trailing newlines, so related test there cannot be changed
(and therefore could not notice this user experience flaw).
---

The current error message can be experienced with

$ NOTMUCH_CONFIG=no-cnfig-thre notmuch new
and (the second change, removed in this commit)
$ NOTMUCH_CONFIG=no-cnfig-thre notmuch config


 notmuch.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/notmuch.c b/notmuch.c
index c75b0188..37286b8f 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -531,7 +531,7 @@ main (int argc, char *argv[])
}
 
if (status == NOTMUCH_STATUS_NO_CONFIG)
-   fputs ("Try running 'notmuch setup' to create a 
configuration.", stderr);
+   fputs ("Try running 'notmuch setup' to create a 
configuration.\n", stderr);
 
return EXIT_FAILURE;
}
@@ -563,15 +563,10 @@ main (int argc, char *argv[])
   NULL,
   ,
   _string);
-
-   if (status == NOTMUCH_STATUS_NO_CONFIG && ! (command->mode & 
NOTMUCH_COMMAND_CONFIG_CREATE)) {
-   fputs ("Try running 'notmuch setup' to create a configuration.", 
stderr);
-   goto DONE;
-   }
switch (status) {
case NOTMUCH_STATUS_NO_CONFIG:
if (! (command->mode & NOTMUCH_COMMAND_CONFIG_CREATE)) {
-   fputs ("Try running 'notmuch setup' to create a 
configuration.", stderr);
+   fputs ("Try running 'notmuch setup' to create a 
configuration.\n", stderr);
goto DONE;
}
break;
-- 
2.34.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] CLI/git: opportunistically use bindings to check for known messages

2022-07-16 Thread Tomi Ollila
On Fri, Jul 15 2022, David Bremner wrote:

> If the bindings are installed, use them to avoid one exec of notmuch
> search per message.

tnx. continues to work for me where I have symlink to nmbug in ~/bin/.
some time in the future i'll investigate whether i get 
python3 path/to/nmbug.zip ... working but not today...

the series looks good to me.

Tomi

> ---
>  notmuch-git.py | 33 -
>  1 file changed, 28 insertions(+), 5 deletions(-)
>
> I decided to leave the old (slow) path in for now, since it is fast
> enough for use of nmbug to manage notmuch developement tags.
>
>
> diff --git a/notmuch-git.py b/notmuch-git.py
> index 4d9887c8..ceb86fbc 100644
> --- a/notmuch-git.py
> +++ b/notmuch-git.py
> @@ -698,6 +698,32 @@ def _is_unmerged(ref='@{upstream}'):
>  stdout=_subprocess.PIPE, wait=True)
>  return base != fetch_head
>  
> +class DatabaseCache:
> +def __init__(self):
> +try:
> +from notmuch2 import Database
> +self._notmuch = Database()
> +except ImportError:
> +self._notmuch = None
> +self._known = {}
> +
> +def known(self,id):
> +if id in self._known:
> +return self._known[id];
> +
> +if self._notmuch:
> +try:
> +_ = self._notmuch.find(id)
> +self._known[id] = True
> +except LookupError:
> +self._known[id] = False
> +else:
> +(_, stdout, stderr) = _spawn(
> +args=['notmuch', 'search', '--output=files', 
> 'id:{0}'.format(id)],
> +stdout=_subprocess.PIPE,
> +wait=True)
> +self._known[id] = stdout != None
> +return self._known[id]
>  
>  @timed
>  def get_status():
> @@ -705,14 +731,11 @@ def get_status():
>  'deleted': {},
>  'missing': {},
>  }
> +db = DatabaseCache()
>  with PrivateIndex(repo=NOTMUCH_GIT_DIR, prefix=TAG_PREFIX) as index:
>  maybe_deleted = index.diff(filter='D')
>  for id, tags in maybe_deleted.items():
> -(_, stdout, stderr) = _spawn(
> -args=['notmuch', 'search', '--output=files', 
> 'id:{0}'.format(id)],
> -stdout=_subprocess.PIPE,
> -wait=True)
> -if stdout:
> +if db.known(id):
>  status['deleted'][id] = tags
>  else:
>  status['missing'][id] = tags
> -- 
> 2.35.1
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


quoting: (was: Re: bug#56442: gnus-search-run-search: Hits notmuch command line length limits)

2022-07-09 Thread Tomi Ollila
On Sat, Jul 09 2022, Eric Abrahamsen wrote:

>
> Huh, I tried this a couple months ago with a more complicated query,
> like:
>
> thread:{from:bob or from:jane}
>
> and I remember notmuch barking at me about spaces or the "or" or
> something -- anyway I got the impression that it couldn't accept
> multi-part queries inside the "thread:{}" syntax. But looking at your
> patch maybe I just needed to quote differently?

I am not sure whether this is relevant, but I give a shot...

I tried the following queries from command line:

$ notmuch search 'thread:"{from:bob or from:jane}"'

thread:0b91   2009-01-20 [6/6] ...
thread:15fa   2008-11-26 [2/2] ...

and

$ notmuch search 'from:bob or from:jane}':

thread:0b91   2009-01-20 [1/6] ...
thread:15fa   2008-11-26 [1/2] ...


The outer '':s protect from shell expansion so what is
inside those goes verbatim to notmuch and from there to
xapian query parser (IIRC). 

Former includes all messages in thread where at least
one message matched to the query and latter just those
messages that match the query.

Like Sean mentioned in another message, Xapian converts ""
to " in query string (probably something irrelevant in this
discussion) the thread:"{...}" syntax binds the whole expression
to this thread: prefix (Why {...} is not enough is beyond me ;D)

Tomi

>
> Anyway I'll give this a test this weekend. It would be *very* nice if we
> could use this syntax rather than the ugly home-grown one.
>
> Thanks for the report!
>
> Eric
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 4/4] CLI/git: replace calls to notmuch-search with database access

2022-07-07 Thread Tomi Ollila
On Sun, Jul 03 2022, David Bremner wrote:

> This introduces a dependency on the (new) python bindings, but since
> it also yields a 4x performance improvement on the large performance
> corpus, I think it is worth it.
> ---
>  debian/control   |  1 +
>  notmuch-git.py   | 18 +-
>  test/T850-git.sh |  2 ++
>  3 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/debian/control b/debian/control
> index 0ffe958c..7099fe97 100644
> --- a/debian/control
> +++ b/debian/control
> @@ -73,6 +73,7 @@ Depends:
>   git,
>   notmuch,
>   python3,
> + python3-notmuch2
>   ${misc:Depends}
>  Description: thread-based email index, search and tagging
>   Notmuch is a system for indexing, searching, reading, and tagging
> diff --git a/notmuch-git.py b/notmuch-git.py
> index a3ae15f7..eac24a46 100644
> --- a/notmuch-git.py
> +++ b/notmuch-git.py
> @@ -701,21 +701,21 @@ def _is_unmerged(ref='@{upstream}'):
>  
>  @timed
>  def get_status():
> +from notmuch2 import Database
> +
>  status = {
>  'deleted': {},
>  'missing': {},
>  }
>  with PrivateIndex(repo=NOTMUCH_GIT_DIR, prefix=TAG_PREFIX) as index:
>  maybe_deleted = index.diff(filter='D')
> -for id, tags in maybe_deleted.items():
> -(_, stdout, stderr) = _spawn(
> -args=['notmuch', 'search', '--output=files', 
> 'id:{0}'.format(id)],
> -stdout=_subprocess.PIPE,
> -wait=True)
> -if stdout:
> -status['deleted'][id] = tags
> -else:
> -status['missing'][id] = tags
> +with Database() as notmuch:
> +for id, tags in maybe_deleted.items():
> +try:
> +_ =  notmuch.find(id)

One extra space above.

For me looking further here stalled to the introduced python bindings
dependency -- it make is much harder to make working notmuch-git
installation...

... currently it is enough that notmuch(1) binary is in PATH -- I
personally just build new versions of notmuch and copy it to $HOME/bin
and it just works(tm). Same with nmbug. To get python bindings work one has
to be able to build the c module, and then copy the set of python files (or
make zip archive) to a directory (along w/ that c module -- where did that
get copied cannot remember now...:)

I've trying to think if there were a way to somehow run only one notmuch
command instead of notmuch search on all maeby-deleted files -- or
alternatively attempt to load python bindings and in case of failure use
the notmuch-search methid...

Tomi

> +status['deleted'][id] = tags
> +except LookupError:
> +status['missing'][id] = tags
>  status['added'] = index.diff(filter='A')
>  
>  return status
> diff --git a/test/T850-git.sh b/test/T850-git.sh
> index 81400328..b1bc9e7e 100755
> --- a/test/T850-git.sh
> +++ b/test/T850-git.sh
> @@ -7,6 +7,8 @@ if [ $NOTMUCH_HAVE_SFSEXP -ne 1 ]; then
>  test_done
>  fi
>  
> +export 
> PYTHONPATH="$NOTMUCH_BUILDDIR/bindings/python-cffi/build/stage:${PYTHONPATH:+:$PYTHONPATH}"
> +
>  # be very careful using backup_database / restore_database in this
>  # file, as they fool the cache invalidation checks in notmuch-git.
>  
> -- 
> 2.35.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/4] perf-test: add tests for notmuch-git

2022-07-05 Thread Tomi Ollila
On Sun, Jul 03 2022, David Bremner wrote:

> The main focus of these initial tests is the (currently unacceptably
> slow) checkout performance.
> ---
>  performance-test/T07-git.sh | 23 +++
>  1 file changed, 23 insertions(+)
>  create mode 100755 performance-test/T07-git.sh
>
> diff --git a/performance-test/T07-git.sh b/performance-test/T07-git.sh
> new file mode 100755
> index ..11dfec05
> --- /dev/null
> +++ b/performance-test/T07-git.sh
> @@ -0,0 +1,23 @@
> +#!/usr/bin/env bash
> +
> +test_description='notmuch-git'
> +
> +. $(dirname "$0")/perf-test-lib.sh || exit 1
> +
> +time_start
> +
> +time_run 'init' "notmuch git init"
> +
> +time_run 'commit --force' "notmuch git commit --force"
> +time_run 'commit' "notmuch git -l error commit"
> +time_run 'commit' "notmuch git -l error commit"
> +
> +time_run 'checkout' "notmuch git checkout"
> +
> +time_run 'tag -inbox' "notmuch tag -inbox '*'"
> +
> +time_run 'checkout --force' "notmuch git checkout --force"
> +
> +
> +

Is three empty lines a bit excessive...?

> +time_done
> -- 
> 2.35.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] doc/emacs: add notmuch-show-empty-saved-searches to manual

2022-07-05 Thread Tomi Ollila
On Fri, Jul 01 2022, David Bremner wrote:

> Answering a user question, I had to dig for this variable, but I think
> it is a reasonably common customization wish, particularly for users
> with custom count-functions.

pretty trivial. i trust it works as expected (at least no extra whitespace
;) 

> ---
>  doc/notmuch-emacs.rst | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
> index b990296a..abf188d2 100644
> --- a/doc/notmuch-emacs.rst
> +++ b/doc/notmuch-emacs.rst
> @@ -94,6 +94,9 @@ customizing the variables
>  - if you don't want to worry about all of this nonsense, leave
>this set to `t`.
>  
> +.. emacsvar:: notmuch-show-empty-saved-searches
> +
> +   |docstring::notmuch-show-empty-saved-searches|
>  
>  notmuch-hello key bindings
>  --
> -- 
> 2.35.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] CLI/git: replace most mentions of nmbug

2022-07-05 Thread Tomi Ollila
On Mon, Jul 04 2022, David Bremner wrote:

> Particularly in help messages, nmbug is confusing for users who may
> have never heard of it.

Good Progress! LGTM!

Tomi

> ---
>  notmuch-git.py | 40 
>  1 file changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/notmuch-git.py b/notmuch-git.py
> index eac24a46..42de074e 100644
> --- a/notmuch-git.py
> +++ b/notmuch-git.py
> @@ -40,7 +40,7 @@ from urllib.parse import quote as _quote
>  from urllib.parse import unquote as _unquote
>  import json as _json
>  
> -_LOG = _logging.getLogger('nmbug')
> +_LOG = _logging.getLogger('notmuch-git')
>  _LOG.setLevel(_logging.WARNING)
>  _LOG.addHandler(_logging.StreamHandler())
>  
> @@ -260,7 +260,7 @@ def get_tags(prefix=None):
>  
>  def archive(treeish='HEAD', args=()):
>  """
> -Dump a tar archive of the current nmbug tag set.
> +Dump a tar archive of the current notmuch-git tag set.
>  
>  Using 'git archive'.
>  
> @@ -278,13 +278,13 @@ def archive(treeish='HEAD', args=()):
>  
>  def clone(repository):
>  """
> -Create a local nmbug repository from a remote source.
> +Create a local notmuch-git repository from a remote source.
>  
>  This wraps 'git clone', adding some options to avoid creating a
>  working tree while preserving remote-tracking branches and
>  upstreams.
>  """
> -with _tempfile.TemporaryDirectory(prefix='nmbug-clone.') as workdir:
> +with _tempfile.TemporaryDirectory(prefix='notmuch-git-clone.') as 
> workdir:
>  _spawn(
>  args=[
>  'git', 'clone', '--no-checkout', '--separate-git-dir', 
> NOTMUCH_GIT_DIR,
> @@ -454,7 +454,7 @@ def fetch(remote=None):
>  
>  def init(remote=None,format_version=None):
>  """
> -Create an empty nmbug repository.
> +Create an empty notmuch-git repository.
>  
>  This wraps 'git init' with a few extra steps to support subsequent
>  status and commit commands.
> @@ -542,9 +542,9 @@ def _insist_committed():
>  _LOG.error('\n'.join([
>  'Uncommitted changes to {prefix}* tags in notmuch',
>  '',
> -"For a summary of changes, run 'nmbug status'",
> -"To save your changes, run 'nmbug commit' before 
> merging/pull",
> -"To discard your changes,  run 'nmbug checkout'",
> +"For a summary of changes, run 'notmuch-git status'",
> +"To save your changes, run 'notmuch-git commit' before 
> merging/pull",
> +"To discard your changes,  run 'notmuch-git checkout'",
>  ]).format(prefix=TAG_PREFIX))
>  _sys.exit(1)
>  
> @@ -566,7 +566,7 @@ def pull(repository=None, refspecs=None):
>  args.append(repository)
>  if refspecs:
>  args.extend(refspecs)
> -with _tempfile.TemporaryDirectory(prefix='nmbug-pull.') as workdir:
> +with _tempfile.TemporaryDirectory(prefix='notmuch-git-pull.') as workdir:
>  for command in [
>  ['reset', '--hard'],
>  args]:
> @@ -584,7 +584,7 @@ def merge(reference='@{upstream}'):
>  The default reference is '@{upstream}'.
>  """
>  _insist_committed()
> -with _tempfile.TemporaryDirectory(prefix='nmbug-merge.') as workdir:
> +with _tempfile.TemporaryDirectory(prefix='notmuch-git-merge.') as 
> workdir:
>  for command in [
>  ['reset', '--hard'],
>  ['merge', reference]]:
> @@ -599,8 +599,8 @@ def log(args=()):
>  """
>  A simple wrapper for 'git log'.
>  
> -After running 'nmbug fetch', you can inspect the changes with
> -'nmbug log HEAD..@{upstream}'.
> +After running 'notmuch-git fetch', you can inspect the changes with
> +'notmuch-git log HEAD..@{upstream}'.
>  """
>  # we don't want output trapping here, because we want the pager.
>  args = ['log', '--name-status', '--no-renames'] + list(args)
> @@ -609,7 +609,7 @@ def log(args=()):
>  
>  
>  def push(repository=None, refspecs=None):
> -"Push the local nmbug Git state to a remote repository."
> +"Push the local notmuch-git Git state to a remote repository."
>  if refspecs and not repository:
>  repository = _get_remote()
>  args = ['push']
> @@ -632,13 +632,13 @@ def status():
>  
>  * A
>  
> -  Tag is present in notmuch database, but not committed to nmbug
> -  (equivalently, tag has been deleted in nmbug repo, e.g. by a
> +  Tag is present in notmuch database, but not committed to notmuch-git
> +  (equivalently, tag has been deleted in notmuch-git repo, e.g. by a
>pull, but not restored to notmuch database).
>  
>  * D
>  
> -  Tag is present in nmbug repo, but not restored to notmuch
> +  Tag is present in notmuch-git repo, but not restored to notmuch
>database (equivalently, tag has been deleted in notmuch).
>  
>  * U
> @@ -646,7 +646,7 @@ def status():
>Message is unknown 

Re: [PATCH] emacs: mark notmuch-query.el as obsolete

2022-07-03 Thread Tomi Ollila
On Tue, Jun 28 2022, David Bremner wrote:

> The only functionality actually used by notmuch is the base function
> notmuch-query-get-threads; the other functions in this file have
> nothing to do with that (single) use.  Move that function into
> notmuch-lib.el and rename to reflect use. Deprecate the other
> functions in notmuch-query.el.

LGTM.

Tomi

> ---
>  emacs/notmuch-lib.el   | 12 
>  emacs/notmuch-query.el | 23 ++-
>  emacs/notmuch-show.el  |  3 +--
>  emacs/notmuch-tree.el  |  1 -
>  4 files changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 1e631d0e..cc706924 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -1029,6 +1029,18 @@ status."
>  
>  (defvar-local notmuch-show-process-crypto nil)
>  
> +(defun notmuch--run-show (search-terms)
> +  "Return a list of threads of messages matching SEARCH-TERMS.
> +
> +A thread is a forest or list of trees. A tree is a two element
> +list where the first element is a message, and the second element
> +is a possibly empty forest of replies."
> +  (let ((args '("show" "--format=sexp" "--format-version=5")))
> +(when notmuch-show-process-crypto
> +  (setq args (append args '("--decrypt=true"
> +(setq args (append args search-terms))
> +(apply #'notmuch-call-notmuch-sexp args)))
> +
>  ;;; Generic Utilities
>  
>  (defun notmuch-interactive-region ()
> diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el
> index 5c7f4f8d..2a46144c 100644
> --- a/emacs/notmuch-query.el
> +++ b/emacs/notmuch-query.el
> @@ -25,17 +25,10 @@
>  
>  ;;; Basic query function
>  
> -(defun notmuch-query-get-threads (search-terms)
> -  "Return a list of threads of messages matching SEARCH-TERMS.
> -
> -A thread is a forest or list of trees. A tree is a two element
> -list where the first element is a message, and the second element
> -is a possibly empty forest of replies."
> -  (let ((args '("show" "--format=sexp" "--format-version=5")))
> -(when notmuch-show-process-crypto
> -  (setq args (append args '("--decrypt=true"
> -(setq args (append args search-terms))
> -(apply #'notmuch-call-notmuch-sexp args)))
> +(define-obsolete-function-alias
> +  'notmuch-query-get-threads
> +  #'notmuch--run-show
> +  "notmuch 0.37")
>  
>  ;;; Mapping functions across collections of messages
>  
> @@ -60,7 +53,7 @@ Flatten results to a list.  See the function
>  (defun notmuch-query-map-tree (fn tree)
>"Apply function FN to every message in TREE.
>  Flatten results to a list.  See the function
> -`notmuch-query-get-threads' for more information."
> +`notmuch--run-show' for more information."
>(cons (funcall fn (car tree))
>   (notmuch-query-map-forest fn (cadr tree
>  
> @@ -70,7 +63,11 @@ Flatten results to a list.  See the function
>"Return a list of message-ids of messages that match SEARCH-TERMS."
>(notmuch-query-map-threads
> (lambda (msg) (plist-get msg :id))
> -   (notmuch-query-get-threads search-terms)))
> +   (notmuch--run-show search-terms)))
> +
> +;;; Everything in this library is obsolete
> +(dolist (fun '(map-aux map-threads map-forest map-tree get-message-ids))
> +  (make-obsolete (intern (format "notmuch-query-%s" fun)) nil "notmuch 
> 0.37"))
>  
>  (provide 'notmuch-query)
>  
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index aded1ee7..0954d876 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -32,7 +32,6 @@
>  
>  (require 'notmuch-lib)
>  (require 'notmuch-tag)
> -(require 'notmuch-query)
>  (require 'notmuch-wash)
>  (require 'notmuch-mua)
>  (require 'notmuch-crypto)
> @@ -1366,7 +1365,7 @@ If no messages match the query return NIL."
>(notmuch-show-previous-subject ""))
>  ;; Use results from the first query that returns some.
>  (while (and (not forest) queries)
> -  (setq forest (notmuch-query-get-threads
> +  (setq forest (notmuch--run-show
>   (append cli-args (list "'") (car queries) (list "'"
>(when (and forest notmuch-show-single-message)
>   (setq forest (list (list (list forest)
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index 303c6fad..8b246a2e 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -27,7 +27,6 @@
>  (require 'mail-parse)
>  
>  (require 'notmuch-lib)
> -(require 'notmuch-query)
>  (require 'notmuch-show)
>  (require 'notmuch-tag)
>  (require 'notmuch-parser)
> -- 
> 2.35.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 1/1] emacs: notmuch-show-header-line: allow format strings and functions

2022-05-18 Thread Tomi Ollila
On Tue, May 17 2022, Jose A. Ortega Ruiz wrote:

> On Tue, May 17 2022, Tomi Ollila wrote:
>
> [...]
>
>> Otherwise it looks good to me (took a bit to match cond CLAUSES...)
>
> perhaps it'd be bit clearer if i factor it out in a separate function
> that just does the bit of setting the header line format?

I thought something similar last night

>
> cheers,
> jao
> -- 
> Not far from the invention of fire must rank the invention of doubt.
> -Thomas Henry Huxley, biologist (1825-1895)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 1/1] emacs: notmuch-show-header-line: allow format strings and functions

2022-05-17 Thread Tomi Ollila
On Mon, May 16 2022, j...@gnu.org wrote:

> If a string value is assigned to notmuch-show-header-line, it's used
> as a format string to be passed passed to format-spec with `%s`
> substituted by the message's subject.  If a function is given, it's
> called with the subject as argument, and its return value used as
> header line.
>
> As before, t means displaying the subject and nil not using any header
> line.
>
> Signed-off-by: jao 
> ---
>  emacs/notmuch-show.el | 37 ++---
>  1 file changed, 30 insertions(+), 7 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 7c1f02c9..79599480 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -85,8 +85,26 @@ visible for any given message."
>:group 'notmuch-show)
>  
>  (defcustom notmuch-show-header-line t
> -  "Show a header line with the current message's subject."
> -  :type 'boolean
> +  "Show a header line in notmuch show buffers.
> +
> +If t (the default), the header line will contain the current
> +message's subject.
> +
> +If a string, this value is interpreted as a format string to be
> +passed to `format-spec` with `%s` as the substitution variable
> +for the message's subject.  E.g., to display the subject trimmed
> +to a maximum of 80 columns, you could use \"%>-80s\" as format.
> +
> +If you assign to this variable a function, the function will be
> +called with the subject as argument and its return value used as
> +the header line.
> +
> +Finally, if this variabale is set to nil, no header is
> +displayed."
> +  :type '(choice (const :tag "No header" ni)
> + (const :tag "Subject" t)
> + (string :tag "Format")
> +  (function :tag "Function"))
>:group 'notmuch-show)
>  
>  (defcustom notmuch-show-relative-dates t
> @@ -1351,11 +1369,16 @@ If no messages match the query return NIL."
> (lambda () (notmuch-show-set-prop :orig-tags 
> (notmuch-show-get-tags
>;; Set the header line to the subject of the first message.
>(when notmuch-show-header-line
> - (setq header-line-format
> -   (replace-regexp-in-string "%" "%%"
> - (notmuch-sanitize
> -  (notmuch-show-strip-re
> -   (notmuch-show-get-subject))
> +(let* ((s (replace-regexp-in-string "%" "%%"
> +(notmuch-sanitize
> + (notmuch-show-strip-re
> +  (notmuch-show-get-subject)
> +   (h (cond ((stringp notmuch-show-header-line)
> + (format-spec notmuch-show-header-line `((?s . ,s
> + ((functionp notmuch-show-header-line)
> +  (funcall notmuch-show-header-line s))
> + (notmuch-show-header-line s
> +  (setq header-line-format h)))

To me it looks like some lines are indented with tabs and some spaces
(noticed as indentation looked weird to me and then started moving cursor
at the beginning of line -- there is probably a way to highlight tabs in
notmuch show buffer but...)

Otherwise it looks good to me (took a bit to match cond CLAUSES...)

Tomi

>(run-hooks 'notmuch-show-hook)
>(if state
> (notmuch-show-apply-state state)
> -- 
> 2.36.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 1/2] emacs: Make indentation more consistent in notmuch-search-show-thread

2022-05-03 Thread Tomi Ollila
On Mon, May 02 2022, Leo Okawa Ericson wrote:

> ---
>  emacs/notmuch.el | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index c9cf80dc..c1ddb06b 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -525,13 +525,13 @@ (defun notmuch-search-show-thread ( 
> elide-toggle)
>(let ((thread-id (notmuch-search-find-thread-id)))
>  (if thread-id
>   (notmuch-show thread-id
> -   elide-toggle
> -   (current-buffer)
> -   notmuch-search-query-string
> -   ;; Name the buffer based on the subject.
> -   (format "*%s*" (truncate-string-to-width
> -   (notmuch-search-find-subject)
> -   30 nil nil t)))

To me it looks like this change "breaks" indentation -- the original
where all function (notmuch-show) arguments are aligned vertically,
starting from same column in each line...???

> +elide-toggle
> +(current-buffer)
> +notmuch-search-query-string
> +;; Name the buffer based on the subject.
> +(format "*%s*" (truncate-string-to-width
> +(notmuch-search-find-subject)
> +30 nil nil t)))
>(message "End of search results."
>  
>  (defun notmuch-tree-from-search-current-query ()
>
> base-commit: e3ad0087f3453c89871acac8b11da8bab1ac54df

btw: what is this 'base commit:' line ?

Tomi

> -- 
> 2.36.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] doc/sexp-queries: escape @ in non-verbatim text

2022-04-29 Thread Tomi Ollila
On Thu, Apr 28 2022, David Bremner wrote:

> This prevents sphinx-doc from creating spurious mailto: links. Thanks
> to Jakub Wilk for telling me about the fix.

looks trivial to me
> ---
>  doc/man7/notmuch-sexp-queries.rst | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/doc/man7/notmuch-sexp-queries.rst 
> b/doc/man7/notmuch-sexp-queries.rst
> index bc8e5086..0eb86734 100644
> --- a/doc/man7/notmuch-sexp-queries.rst
> +++ b/doc/man7/notmuch-sexp-queries.rst
> @@ -230,11 +230,11 @@ EXAMPLES
>  
>  ``(folder (of (id 1234@invalid)))``
>  
> -Match any message in the same folder as the one with Message-Id 
> "1234@invalid"
> +Match any message in the same folder as the one with Message-Id 
> "1234\@invalid"
>  
>  ``(id 1234@invalid blah@test)``
>  
> -Matches Message-Id "1234@invalid" *or* Message-Id "blah@test"
> +Matches Message-Id "1234\@invalid" *or* Message-Id "blah\@test"
>  
>  ``(and (infix "date:2009-11-18..2009-11-18") (tag unread))``
>  
> @@ -260,18 +260,18 @@ EXAMPLES
>  
>  ``(thread (of (id 1234@invalid)))``
>  
> -Match any message in the same thread as the one with Message-Id 
> "1234@invalid"
> +Match any message in the same thread as the one with Message-Id 
> "1234\@invalid"
>  
>  ``(thread (matching (from b...@example.com) (to b...@example.com)))``
>  
>  Match any (messages in) a thread containing a message from
> -"b...@example.com" and a (possibly distinct) message to "bob at
> +"bob\@example.com" and a (possibly distinct) message to "bob at
>  example.com")
>  
>  ``(to (or b...@example.com mall...@example.org))`` ``(or (to 
> b...@example.com) (to mall...@example.org))``
>  
> -Match in the "To" or "Cc" headers, "b...@example.com",
> -"mall...@example.org", and also "b...@example.com.au" since it
> +Match in the "To" or "Cc" headers, "bob\@example.com",
> +"mallory\@example.org", and also "bob\@example.com.au" since it
>  contains the adjacent triple "bob", "example", "com".
>  
>  ``(not (to *))``
> -- 
> 2.35.2
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/1] emacs: Make notmuch-show-next-thread return nil on failure

2022-04-29 Thread Tomi Ollila
On Thu, Apr 28 2022, Leo wrote:

> From: Leo Okawa Ericson 
>
> Having notmuch-show-next-thread return non-nil on success and nil on
> failure makes it easier for users to interact with notmuch via elisp.
> ---
>  emacs/notmuch.el | 17 +
>  1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index c9cf80dc..a6198f4e 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -525,14 +525,15 @@ (defun notmuch-search-show-thread ( 
> elide-toggle)
>(let ((thread-id (notmuch-search-find-thread-id)))
>  (if thread-id
>   (notmuch-show thread-id
> -   elide-toggle
> -   (current-buffer)
> -   notmuch-search-query-string
> -   ;; Name the buffer based on the subject.
> -   (format "*%s*" (truncate-string-to-width
> -   (notmuch-search-find-subject)
> -   30 nil nil t)))
> -  (message "End of search results."
> +elide-toggle

I don't see why this indentation change is happening...

> +(current-buffer)
> +notmuch-search-query-string
> +;; Name the buffer based on the subject.
> +(format "*%s*" (truncate-string-to-width
> +(notmuch-search-find-subject)
> +30 nil nil t)))
> +  (message "End of search results.")
> +  nil)))
>  
>  (defun notmuch-tree-from-search-current-query ()
>"Tree view of current query."
> -- 
> 2.36.0
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: avoid warning with -Wall

2022-04-19 Thread Tomi Ollila
On Mon, Apr 18 2022, michaeljgruber wrote:

> From: Michael J Gruber 
>
> 7228fe68 ("configure: restructure gmime cert validity checker code",
> 2022-04-09) restructured generated C code to repurpose it later on. This
> put usage of `validity` within an `#if`, resulting in an "unused
> warning" if that `#if` is not executed.
>
> Put the variable declariation inside the same if branch and, thus,  quel
> the warning.

IMO the code could be changed to be even more RAIIy (even so that is not
common style there), also IMO removing warning is good enough reason to
deviate from that style (just in one place) so LGTM from me :D

Tomi

>
> Signed-off-by: Michael J Gruber 
> ---
> Purely cosmetic. There are more warnings during the build, but this was
> the only one during configure, so it stuck out a bit.
>
>  configure | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 2f6d8b68..30fee6ab 100755
> --- a/configure
> +++ b/configure
> @@ -564,7 +564,6 @@ int main () {
>  GMimeSignature *sig = NULL;
>  GMimeCertificate *cert = NULL;
>  GMimeObject *output = NULL;
> -GMimeValidity validity = GMIME_VALIDITY_UNKNOWN;
>  int len;
>  
>  g_mime_init ();
> @@ -586,7 +585,7 @@ int main () {
>  cert = g_mime_signature_get_certificate (sig);
>  if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate 
> found\n");
>  #ifdef CHECK_VALIDITY
> -validity = g_mime_certificate_get_id_validity (cert);
> +GMimeValidity validity = g_mime_certificate_get_id_validity (cert);
>  if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got 
> validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL);
>  #endif
>  #ifdef CHECK_EMAIL
> -- 
> 2.36.0.rc2.472.gf6a51f5f41
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: mailto: in Firefox and notmuch-emacs-mua

2022-04-18 Thread Tomi Ollila
On Fri, Apr 15 2022, talin nicholas wrote:

> When opening a mailto: link, Firefox defaults to notmuch-emacs-mua,
> which is what I want, minus that it spawns a new Emacs instance (which
> hangs) rather than opening an *unsent mail* buffer in my existing
> daemon. I copied the .desktop file from /usr/share/applications to
> ~/.local/share/applications and changed out the arguments in Exec= -
> trying  out --client, --create-frame, and --hello in combinations - to no
> avail. Now, when I open a link, it doesn't do anything. No new buffer,
> no new frame.

By looking the script, --client is needed to use emacsclient to send
message to running emacs daemon for a new mail buffer...

First, why using the default .desktop emacs hangs is one question (but
probably shows that environment is good enough for starting emacs in
graphical display). Why nothing happens when .local .desktop is used
is strange thing. Is the script silently failing...

what one could do is to copy notmuch-emacs-mua to /tmp or $HOME/...
and add theese lines to the beginning of the file (after #!... line):

exec 2>/tmp/nem.$$.txt
set -x

then perhaps the /tmp/nem.{pid}.txt files shed some light what is
happening...

Tomi









> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: emacs: notmuch-address-command 'as-is throws error (was: [PATCH] emacs: Add more front ends for address completion)

2022-02-22 Thread Tomi Ollila
On Mon, Feb 21 2022, Alexander Adolf wrote:

> Alexander Adolf  writes:
>
>> [...]
>> Hence, from my personal point of view, moving _all_ completion to go
>> through completion-at-point-functions seems the only reasonable way
>> forward.
>>
>> That would remove any special cases for when company is available from
>> the elisp. Fewer third-party integrations, fewer headaches.
>> [...]
>
> I have further ventured into this, and am attempting to disable all
> company-related stuff in notmuch-address.el, and instead go through
> completion-at-point-functions, and use corfu as the completion UI.
>
> To achieve this, I have set notmuch-address-use-company to nil, and
> notmuch-address-command to 'as-is.
>
> The latter setting (notmuch-address-command 'as-is) evokes an error:
> "Wrong type argument: stringp, as-is". The backtrace led me to marvel at
> the function notmuch-address-options (in notmuch-address.el). There, in
> case notmuch-address-command is not equal to 'internal, control is
> passed to notmuch--process-lines, which in turn uses 'as-is (a symbol)
> as the name of an external program to call. The name of that command is
> expected to be a string, and hence the "wrong type argument" error.
>
> The docstring for notmuch-address-command does not really state any
> other effects of 'as-is besides preventing modification of
> message-completion-alist (which is what I want, and to keep using the
> internal mechanism). The defcustom option for 'as-is is cunningly
> labelled "Use default or third-party mechanism", which doesn't tell me
> much more either.
>
> Am I misreading notmuch-address.el and/or the docs?

You are probably reading the code right. Probably all the combinations
notmuch-address variables can be set are not (throughly;) tested.

> In case not, how can I prevent modification of message-completion-alist
> by notmuch, and still have notmuch use the 'internal mechanism for
> generating address completion candidates?

My guess would be some elisp is required...

>
> Many thanks in advance and cheers,

>
>   --alexander

cheers, 

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v3] removed use of 'echo -n' (and echo -n -e ...)

2022-02-20 Thread Tomi Ollila
In most cases used printf %s ... instead.

echo -n > file  lines to create empty / truncate files were
changed to : > file lines, like done in in test-lib-emacs.sh

And one echo -n "  " replaced with use of sed "s/^/  /" in next line.
---

Replaces v2 id:20220220210111.17653-1-tomi.oll...@iki.fi

v3 removed 2 trailing spaces in one echoed output, which
were added at v1 but forgot to remove in v2.

In v3 the quotes in sed line changed from '...' to "..."
to be consistent with surrounding code.


 Makefile.local |  5 ++---
 devel/release-checks.sh| 20 ++--
 test/T090-search-output.sh |  2 +-
 test/T190-multipart.sh |  2 +-
 test/T380-atomicity.sh |  4 ++--
 5 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 10fb9908..8fb94b58 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -120,8 +120,7 @@ release-message:
@echo "Which can be verified with:"
@echo ""
@echo "  $(RELEASE_URL)/$(SHA256_FILE)"
-   @echo -n "  "
-   @cat releases/$(SHA256_FILE)
+   @sed "s/^/  /" releases/$(SHA256_FILE)
@echo ""
@echo "  $(RELEASE_URL)/$(DETACHED_SIG_FILE)"
@echo "  (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 
1`)"
@@ -169,7 +168,7 @@ release-checks:
 
 .PHONY: verify-newer
 verify-newer:
-   @echo -n "Checking that no $(VERSION) release already exists..."
+   @printf %s "Checking that no $(VERSION) release already exists..."
@wget -q --no-check-certificate -O /dev/null $(RELEASE_URL)/$(TAR_FILE) 
; \
case $$? in \
   8) echo "Good." ;; \
diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index 23c29eaa..c0accf78 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -59,7 +59,7 @@ readonly VERSION
 
 # In the rest of this file, tests collect list of errors to be fixed
 
-echo -n "Checking that git working directory is clean... "
+printf %s "Checking that git working directory is clean... "
 git_status=`git status --porcelain`
 if [ "$git_status" = '' ]
 then
@@ -77,7 +77,7 @@ verfail ()
append_emsg "  Please follow the instructions in RELEASING to choose a 
version"
 }
 
-echo -n "Checking that '$VERSION' is good with digits and periods... "
+printf %s "Checking that '$VERSION' is good with digits and periods... "
 case $VERSION in
*[!0-9.]*)
verfail "'$VERSION' contains other characters than digits and 
periods" ;;
@@ -88,7 +88,7 @@ case $VERSION in
*)  verfail "'$VERSION' is a single number" ;;
 esac
 
-echo -n "Checking that this is Debian package for notmuch... "
+printf %s "Checking that this is Debian package for notmuch... "
 read deb_notmuch deb_version rest < debian/changelog
 if [ "$deb_notmuch" = 'notmuch' ]
 then
@@ -98,7 +98,7 @@ else
append_emsg "Package name '$deb_notmuch' is not 'notmuch' in 
debian/changelog"
 fi
 
-echo -n "Checking that Debian package version is $VERSION-1... "
+printf %s "Checking that Debian package version is $VERSION-1... "
 
 if [ "$deb_version" = "($VERSION-1)" ]
 then
@@ -108,7 +108,7 @@ else
append_emsg "Version '$deb_version' is not '($VERSION-1)' in 
debian/changelog"
 fi
 
-echo -n "Checking that python bindings version is $VERSION... "
+printf %s "Checking that python bindings version is $VERSION... "
 py_version=`python3 -c "with open('$PV_FILE') as vf: exec(vf.read()); 
print(__VERSION__)"`
 if [ "$py_version" = "$VERSION" ]
 then
@@ -118,7 +118,7 @@ else
append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"
 fi
 
-echo -n "Checking that NEWS header is tidy... "
+printf %s "Checking that NEWS header is tidy... "
 if [ "`exec sed 's/./=/g; 1q' NEWS`" = "`exec sed '1d; 2q' NEWS`" ]
 then
echo Yes.
@@ -132,7 +132,7 @@ else
fi
 fi
 
-echo -n "Checking that this is Notmuch NEWS... "
+printf %s "Checking that this is Notmuch NEWS... "
 read news_notmuch news_version news_date < NEWS
 if [ "$news_notmuch" = "Notmuch" ]
 then
@@ -142,7 +142,7 @@ else
append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"
 fi
 
-echo -n "Checking that NEWS version is $VERSION... "
+printf %s "Checking that NEWS version is $VERSION... "
 if [ "$news_version" = "$VERSION" ]
 then
echo Yes.
@@ -154,7 +154,7 @@ fi
 #eval `date '+year=%Y mon=%m day=%d'`
 today0utc=`date --date=0Z +%s` # gnu date feature
 
-echo -n "Checking that NEWS date is right... "
+printf %s "Checking that NEWS date is right... "
 case $news_date in
  '('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')
newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`
@@ -176,7 +176,7 @@ case $news_date in
 esac
 
 year=`exec date +%Y`
-echo -n "Checking that copyright in documentation contains 2009-$year... "
+printf %s "Checking that copyright in documentation contains 2009-$year... "
 # Read the value of variable `copyright' defined in 'doc/conf.py'.
 copyrightline=$(grep 

[PATCH v2] removed use of 'echo -n' (and echo -n -e ...)

2022-02-20 Thread Tomi Ollila
In most cases used printf %s ... instead.

echo -n > file  lines to create empty / truncate files were
changed to : > file lines, like done in in test-lib-emacs.sh

And one echo -n "  " replaced with use of sed 's/^/  /' in next line.
---

Replaces id:20220220205230.17446-1-tomi.oll...@iki.fi

(silly mistake, tested everything *after* sending email (uh ;()

 Makefile.local |  7 +++
 devel/release-checks.sh| 20 ++--
 test/T090-search-output.sh |  2 +-
 test/T190-multipart.sh |  2 +-
 test/T380-atomicity.sh |  4 ++--
 5 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 10fb9908..7bae6938 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -119,9 +119,8 @@ release-message:
@echo ""
@echo "Which can be verified with:"
@echo ""
-   @echo "  $(RELEASE_URL)/$(SHA256_FILE)"
-   @echo -n "  "
-   @cat releases/$(SHA256_FILE)
+   @echo "  $(RELEASE_URL)/$(SHA256_FILE)  "
+   @sed 's/^/  /' releases/$(SHA256_FILE)
@echo ""
@echo "  $(RELEASE_URL)/$(DETACHED_SIG_FILE)"
@echo "  (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 
1`)"
@@ -169,7 +168,7 @@ release-checks:
 
 .PHONY: verify-newer
 verify-newer:
-   @echo -n "Checking that no $(VERSION) release already exists..."
+   @printf %s "Checking that no $(VERSION) release already exists..."
@wget -q --no-check-certificate -O /dev/null $(RELEASE_URL)/$(TAR_FILE) 
; \
case $$? in \
   8) echo "Good." ;; \
diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index 23c29eaa..c0accf78 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -59,7 +59,7 @@ readonly VERSION
 
 # In the rest of this file, tests collect list of errors to be fixed
 
-echo -n "Checking that git working directory is clean... "
+printf %s "Checking that git working directory is clean... "
 git_status=`git status --porcelain`
 if [ "$git_status" = '' ]
 then
@@ -77,7 +77,7 @@ verfail ()
append_emsg "  Please follow the instructions in RELEASING to choose a 
version"
 }
 
-echo -n "Checking that '$VERSION' is good with digits and periods... "
+printf %s "Checking that '$VERSION' is good with digits and periods... "
 case $VERSION in
*[!0-9.]*)
verfail "'$VERSION' contains other characters than digits and 
periods" ;;
@@ -88,7 +88,7 @@ case $VERSION in
*)  verfail "'$VERSION' is a single number" ;;
 esac
 
-echo -n "Checking that this is Debian package for notmuch... "
+printf %s "Checking that this is Debian package for notmuch... "
 read deb_notmuch deb_version rest < debian/changelog
 if [ "$deb_notmuch" = 'notmuch' ]
 then
@@ -98,7 +98,7 @@ else
append_emsg "Package name '$deb_notmuch' is not 'notmuch' in 
debian/changelog"
 fi
 
-echo -n "Checking that Debian package version is $VERSION-1... "
+printf %s "Checking that Debian package version is $VERSION-1... "
 
 if [ "$deb_version" = "($VERSION-1)" ]
 then
@@ -108,7 +108,7 @@ else
append_emsg "Version '$deb_version' is not '($VERSION-1)' in 
debian/changelog"
 fi
 
-echo -n "Checking that python bindings version is $VERSION... "
+printf %s "Checking that python bindings version is $VERSION... "
 py_version=`python3 -c "with open('$PV_FILE') as vf: exec(vf.read()); 
print(__VERSION__)"`
 if [ "$py_version" = "$VERSION" ]
 then
@@ -118,7 +118,7 @@ else
append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"
 fi
 
-echo -n "Checking that NEWS header is tidy... "
+printf %s "Checking that NEWS header is tidy... "
 if [ "`exec sed 's/./=/g; 1q' NEWS`" = "`exec sed '1d; 2q' NEWS`" ]
 then
echo Yes.
@@ -132,7 +132,7 @@ else
fi
 fi
 
-echo -n "Checking that this is Notmuch NEWS... "
+printf %s "Checking that this is Notmuch NEWS... "
 read news_notmuch news_version news_date < NEWS
 if [ "$news_notmuch" = "Notmuch" ]
 then
@@ -142,7 +142,7 @@ else
append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"
 fi
 
-echo -n "Checking that NEWS version is $VERSION... "
+printf %s "Checking that NEWS version is $VERSION... "
 if [ "$news_version" = "$VERSION" ]
 then
echo Yes.
@@ -154,7 +154,7 @@ fi
 #eval `date '+year=%Y mon=%m day=%d'`
 today0utc=`date --date=0Z +%s` # gnu date feature
 
-echo -n "Checking that NEWS date is right... "
+printf %s "Checking that NEWS date is right... "
 case $news_date in
  '('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')
newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`
@@ -176,7 +176,7 @@ case $news_date in
 esac
 
 year=`exec date +%Y`
-echo -n "Checking that copyright in documentation contains 2009-$year... "
+printf %s "Checking that copyright in documentation contains 2009-$year... "
 # Read the value of variable `copyright' defined in 'doc/conf.py'.
 copyrightline=$(grep ^copyright doc/conf.py)
 case $copyrightline in
diff --git 

[PATCH 1/5] removed use of 'echo -n' (and echo -n -e ...)

2022-02-20 Thread Tomi Ollila
In most cases used printf %s ... instead.

echo -n > file  lines to create empty / truncate files were
changed to : > file lines, like done in in test-lib-emacs.sh

And one echo -n "  " just merged to echo in previous line.
---

Most of the changes went to release-checks.sh -- the one
I've mostly written ;/

For anyone interested, dash printf "\xEF\x0D\x0A" would not work
as expected (it can only output octal escapes). Initially I had
that as printf %s $'\xEF\x0D\x0A' but it is as less portable
(and it was hard to explain in commit message).

 Makefile.local |  5 ++---
 devel/release-checks.sh| 20 ++--
 test/T090-search-output.sh |  2 +-
 test/T190-multipart.sh |  2 +-
 test/T380-atomicity.sh |  4 ++--
 5 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 10fb9908..abda9ff3 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -119,8 +119,7 @@ release-message:
@echo ""
@echo "Which can be verified with:"
@echo ""
-   @echo "  $(RELEASE_URL)/$(SHA256_FILE)"
-   @echo -n "  "
+   @echo "  $(RELEASE_URL)/$(SHA256_FILE)  "
@cat releases/$(SHA256_FILE)
@echo ""
@echo "  $(RELEASE_URL)/$(DETACHED_SIG_FILE)"
@@ -169,7 +168,7 @@ release-checks:
 
 .PHONY: verify-newer
 verify-newer:
-   @echo -n "Checking that no $(VERSION) release already exists..."
+   @printf %s "Checking that no $(VERSION) release already exists..."
@wget -q --no-check-certificate -O /dev/null $(RELEASE_URL)/$(TAR_FILE) 
; \
case $$? in \
   8) echo "Good." ;; \
diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index 23c29eaa..c0accf78 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -59,7 +59,7 @@ readonly VERSION
 
 # In the rest of this file, tests collect list of errors to be fixed
 
-echo -n "Checking that git working directory is clean... "
+printf %s "Checking that git working directory is clean... "
 git_status=`git status --porcelain`
 if [ "$git_status" = '' ]
 then
@@ -77,7 +77,7 @@ verfail ()
append_emsg "  Please follow the instructions in RELEASING to choose a 
version"
 }
 
-echo -n "Checking that '$VERSION' is good with digits and periods... "
+printf %s "Checking that '$VERSION' is good with digits and periods... "
 case $VERSION in
*[!0-9.]*)
verfail "'$VERSION' contains other characters than digits and 
periods" ;;
@@ -88,7 +88,7 @@ case $VERSION in
*)  verfail "'$VERSION' is a single number" ;;
 esac
 
-echo -n "Checking that this is Debian package for notmuch... "
+printf %s "Checking that this is Debian package for notmuch... "
 read deb_notmuch deb_version rest < debian/changelog
 if [ "$deb_notmuch" = 'notmuch' ]
 then
@@ -98,7 +98,7 @@ else
append_emsg "Package name '$deb_notmuch' is not 'notmuch' in 
debian/changelog"
 fi
 
-echo -n "Checking that Debian package version is $VERSION-1... "
+printf %s "Checking that Debian package version is $VERSION-1... "
 
 if [ "$deb_version" = "($VERSION-1)" ]
 then
@@ -108,7 +108,7 @@ else
append_emsg "Version '$deb_version' is not '($VERSION-1)' in 
debian/changelog"
 fi
 
-echo -n "Checking that python bindings version is $VERSION... "
+printf %s "Checking that python bindings version is $VERSION... "
 py_version=`python3 -c "with open('$PV_FILE') as vf: exec(vf.read()); 
print(__VERSION__)"`
 if [ "$py_version" = "$VERSION" ]
 then
@@ -118,7 +118,7 @@ else
append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"
 fi
 
-echo -n "Checking that NEWS header is tidy... "
+printf %s "Checking that NEWS header is tidy... "
 if [ "`exec sed 's/./=/g; 1q' NEWS`" = "`exec sed '1d; 2q' NEWS`" ]
 then
echo Yes.
@@ -132,7 +132,7 @@ else
fi
 fi
 
-echo -n "Checking that this is Notmuch NEWS... "
+printf %s "Checking that this is Notmuch NEWS... "
 read news_notmuch news_version news_date < NEWS
 if [ "$news_notmuch" = "Notmuch" ]
 then
@@ -142,7 +142,7 @@ else
append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"
 fi
 
-echo -n "Checking that NEWS version is $VERSION... "
+printf %s "Checking that NEWS version is $VERSION... "
 if [ "$news_version" = "$VERSION" ]
 then
echo Yes.
@@ -154,7 +154,7 @@ fi
 #eval `date '+year=%Y mon=%m day=%d'`
 today0utc=`date --date=0Z +%s` # gnu date feature
 
-echo -n "Checking that NEWS date is right... "
+printf %s "Checking that NEWS date is right... "
 case $news_date in
  '('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')
newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`
@@ -176,7 +176,7 @@ case $news_date in
 esac
 
 year=`exec date +%Y`
-echo -n "Checking that copyright in documentation contains 2009-$year... "
+printf %s "Checking that copyright in documentation contains 2009-$year... "
 # Read the value of variable `copyright' defined in 'doc/conf.py'.
 copyrightline=$(grep ^copyright 

Re: [PATCH 2/4] test: due not pass T380.1 for the wrong reasons

2022-02-19 Thread Tomi Ollila
On Sat, Feb 12 2022, David Bremner wrote:

> Michael J Gruber  writes:
>
>
>> When analysing this, I was confused by the way
>> test_require_external_prereq works and the "if" in T380 (as opposed to how
>> test_require_external_prereq is used in other tests). Over at git.git,
>> we have test setup code in functions which don't get executed if
>> prerequisites fail. I guess the "if" emulates that, but then the actual
>> tests in T380 are outside the if block and use files and variables which
>> are created in the if block. So, this is something to fix anyways.
>
> agreed.
>
>> Add to this the fact that the tests needing sfsexp or asan (and probably
>> others) do things yet differently and call "test_done" immediately, so
>> that no SKIP appears. And those were the only ones skipped at all here ...
>>
>
> I think that's probably my fault for also not really understanding the
> prereq system.
>
>
>> In the short run, initialising variables and files which are used is
>> still a good thing, but I would have to rewrite some commit messages.
>
> sure.
>
>> I'll wait until it's clear how to handle style, though: switch to printf
>> from echo whenever I touch those lines (leading to mixed use) or keeing
>> style and leaving the style change for another series.
>
> I think I lean to fixing the usage of echo -n incrementally (i.e. don't
> introduce more). It might be a bit uglier in the short term, but
> eventually we'll get there.

If there currently is zero printf's and only echo, I'd personally continue
to use echos -- but either way is ok by me

> It turns out that echo is _not_ builtin in bash, so this really is a
> portability bug.

Wat? afaik echo is builtin in every modern bourne shell derivative...

(I tested:
 $ bash -c 'builtin echo foo'
 foo
 $ bash -c 'export PATH=/tmp; echo foo; ls'
 foo
 bash: ls: command not found
)

Tomi

>
> d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 4/4] CLI/insert: escape envelope from

2022-02-19 Thread Tomi Ollila
On Sun, Feb 13 2022, David Bremner wrote:

> The idea is to do as little parsing and modification of the delivered
> message as possible. Luckily the position of the "envelope header"
> lets us escape it by replacing the first 5 characters of the stream
> with a regular header name (with ':').
> ---
>  notmuch-insert.c| 15 ++-
>  test/T070-insert.sh |  1 -
>  2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/notmuch-insert.c b/notmuch-insert.c
> index bec25a2a..d1244384 100644
> --- a/notmuch-insert.c
> +++ b/notmuch-insert.c
> @@ -267,10 +267,13 @@ static bool
>  copy_fd (int fdout, int fdin)
>  {
>  bool empty = true;
> +bool first = true;
> +const char *header="X-Envelope-From: ";

spaces

>  
>  while (! interrupted) {
>   ssize_t remain;
>   char buf[4096];
> + const char *p = buf;
>  
>   remain = read (fdin, buf, sizeof (buf));
>   if (remain == 0)
> @@ -282,7 +285,17 @@ copy_fd (int fdout, int fdin)
>strerror (errno));
>   return false;
>   }
> - if (! write_buf (buf, fdout, remain))
> +
> + if (first && remain >= 5 && 0 == strncmp (buf, "From ", 5)) {
> + if (! write_buf (header, fdout, strlen (header)))

Probably optimizing compiler can replace strlen (header) with constant
value -- it does not matter but had to mention :D

Code changes look good to me.

Tomi


> + return false;
> + p += 5;
> + remain -= 5;
> + }
> +
> + first = false;
> +
> + if (! write_buf (p, fdout, remain))
>   return false;
>   empty = false;
>  }
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index a297fa73..e1e3b151 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -293,7 +293,6 @@ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION ; do
>  done
>  
>  test_begin_subtest "insert converts mboxes on delivery"
> -test_subtest_known_broken
>  notmuch insert +unmboxed < 
> "${TEST_DIRECTORY}"/corpora/indexing/mbox-attachment.eml
>  output=$(notmuch count tag:unmboxed)
>  test_expect_equal "${output}" 1
> -- 
> 2.34.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test: allow to use --full-sync

2022-02-16 Thread Tomi Ollila
On Wed, Feb 16 2022, Tomi Ollila wrote:

>
> I'd not merge this NOTMUCH_NEW_OPTIONS=--full-scan ;D too eagerly
> ... I'd like we really knew the reason (which is then written in
> commit message)

I seem I did not get my message above (or why the ;D is there)
expressed clear enough -- the idea there was that also

NOTMUCH_NEW_OPTIONS=--full-scan make test
would have worked

(or, NOTMUCH_NEW_OPTIONS=--verbose, to get noisy output -- and lot of
failed tests ;D)

(to disable such a leakage of environment variable into test run 
NOTMUCH_NEW_OPTIONS= should have been there before checking that variable
 -- OTOH just adding NOTMUCH_NEW_OPTIONS=... as way to provide any options
to notmuch new (for users to experiment) could be an option (or
something...))

Anyway, I am not proposing adding such...now... but better concentrate 
figuring out what is happening there and why...

> Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test: allow to use --full-sync

2022-02-16 Thread Tomi Ollila
On Wed, Feb 16 2022, Michael J. Gruber wrote:

> David Bremner venit, vidit, dixit 2022-02-16 14:04:17:
>> Michael J Gruber  writes:
>> 
>> > Some build infrastructure appears to habe problems with mtime/stat,
>> 
>> have
>
> Huh, this looks as if my mother tongue slipped in, while it's just key
> proximity.
>
>> > leading to spurious failures (noticed on s390x and aarch64 with epel8).
>> > Allow the test suite to be run with --full-sync so that release builds
>> > can use the test suite while avoiding spurious failures.
>> >
>> > Signed-off-by: Michael J Gruber 
>> > ---
>> >  test/README | 8 
>> >  test/test-lib-common.sh | 7 ++-
>> >  test/test-lib.sh| 2 +-
>> >  3 files changed, 15 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/test/README b/test/README
>> > index 10f127cb..1de79b78 100644
>> > --- a/test/README
>> > +++ b/test/README
>> > @@ -110,6 +110,14 @@ printed on screen. This printing can be disabled by 
>> > setting the
>> >  NOTMUCH_TEST_QUIET variable to a non-null value. Message on test
>> >  failures and skips are still printed.
>> 
>> typo in variable name.
>
> Not here, but in fact in the actual patch ;)
>
>
>> How confident are you that this actually fixes your intermittent
>> failures?  There are quite a few literal invocations of "notmuch new" in
>> the test suite. Would those need to be changed as well?
>
> About 80% confident ... The patch covers all areas in which I've ever
> witnessed the spurious FAILs. I have not had a single failure with the
> patch. Many of the other invocations are not immediately after message
> creation.
>
> Some of them are immediately after, and - given that notmuch new catches
> the case of same time - I do not understand why this happens at all.
> That accounts for the other 20%.
>
> I don't mind carrying this locally and retrying without for the next
> round of notmuch updates. Having the patch here on-list may help
> someone else in the future in any case.

I'd not merge this NOTMUCH_NEW_OPTIONS=--full-scan ;D too eagerly
... I'd like we really knew the reason (which is then written in
commit message)

>
> Michael

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: escape quote in notmuch-search-result-format docstring

2022-02-16 Thread Tomi Ollila
On Wed, Feb 16 2022, David Bremner wrote:

LGTM, now I remeber this syntax...

Tomi

> Prevent Emacs' mangling of quotes, which breaks the code sample.
> ---
>  emacs/notmuch.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 6abb17ff..c9cf80dc 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -93,7 +93,7 @@
>  Supported fields are: date, count, authors, subject, tags.
>  For example:
>  (setq notmuch-search-result-format
> -  '((\"authors\" . \"%-40s\")
> +  \\='((\"authors\" . \"%-40s\")
>  (\"subject\" . \"%s\")))
>  
>  Line breaks are permitted in format strings (though this is
> -- 
> 2.34.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [BUG] Bad quote in help

2022-02-16 Thread Tomi Ollila
On Wed, Feb 16 2022, Rudolf Adamkovič wrote:

> Repro steps:
>
> 1. C-h v
> 2. notmuch-search-result-format
> 3. RET
>
> See:
>
> For example:
> (setq notmuch-search-result-format
>   ’(("authors" . "%-40s")
> ("subject" . "%s")))
>
> The quote ’ needs changed to ', otherwise the example does not work.

The code in question in notmuch.el is:

(setq notmuch-search-result-format
  '((\"authors\" . \"%-40s\")
(\"subject\" . \"%s\")))

In this particular case it is unfortunate emacs modifies the output.

Tried to chage that to  \'((\"autho...

did not help (also renamed the defcustom to make a new definition so
that the content would be evaluated when doing c-x c-e in buffer...)

In rstdoc.el we have (text-quoting-style 'grave) to not do such docstring
modifications for display, but that is not applicable in this context...

Tomi

>
> Rudy
> -- 
> "Thinking is a momentary dismissal of irrelevancies."
> -- Richard Buckminster Fuller, 1969
>
> Rudolf Adamkovič  [he/him]
> Studenohorská 25
> 84103 Bratislava
> Slovakia
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Test suite timing issues?

2022-02-14 Thread Tomi Ollila
On Mon, Feb 14 2022, David Bremner wrote:

> Tomi Ollila  writes:
>
>>
>> Looked notmuch-new.c -- time_t (seconds since epoch) is used as timestamp
>> comparisons (which would indicate the subsecond resolution most fs' provide
>> is not used)...
>>
>> ... and if so, I wonder why some of our tests are not failing all the time
>> for everyone...?
>
> Not claiming everything is fine, but there is code there targetted at
> the failure mode you mentioned:
>
> /* If the directory's mtime is the same as the wall-clock time
>  * when we stat'ed the directory, we skip updating the mtime in
>  * the database because a message could be delivered later in this
>  * same second.  This may lead to unnecessary re-scans, but it
>  * avoids overlooking messages. */
> if (fs_mtime != stat_time)
>   _filename_list_add (state->directory_mtimes, path)->mtime = fs_mtime;

This sure had to be tested... :D

so I outcommented the line as // if (fs_mtime != stat_time)

and then build and run test -- a lot of failures...

also

./test/T750-gzip.sh 2>&1 | grep -e PASS -e FAIL

 PASS   Single new gzipped message
 PASS   Single new gzipped message (full-scan)
 FAIL   Multiple new messages, one gzipped
 FAIL   Multiple new messages, one gzipped (full-scan)
 FAIL   Renamed (gzipped) message
 PASS   notmuch search with partially gzipped mail store
 FAIL   notmuch search --output=files with partially gzipped mail store
 PASS   show un-gzipped message
 PASS   show un-gzipped message (format mbox)
 PASS   show un-gzipped message (format raw)
 FAIL   show gzipped message
 FAIL   show gzipped message (mbox)
 FAIL   show gzipped message (raw)
 PASS   new doesn't run out of file descriptors with many gzipped files

(above was "lucky" run, usually that 6th test, ...partially gzipped...
 test also FAILed (I'd guess second happened to change there)).

then restored the fs_mtime != stat_time line -- then all of 750 passed.

(finally, run that 750-gzip in a loop (dropped last, slow test), hundreds
 of times already -- no FAILures... (ecryptfs on ext4))

Tomi

> BTW, I have so far run the test suite 68 times in a row without failures
> on a Debian s390x host. The file system is ext4, mounted relatime. It
> would be interesting to know what file system is yielding the failures
> Michael is seeing.

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Test suite timing issues?

2022-02-14 Thread Tomi Ollila
On Mon, Feb 14 2022, David Bremner wrote:

> Tomi Ollila  writes:
>
>>
>> Looked notmuch-new.c -- time_t (seconds since epoch) is used as timestamp
>> comparisons (which would indicate the subsecond resolution most fs' provide
>> is not used)...
>>
>> ... and if so, I wonder why some of our tests are not failing all the time
>> for everyone...?
>
> Not claiming everything is fine, but there is code there targetted at
> the failure mode you mentioned:
>
> /* If the directory's mtime is the same as the wall-clock time
>  * when we stat'ed the directory, we skip updating the mtime in
>  * the database because a message could be delivered later in this
>  * same second.  This may lead to unnecessary re-scans, but it
>  * avoids overlooking messages. */
> if (fs_mtime != stat_time)
>   _filename_list_add (state->directory_mtimes, path)->mtime =
> fs_mtime;

Right. Very much explains why we don't see test failures...

> BTW, I have so far run the test suite 68 times in a row without failures
> on a Debian s390x host. The file system is ext4, mounted relatime. It
> would be interesting to know what file system is yielding the failures
> Michael is seeing.

indeed.

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] nmbug: write tags out to a temporary file, not 'nmbug.index'

2022-02-13 Thread Tomi Ollila
On Sun, Feb 13 2022, Sean Whitton wrote:

> Hello,
>
> On Sun 13 Feb 2022 at 09:54am -07, Sean Whitton wrote:
>
>> If more than nmbug process is running at once, then each will try to
>> read and write the same file.  The particular failure I've seen is
>> that the process which finishes first deletes nmbug.index, and then
>> the other process dies with a FileNotFoundError.  So use a distinct
>> temporary file per process.
>> ---
>>  devel/nmbug/nmbug | 44 ++--
>>  1 file changed, 22 insertions(+), 22 deletions(-)
>>
>> Here is a second attempt, though I'm afraid I have little idea whether it is
>> idiomatic Python.
>
> It would seem this causes 'nmbug status' to output just one result.
>
> I'll leave the fix to someone with more Python experience.  Sorry for
> the improperly tested v2 patch.

One option would be using the first patch, but instead of mkstemp(),
NamedTemporaryFile(dir=NMBGIT, prefix="nmbug.index") to be used instead
(and then path.name and index.name in place of path and index...)

Tomi

>
> -- 
> Sean Whitton
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Test suite timing issues?

2022-02-13 Thread Tomi Ollila
On Sun, Feb 13 2022, Tomi Ollila wrote:

> On Sat, Feb 12 2022, David Bremner wrote:
>
>> Tomi Ollila  writes:
>>
>>>
>>> Does such a change hide "buggy" functionality ?
>>
>> We mostly don't use add_message, call notmuch new via NOTMUCH_NEW in
>> T050-new.sh. So I think it would mostly not hide bugs in notmuch
>> new. OTOH, I'm surprised the same issues with timestamps don't show up
>> there, if that is really the problem.
>>
>>> Or do we consider notmuch new buggy if it does not notice all new messages
>>> arrived every time ?
>>
>> That's a harder question. Maybe? But I don't know how serious a bug it
>> is for actual users (who often get mail delivered in various concurrent
>> ways).
>
> The bug could be that the filesystem mtime resolution is 1 sec (hmm what
> is the resolution in database?), and 2 emails are delivered to one
> directory during one second -- and at the same time notmuch new is scanning
> emails and found only one of those. then no more emails are delivered to
> that one directory for a while -- so notmuch new does not find those.
>
> (now that I think of it that could happen to me :O -- just very improbable
> (or not, `stat .` outputs Modify: 2022-02-12 22:47:19.550838056 +0200) --
> have to check that timestamp resolution in database).

Looked notmuch-new.c -- time_t (seconds since epoch) is used as timestamp
comparisons (which would indicate the subsecond resolution most fs' provide
is not used)...

... and if so, I wonder why some of our tests are not failing all the time
for everyone...?

Tomi






>
> Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] nmbug: write tags out to a temporary file, not 'nmbug.index'

2022-02-13 Thread Tomi Ollila
On Sun, Feb 13 2022, Sean Whitton wrote:

> If more than nmbug process is running at once, then each will try to
> read and write the same file.  The particular failure I've seen is
> that the process which finishes first deletes nmbug.index, and then
> the other process dies with a FileNotFoundError.  So use a distinct
> temporary file per process.
> ---
>  devel/nmbug/nmbug | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
> index 043c1863..3c069701 100755
> --- a/devel/nmbug/nmbug
> +++ b/devel/nmbug/nmbug
> @@ -603,8 +603,8 @@ def get_status():
>  
>  
>  def _index_tags():
> -"Write notmuch tags to the nmbug.index."
> -path = _os.path.join(NMBGIT, 'nmbug.index')
> +"Write notmuch tags to a temporary index."
> +(_ , path) = _tempfile.mkstemp()
>  query = ' '.join('tag:"{tag}"'.format(tag=tag) for tag in get_tags())
>  prefix = '+{0}'.format(_ENCODED_TAG_PREFIX)
>  _git(

Looks like a good idea. Looked a bit when the index file is removed; it
is but intermediate error could leave stray index file(s) around. The
current version in git always uses the same file, but now with this
temporary files some of those could be left hanging around...

Tomi

> -- 
> 2.30.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Test suite timing issues?

2022-02-12 Thread Tomi Ollila
On Sat, Feb 12 2022, David Bremner wrote:

> Tomi Ollila  writes:
>
>>
>> Does such a change hide "buggy" functionality ?
>
> We mostly don't use add_message, call notmuch new via NOTMUCH_NEW in
> T050-new.sh. So I think it would mostly not hide bugs in notmuch
> new. OTOH, I'm surprised the same issues with timestamps don't show up
> there, if that is really the problem.
>
>> Or do we consider notmuch new buggy if it does not notice all new messages
>> arrived every time ?
>
> That's a harder question. Maybe? But I don't know how serious a bug it
> is for actual users (who often get mail delivered in various concurrent
> ways).

The bug could be that the filesystem mtime resolution is 1 sec (hmm what
is the resolution in database?), and 2 emails are delivered to one
directory during one second -- and at the same time notmuch new is scanning
emails and found only one of those. then no more emails are delivered to
that one directory for a while -- so notmuch new does not find those.

(now that I think of it that could happen to me :O -- just very improbable
(or not, `stat .` outputs Modify: 2022-02-12 22:47:19.550838056 +0200) --
have to check that timestamp resolution in database).

Tomi


___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [Utkarsh Singh] Re: [PATCH] emacs: Add more front ends for address completion

2022-02-12 Thread Tomi Ollila
On Fri, Feb 11 2022, Utkarsh Singh wrote:

> On 2022-02-10, 19:37 +0200, Tomi Ollila  wrote:
>
>>
>> When doing in notmuch repo, one can execute ./devel/try-emacs-mua -Q
>>
>> ... which probably uses the same package database (under $HOME) as any
>> other emacs invocation would do -- what is the way to change the location
>> of that in order to have chance to have "empty" set of externally installed
>> packages, and messing with it would not touch the "default" packages... 
>
> Okay, we can use `package-user-dir', try the following steps:
>
> 1. Press M-w (`kill-ring-save') to kill/cut the following expression:
>
> --8<---cut here---start->8---
> (progn
>   (setq package-user-dir "/tmp/elpa")
>   (package-initialize)
>   (package-install 'corfu)
>   (package-install 'vertico)
>
>   (require 'notmuch)
>   (require 'corfu)
>   (require 'vertico)
>
>   (vertico-mode 1)
>   (corfu-global-mode 1)
>   (notmuch-mua-new-mail))
> --8<---cut here---end--->8---
>
> 2. Now in ./devel/try-emacs-mua -Q, press M-: (`eval-expression'), C-y
> (`yank') and finally RET.
>
> 3. Press TAB to generate address completion, then press RET to select a
> address, for eg. "Notmuch mailing list ".
> After selection, you will notice that `notmuch-address-expand-name'
> insert desired address with trailing whitespaces.

Yes, I see trailing whitespace.
Also, completion matches only from beginning of the address string.
Also, after one completion TAB no longer completes...

Tomi


>
> --8<---cut here---start->8---
> To: Notmuch mailing list   
> --8<---cut here---end--->8---
>
> I apologize as results are not as reproducible as I thought, but you can
> still notice that `notmuch-address-expand-name' is not producing the
> desired result.
>
> -- 
> Utkarsh Singh
> https://utkarshsingh.xyz/
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Test suite timing issues?

2022-02-12 Thread Tomi Ollila
On Sat, Feb 12 2022, David Bremner wrote:

> Tomi Ollila  writes:
>
>> On Sat, Feb 12 2022, Michael J. Gruber wrote:
>>
>> Only thing that came into mind are directory timestamps... if directory
>> (m)time is same as before notmuch will not scan it for files...
>>
>> ... following that if the granularity of directory timestamp were 1 second,
>> then it could easily happen than first one new message is not seen, and
>> next time there is one extra message to be see...
>
> What do you think about adding --full-scan to the notmuch-new invocation
> in add_message? It doesn't make any tests fail and is about the same
> speed. I need to do a few more trials, but first time through it was
> actually faster (!), maybe because the cache is hot

Does such a change hide "buggy" functionality ?

Or do we consider notmuch new buggy if it does not notice all new messages
arrived every time ?

Tomi

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Test suite timing issues?

2022-02-12 Thread Tomi Ollila
On Sat, Feb 12 2022, Michael J. Gruber wrote:

> David Bremner venit, vidit, dixit 2022-02-12 01:03:00:
>> Michael J Gruber  writes:
>> 
>> > Hi there,
>> >
>> > I'm trying to package notmuch for Redhat's enterprise linux and clones
>> > (EPEL, extra packages for enterprise linux). 
>> >
>> > This looks mostly fine, including the tests, except for intermittent
>> > failures on epel-8-s390x. They look like the below, or in tests
>> > following those, and apparantly all have to do with "db not synced yet"
>> > or such, so that a message one subtest creates only shows up in the db
>> > for the next subtest.
>> >
>> > I've also had completely fine test runs on epel-8-s390x, but I'm
>> > starting to wonder whether I've just been lucky so far on other
>> > platforms ... Could it be possible that generate_message(), even though
>> > adding the message, still returns false and therefore add_message() does
>> > not call "notmuch new"? One might want to drop the "&&" there in
>> > test-lib-common, I dunno. This shouldn't be "intermittent".
>> 
>> It's hard to see what can go wrong (maybe perl doesn't work?), but
>> failing to generate a message should be a fatal error. Maybe try
>> something like
>> 
>
> Well, as you can see in both reports, the pattern is as follows:
>
> The first subttest sees 1 less message than expected.
> The second sees 1 more message than expected.

Only thing that came into mind are directory timestamps... if directory
(m)time is same as before notmuch will not scan it for files...

... following that if the granularity of directory timestamp were 1 second,
then it could easily happen than first one new message is not seen, and
next time there is one extra message to be see...

Just wild guesses...

Tomi


>
> So in summary, they are generated but "notmuch new" is not run or does
> not pick them up. Though it's a Heisenbug on a specific arch, I'll try
> your suggestion and hammer our infra with it ...
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Python binding SIGABRT/SIGSEGV

2022-02-11 Thread Tomi Ollila
On Fri, Feb 11 2022, Michael J. Gruber wrote:

> Austin Lund venit, vidit, dixit 2022-02-10 23:21:58:
>> On Thu, Feb 10, 2022 at 01:12:47PM +0100, Michael J Gruber wrote:
>> > Austin Lund venit, vidit, dixit 2022-02-10 06:56:12:
>> > > I'm clearly doing this python code wrong by not using the iterator 
>> > > correctly:
>> > > 
>> > > > import notmuch2
>> > > > 
>> > > > d = notmuch2.Database()
>> > > > m = list(d.messages("since:today"))
>> > > > p = m[0].path
>> > > > print(p)
>> > > 
>> > > But I seem to be getting a SIGABRT instead of a python stack trace.  Is
>> > > this the expected behaviour?
>> > 
>> > You didn't expect it :)
>> > 
>> > And this can be confusing. d.messages() returns an iterator through
>> > Message objects whose lifetime depends on the iterator. In contrast,
>> > thread.get_messages() returns on iterator through OwnedMessage objects
>> > whose lifetime depends on the thread.
>> 
>> I guess I didn't say it explicitly, but I would 'expect' the python
>> interpreter to raise an exception rather than having an unhandled
>> exception terminate the program.  Perhaps raising a MemoryError or
>> ReferenceError or some other exception would be better than an unhandled
>> SIGABRT.
>> 
>
> In fact you did. Sorry for overlooking this. (I still find db.messages()
> vs thread.get_messages() confusing.)
>
> The way memory handling works, one could even expect a more specific
> notmuch2.ObjectDestroyedError.
>
> As for the SIGABRT: I guess this is what "python -X faulthandler" is
> for, especially in the context of C extension modules:
>
> LANG=C python -X faulthandler t.py
> Fatal Python error: Aborted
>
> Current thread 0x7f5bf667e740 (most recent call first):
>   File "/usr/lib64/python3.10/site-packages/notmuch2/_message.py", line
> 131 in path
>   File "/tmp/t.py", line 5 in 
>
> Extension modules: _cffi_backend (total: 1)
> Abgebrochen (Speicherabzug geschrieben)
>
> (Yes, it disrespects LANG)

You'd probably need LC_ALL=C for "overwriting" whatever in other LC_*
variables has been set. IIRC LANG just set default in case particular
LC_* is not set

Unfortunately this does not help solving SIGABRT case...

Tomi

>
> Line 131 is
>
> ret = capi.lib.notmuch_message_get_filename(self._msg_p)
>
> in the path method, and since _msg_p is a base.MemoryPointer() I would
> have hoped (now) to get a notmuch2.ObjectDestroyedError. Maybe _msg_p is
> destroyed but the Message object is not? Fishing in the dark here ...
>
> Michael
>
> P.S.: Sorry for the repeated message. I had problems with list bounces
> in the past, then remembered the original alias wrong, then replied to
> the reply to the wrong (only off-list-delivered) post. g...@grubix.eu is
> the one subscribed to the list. I'll remember now.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [Utkarsh Singh] Re: [PATCH] emacs: Add more front ends for address completion

2022-02-10 Thread Tomi Ollila
On Thu, Feb 10 2022, Utkarsh Singh wrote:

>  Start of forwarded message 
> From: Utkarsh Singh 
> To: Tomi Ollila 
> Subject: Re: [PATCH] emacs: Add more front ends for address completion
> Date: Thu, 10 Feb 2022 08:58:49 +0530
>
> Hello Tomi,
>
> On 2022-02-09, 23:59 +0200, Tomi Ollila  wrote:
>
>> On Tue, Feb 08 2022, Utkarsh Singh wrote:
>>
>>> Hello maintainers,
>>>
>>> Emacs Lisp Package Archive (ELPA) now includes a package called 'corfu',
>>> according to its documentation:
>>>
>>> Corfu enhances the default completion in region function with a
>>> completion overlay. The current candidates are shown in a popup
>>> below or above the point.  Corfu is the minimalistic
>>> ~completion-in-region~ counterpart of the
>>> [[https://github.com/minad/vertico][Vertico]] minibuffer UI.
>>>
>>> Hence, this patch tries to add support for `completion-in-region' in
>>> `notmuch-address-expand-name'.  By default, this behaviour is turned off
>>> so that existing users can enjoy existing completion techniques.
>>
>> The current "default" (i.e. w/o any notmuch emacs mua configuration) is to
>> use completing-read to do the completion. If "company" is available, then
>> company is used by default (w/ all address harvesting and so on...). 
>>
>> This is "messy" enough ;( (i.e the notmuch-address-selection-function
>> is called if company mode is not available or notmuch-address-command
>> is a string instead of 'internal or 'as-is (or whatnot, too tired to do
>> deep investigation there ;/)
>>
>> This change, contributes even more "complexity" there. To keep the
>> complexity to the same level would be adding more
>> notmuch-address-selection-functions and have the defcustom there list
>> the options (also probably the name of notmuch-address-selection-function
>> would need to be changed to notmuch-fallback-address-selection-function
>> ;/)
>>
>
> I think, in general, you're right about the complexity and we should try
> minimize it. But this patch was originally derived from a bug I was
> experiencing with `(global-corfu-mode 1)' in `notmuch-message-mode'.

Is global-corfu-mode changing how completing-read works ?

> Here are the steps to reproduce the bug:
>
> 1. [Install](https://notmuchmail.org/#index7h2) `notmuch`.
> 2. In emacs -Q session, evaluate the following

When doing in notmuch repo, one can execute ./devel/try-emacs-mua -Q

... which probably uses the same package database (under $HOME) as any
other emacs invocation would do -- what is the way to change the location
of that in order to have chance to have "empty" set of externally installed
packages, and messing with it would not touch the "default" packages... 

(so that I can try the steps below)

Tomi

>
> ```elisp
> (progn
> (add-to-list 'load-path "/usr/share/emacs/site-lisp") ; Notmuch Emacs 
> interface
> (package-initialize)
> (package-install 'corfu)
> (package-install 'vertico)
>
> (require 'notmuch)
> (require 'corfu)
> (require 'vertico)
>
> (vertico-mode 1)
> (corfu-global-mode 1)
> (notmuch-mua-new-mail))
> ```
>
> 3. Press `TAB` to generate address completion, then press `RET` to
> select address of your choice.  After selection, you will notice that
> `notmuch-address-expand-name` fails to insert desired address, that is,
> you will get the following:
>
> ```
> To:
> ```
>
> Note: Check the trailing spaces.
>
>> All this said, I think this is not simple to solve, as this otherwise fine
>> change would indicate :/
>
> No problem, I'm willing to help the maintainers on this matter.
>
> -- 
> Utkarsh Singh
> https://utkarshsingh.xyz/
>  End of forwarded message 
>
> -- 
> Utkarsh Singh
> https://utkarshsingh.xyz/
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 4/4] test: set up the outcount file for T380.1

2022-02-10 Thread Tomi Ollila
On Thu, Feb 10 2022, Michael J. Gruber wrote:

> Tomi Ollila venit, vidit, dixit 2022-02-09 21:50:35:
>> On Wed, Feb 09 2022, Michael J. Gruber wrote:
>> 
>> > If gdb is present but for some reason `atomicity.py` fails to write to
>> > the output file then the test fails with some ugly bash errors in the
>> > wrong places (because the outcount variable is empty).
>> >
>> > Therefore, set up the outcount file with `0` to get the test script to
>> > rund and the test to fail fpr a clearer reason.
>> >
>> > Background: We noticed this with arch armhfp emulated on x86_64 in
>> > Fedora's COPR test build environment.
>> >
>> > Signed-off-by: Michael J Gruber 
>> > ---
>> >  test/T380-atomicity.sh | 1 +
>> >  1 file changed, 1 insertion(+)
>> >
>> > diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
>> > index 49df5c38..caac28a3 100755
>> > --- a/test/T380-atomicity.sh
>> > +++ b/test/T380-atomicity.sh
>> > @@ -64,6 +64,7 @@ if test_require_external_prereq gdb; then
>> >  # -tty /dev/null works around a conflict between the 'timeout' wrapper
>> >  # and gdb's attempt to control the TTY.
>> >  export MAIL_DIR
>> > +echo -n 0 > outcount
>> 
>> printf 0 > outcount (is my suggestion)
>
> Would by mine, too :)
> Again, this is not the style of T380 which uses echo exclusively so far.

Right, I did not see the surrouding code in this series :D

(the only thing I saw use of $(expr ...) -- which I put to my notes of
trivial fixes one could do in (distant?) future)

Perhaps the series is good then (and perhaps incremental changing of
expected - actual order is better than newer changing any of those)

Tomi

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: Add more front ends for address completion

2022-02-09 Thread Tomi Ollila
On Tue, Feb 08 2022, Utkarsh Singh wrote:

> Hello maintainers,
>
> Emacs Lisp Package Archive (ELPA) now includes a package called 'corfu',
> according to its documentation:
>
> Corfu enhances the default completion in region function with a
> completion overlay. The current candidates are shown in a popup
> below or above the point.  Corfu is the minimalistic
> ~completion-in-region~ counterpart of the
> [[https://github.com/minad/vertico][Vertico]] minibuffer UI.
>
> Hence, this patch tries to add support for `completion-in-region' in
> `notmuch-address-expand-name'.  By default, this behaviour is turned off
> so that existing users can enjoy existing completion techniques.

The current "default" (i.e. w/o any notmuch emacs mua configuration) is to
use completing-read to do the completion. If "company" is available, then
company is used by default (w/ all address harvesting and so on...). 

This is "messy" enough ;( (i.e the notmuch-address-selection-function
is called if company mode is not available or notmuch-address-command
is a string instead of 'internal or 'as-is (or whatnot, too tired to do
deep investigation there ;/)

This change, contributes even more "complexity" there. To keep the
complexity to the same level would be adding more
notmuch-address-selection-functions and have the defcustom there list
the options (also probably the name of notmuch-address-selection-function
would need to be changed to notmuch-fallback-address-selection-function
;/)

Also, if name was notmuch-address-selection-function but its interface
changed, current users using their own functions (I am in that list)
would get error there (the interface would have to be
(defun notmuch-address-selection-function (prompt collection initial-input 
 beg end)
to be backward compatible)
If name was changed then their own function would not be used -- which is 
OK, things change and users can read from NEWS how to be compatible
again...

All this said, I think this is not simple to solve, as this otherwise fine
change would indicate :/

Tomi

>
> Thank you,
> Utkarsh Singh
> -- 
> Utkarsh Singh
> https://utkarshsingh.xyz/
> From fdc88b81fef763f7d7dcdc899aa8e90482c574fa Mon Sep 17 00:00:00 2001
> From: Utkarsh Singh 
> Date: Tue, 8 Feb 2022 19:17:26 +0530
> Subject: [PATCH] emacs: Add more front ends for address completion
>
> Add support for address completion through completion-in-region.
> * notmuch-address.el (notmuch-address-use-completion-in-region):
> Introduce customizable variable to activate the new front end.
> (notmuch-address-selection-function, notmuch-address-expand-name): Use
> it.
> ---
>  emacs/notmuch-address.el | 28 ++--
>  1 file changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 1a4cdda2..cfb56a3a 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -123,10 +123,10 @@ you should make sure it is not somewhere publicly 
> readable."
>  (defcustom notmuch-address-selection-function 
> 'notmuch-address-selection-function
>"The function to select address from given list.
>  
> -The function is called with PROMPT, COLLECTION, and INITIAL-INPUT
> -as arguments (subset of what `completing-read' can be called
> -with).  While executed the value of `completion-ignore-case'
> -is t.  See documentation of function
> +The function is called with PROMPT, COLLECTION, INITIAL-INPUT,
> +BEG and END as arguments (subset of what `completing-read' can be
> +called with).  While executed the value of
> +`completion-ignore-case' is t.  See documentation of function
>  `notmuch-address-selection-function' to know how address
>  selection is made by default."
>:type 'function
> @@ -150,13 +150,19 @@ matching `notmuch-address-completion-headers-regexp'."
>:group 'notmuch-send
>:group 'notmuch-address)
>  
> +(defcustom notmuch-address-use-completion-in-region nil
> +  "Use `completion-in-region' for address completion."
> +  :type 'boolean
> +  :group 'notmuch-send
> +  :group 'notmuch-address)
> +
>  ;;; Setup
>  
> -(defun notmuch-address-selection-function (prompt collection initial-input)
> -  "Call (`completing-read'
> -  PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"
> -  (completing-read
> -   prompt collection nil nil initial-input 'notmuch-address-history))
> +(defun notmuch-address-selection-function (prompt collection initial-input 
> beg end)
> +  (if notmuch-address-use-completion-in-region
> +  (completion-in-region beg end collection)
> +(completing-read
> + prompt collection nil nil initial-input 'notmuch-address-history)))
>  
>  (defvar notmuch-address-completion-headers-regexp
>
> "^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):")
> @@ -245,7 +251,9 @@ requiring external commands."
>(funcall notmuch-address-selection-function
>  

Re: [PATCH 4/4] test: set up the outcount file for T380.1

2022-02-09 Thread Tomi Ollila
On Wed, Feb 09 2022, Michael J. Gruber wrote:

> If gdb is present but for some reason `atomicity.py` fails to write to
> the output file then the test fails with some ugly bash errors in the
> wrong places (because the outcount variable is empty).
>
> Therefore, set up the outcount file with `0` to get the test script to
> rund and the test to fail fpr a clearer reason.
>
> Background: We noticed this with arch armhfp emulated on x86_64 in
> Fedora's COPR test build environment.
>
> Signed-off-by: Michael J Gruber 
> ---
>  test/T380-atomicity.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
> index 49df5c38..caac28a3 100755
> --- a/test/T380-atomicity.sh
> +++ b/test/T380-atomicity.sh
> @@ -64,6 +64,7 @@ if test_require_external_prereq gdb; then
>  # -tty /dev/null works around a conflict between the 'timeout' wrapper
>  # and gdb's attempt to control the TTY.
>  export MAIL_DIR
> +echo -n 0 > outcount

printf 0 > outcount (is my suggestion)

>  ${TEST_GDB} -tty /dev/null -batch -x $NOTMUCH_SRCDIR/test/atomicity.py 
> notmuch 1>gdb.out 2>&1
>  
>  # Get the final, golden output
> -- 
> 2.35.1.306.ga00bde9711
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 3/4] test: reword T380.2 to be clearer

2022-02-09 Thread Tomi Ollila
On Wed, Feb 09 2022, Michael J. Gruber wrote:

> T380.2 gives a test description which depends on the actual test output,
> rather than the expected outcome or actual test which is performed.
>
> So, when the test fails due missing abort points, the test describes
> itself as `detected 0>10 abort points` so that it's not clear which part
> or which number is the expectation. (Also, `0>10` is no number ...)
>
> When the test is not run for some reason and fails because of that, the
> test describes itself as `detected >10 abort points`, which arguably is
> better or worse.
>
> Reword it to say `detected more than 10 abort points`, which is the
> actual expectation and what we test for. The failing test line still
> gives the actual number.
>
> Signed-off-by: Michael J Gruber 
> ---
>  test/T380-atomicity.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
> index 7f618062..49df5c38 100755
> --- a/test/T380-atomicity.sh
> +++ b/test/T380-atomicity.sh
> @@ -99,7 +99,7 @@ fi
>  test_begin_subtest '"notmuch new" is idempotent under arbitrary aborts'
>  test_expect_equal_file expectall searchall
>  
> -test_begin_subtest "detected $outcount>10 abort points"
> +test_begin_subtest "detected more than 10 abort points"

probably ok (I trust the commit msg is right :D)

>  test_expect_success "test $outcount -gt 10"
>  
>  test_done
> -- 
> 2.35.1.306.ga00bde9711
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/4] test: due not pass T380.1 for the wrong reasons

2022-02-09 Thread Tomi Ollila
On Wed, Feb 09 2022, Michael J. Gruber wrote:

> If gdb is missing then some files are never written to so that the
> comparisons of non-existing files succeeds for the wrong reason,
> claiming that `notmch new` is idempotent when it was in fact never run.
>
> Catch this and (for lack of a better spot) set up the files with a
> reason for the FAIL.
>
> Signed-off-by: Michael J Gruber 
> ---
>  test/T380-atomicity.sh | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
> index a6f1e037..7f618062 100755
> --- a/test/T380-atomicity.sh
> +++ b/test/T380-atomicity.sh
> @@ -90,6 +90,10 @@ if test_require_external_prereq gdb; then
>   i=$(expr $end - 1)
>   fi
>  done
> +else
> +echo -n "Test fails due to missing gdb." > searchall
> +echo -n > expectall

I am not much of a fan of 'echo -n' (I remember seeing -n (and newline
echoed...), therefore first to use printf and second : > expectall
(unless printf '' > expectall)

> +outcount=0
>  fi
>  
>  test_begin_subtest '"notmuch new" is idempotent under arbitrary aborts'
> -- 
> 2.35.1.306.ga00bde9711
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/4] test: correct comparison order in T380

2022-02-09 Thread Tomi Ollila
On Wed, Feb 09 2022, Michael J. Gruber wrote:

> Specifying test comparisons as "expected actual" gives a better readable
> diff since the "-" indicates missing, "+" additional items compared to
> the expectations.
>
> Signed-off-by: Michael J Gruber 
> ---
>  test/T380-atomicity.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
> index afe49d93..a6f1e037 100755
> --- a/test/T380-atomicity.sh
> +++ b/test/T380-atomicity.sh
> @@ -93,7 +93,7 @@ if test_require_external_prereq gdb; then
>  fi
>  
>  test_begin_subtest '"notmuch new" is idempotent under arbitrary aborts'
> -test_expect_equal_file searchall expectall
> +test_expect_equal_file expectall searchall

Good in princible, but if things are like decade ago, we still have
hundreds of these in wrong order -- if so, all should be changed for
consistency. If I am wrong and all / many of those are already changed,
then this is OK.

>  
>  test_begin_subtest "detected $outcount>10 abort points"
>  test_expect_success "test $outcount -gt 10"
> -- 
> 2.35.1.306.ga00bde9711
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] NEWS: emacs/notmuch-logo.svg is there in 0.35

2022-01-31 Thread Tomi Ollila
---
 NEWS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NEWS b/NEWS
index bc2a80de..d03d0a33 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,9 @@ Use `--excludes=false` when generating the 'All tags' section.
 Use cached copy of message body for `Fcc`, avoiding variant bodies for
 signed and/or encrypted messages.
 
+Add notmuch-logo.svg and use it in notmuch-hello view, replacing
+the .png version.
+
 Build
 -
 
-- 
2.34.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] NEWS: my changes for 0.35

2022-01-31 Thread Tomi Ollila
On Sun, Jan 30 2022, David Bremner wrote:

I don't know about content, but style looks good ;D

Pushing now would help when forthcoming NEWS changes pour in...

Tomi

> ---
>  NEWS | 68 
>  1 file changed, 68 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 84567592..bc2a80de 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,6 +1,74 @@
>  Notmuch 0.35 (UNRELEASED)
>  =
>  
> +Library
> +---
> +
> +Implement the `date` and `lastmod` fields in the S-expression parser.
> +
> +Ignore trailing `/` for pathnames in both query parsers.
> +
> +Rename configuration option `built_with.sexpr_query` to
> +`built_with.sexp_queries`.
> +
> +Do not assume a default mail root in split (e.g. XDG) configurations.
> +
> +Fix some small memory leaks in `notmuch_database_open_with_config`.
> +
> +CLI
> +---
> +
> +Improve handling of leading/trailing punctation and space for
> +configuration lists.
> +
> +Only ignore `.notmuch` at the top level in `notmuch new`.
> +
> +Optionally show extra headers in `notmuch show`. See
> +`show.extra_headers` in notmuch-config(1).
> +
> +Emacs
> +-
> +
> +Drop `C-TAB` binding in hello mode, document `backtab`.
> +
> +Fix visual glitch in search mode by running `notmuch-search-hook`
> +lazily.
> +
> +Don't add space to completion candidates, improves compatibility with
> +third party completion frameworks.
> +
> +Make citation formating more robust against whitespace.
> +
> +Use `--excludes=false` when generating the 'All tags' section.
> +
> +Use cached copy of message body for `Fcc`, avoiding variant bodies for
> +signed and/or encrypted messages.
> +
> +Build
> +-
> +
> +Fix out-of-tree build for `python-cffi` bindings.
> +
> +Rearrange position of {C,CXX,CPP,LD}FLAGS, prevent some clashes with
> +installed version of notmuch.
> +
> +Test Suite
> +--
> +
> +Replace some uses of `gdb` in the test suite with `LD_PRELOAD` based
> +shims.
> +
> +Use `--with-colons` for gpgsm, fix compatibility with newer gnupg.
> +
> +Python bindings
> +---
> +
> +Add `matched` property to message objects.
> +
> +Users are reminded that the old python bindings in bindings/python are
> +deprecated; this will probably be the last major release that ships
> +them.
> +
>  Notmuch 0.34.3 (2022-01-09)
>  ===
>  
> -- 
> 2.34.1
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/4] test: define test_expect_equal_message_body

2022-01-20 Thread Tomi Ollila
On Thu, Jan 20 2022, David Bremner wrote:

> This is a relatively simple sed invocation, but rather than write a
> comment everywhere, give it a descriptive name.
> ---
>  test/test-lib.sh | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index f1275b85..661c0dd5 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -432,6 +432,20 @@ test_expect_equal_file () {
>  test_diff_file_ "$1" "$2"
>  }
>  
> +# Like test_expect_equal_file, but compare the part of the two files after 
> the first blank line
> +test_expect_equal_message_body () {
> +exec 1>&6 2>&7   # Restore stdout and stderr
> +if [ -z "$inside_subtest" ]; then
> + error "bug in the test script: test_expect_equal_file without 
> test_begin_subtest"
> +fi
> +test "$#" = 2 ||
> + error "bug in the test script: not 2 parameters to 
> test_expect_equal_file"
> +
> +expected=$(sed -n '/^$/,$p' $1)
> +output=$(sed -n '/^$/,$p' $2)

The above works, as we don't have whitespace ($IFS characters to be
precise) in the filenames. However, for better example, "$1" and "$2"
should be used (as is used in many of the functions in test-lib.sh
already. 
The above prints out also the leading newline (which is OK), but if
one wanted those w/o the leading newline, the sed lines would be:
sed '1,/^$/d'

(If I did not come out with this notion of extra newline I would
not have shown this -- as the original sed -n ... matches more to 
"showing body" than "deleting header" :D)

Tomi

> +test_expect_equal "$expected" "$output"
> +}
> +
>  # Like test_expect_equal, but takes two filenames. Fails if either is empty
>  test_expect_equal_file_nonempty () {
>  exec 1>&6 2>&7   # Restore stdout and stderr
> -- 
> 2.34.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test/emacs: known broken test for matching fcc and sent message

2022-01-20 Thread Tomi Ollila
On Wed, Jan 19 2022, David Bremner wrote:

> David Bremner  writes:
>
>> Based on the method outlined by Daniel Kahn Gilmour in
>> id:87k1zm225v@fifthhorseman.net.  With a delay of 0.2 seconds the
>> test becomes flaky on my machine. With a 1 second delay it fails
>> consistently for more than 1600 iterations.
>
> And yet I didn't test the next test in the file, which I broke by adding
> another signed message. This is fixed in git.

I don't see commit im my pull (if that meant it, so probably only in your
own git) -- so you have chance to fix typo in the commit message :D

Tomi

>
> d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] CLI: print extra headers only for non-replies

2022-01-19 Thread Tomi Ollila
On Tue, Jan 18 2022, David Bremner wrote:

> If in the future we decide to output extra headers for replies, this
> should be controlled by a separate configuration option.
> ---
>  notmuch-show.c | 3 ++-
>  test/T310-emacs.sh | 1 -
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 136f4439..6a54d9c1 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -294,7 +294,8 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage 
> *message,
>  }
>  
>  /* Output extra headers the user has configured, if any */
> -format_extra_headers_sprinter (sp, message);
> +if (! reply)
> + format_extra_headers_sprinter (sp, message);

Looks simple enough for LGTM.

Tomi

>  sp->end (sp);
>  talloc_free (local);
>  }
> diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
> index 831df1cc..a05b828a 100755
> --- a/test/T310-emacs.sh
> +++ b/test/T310-emacs.sh
> @@ -486,7 +486,6 @@ EOF
>  test_expect_equal_file EXPECTED OUTPUT
>  
>  test_begin_subtest "Reply with show.extra_headers set"
> -test_subtest_known_broken
>  notmuch config set show.extra_headers Received
>  add_message '[from]="Sender "' \
>[to]=test_suite_ot...@notmuchmail.org
> -- 
> 2.34.1
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v4] emacs: customizable names for search buffers

2022-01-16 Thread Tomi Ollila
On Fri, Jan 14 2022, Jose A. Ortega Ruiz wrote:

> on second thought, i think we could perhaps just go for the simpler
> "%t", which would allow inserting the type anywhere, even in the middle
> of a word... i think a problem here is that "word" or "symbol" (which is
> what my suggestion used) constituent depend on the definition of what's
> a word or symbol in the active mode.
>
> although that would prevent fancy things like "%type: %t", but that's a
> bit of a corner case, don't you think?

Yes, simpler; the cases where is breaks are (probably?) seldom enough.

Also for reference,

(replace-regexp-in-string "\\_<%t\\_>" "repl" "foo-%t-bar") ;; does not work

(replace-regexp-in-string "\\_<%t\\_>" "repl" "foo %%%t bar") ;; neither...

(replace-regexp-in-string "\\_<%t\\_>" "repl" "foo %t bar") ;; worked, but...

Tomi

>
> cheers,
> jao
> -- 
> The surest way to corrupt a youth is to instruct him to hold in higher
> esteem those who think alike than those who think
> differently. -Friedrich Nietzsche, philosopher (1844-1900)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] emacs/notmuch-tag.el: add xmlns attribute to svg icons

2022-01-14 Thread Tomi Ollila
On Fri, Jan 14 2022, LdBeth wrote:

> emacs-mac that compiled with OS X system API for image display
> support cannot correctly render svg without xmlns parameter [1].

LGTM.

Tomi

>
> [1]: id:tencent_127aa231767438ac66fee4ddb4bbf51df...@qq.com
> ---
>  emacs/notmuch-tag.el | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index 145f309f..8af09e68 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -241,7 +241,7 @@ DATA is the content of an SVG picture (e.g., as returned 
> by
>"Return SVG data representing a star icon.
>  This can be used with `notmuch-tag-format-image-data'."
>"
> -
> + xmlns=\"http://www.w3.org/2000/svg\;>
>
>   d=\"m 290.25762,334.31206 -17.64143,-11.77975 -19.70508,7.85447 
> 5.75171,-20.41814 -13.55925,-16.31348 21.19618,-0.83936 11.325,-17.93675 
> 7.34825,19.89939 20.55849,5.22795 -16.65471,13.13786 z\"
> @@ -254,7 +254,7 @@ This can be used with `notmuch-tag-format-image-data'."
>"Return SVG data representing an empty star icon.
>  This can be used with `notmuch-tag-format-image-data'."
>"
> -
> + xmlns=\"http://www.w3.org/2000/svg\;>
>
>   d=\"m 290.25762,334.31206 -17.64143,-11.77975 -19.70508,7.85447 
> 5.75171,-20.41814 -13.55925,-16.31348 21.19618,-0.83936 11.325,-17.93675 
> 7.34825,19.89939 20.55849,5.22795 -16.65471,13.13786 z\"
> @@ -267,7 +267,7 @@ This can be used with `notmuch-tag-format-image-data'."
>"Return SVG data representing a tag icon.
>  This can be used with `notmuch-tag-format-image-data'."
>"
> -
> + xmlns=\"http://www.w3.org/2000/svg\;>
>
>   d=\"m 0.44642857,1040.9336 12.5043,0 2.700893,3.6161 
> -2.700893,3.616 -12.5043,0 z\"
> -- 
> 2.20.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs/notmuch-tag.el: add xmlns attribute to svg icons

2022-01-13 Thread Tomi Ollila
On Thu, Jan 13 2022, LdBeth wrote:

> emacs-mac that compiled with OS X system API instead of imagemagick
> cannot render svg without xmlns correctly [1].

Referecing Imagemagick in this commit message may be incorrect, otherwise
content looks good.

In case of Emacs 26, when imagemagick is used to render svg images,
transparent background is rendered white. The alternative "librsvg" 
(if I remember correctly, does not do that). I've tried hard to scale
svg images while doing notmuch-logo.svg but it always failed, when using
imagemagick background got white (bad when using dark background), and
when not using, image got clipped instead of resized. 

So, I cannot say for sure imagemagick is not used to render these icons,
but I'd guess so.

Btw: when using emacs 27, and pressing '+' or '-' when cursor is on
the (svg) notmuch logo in notmuch-hello window, background does not
render white, as happened with emacs 26.

Tomi

>
> [1]: id:tencent_127aa231767438ac66fee4ddb4bbf51df...@qq.com
> ---
>  emacs/notmuch-tag.el | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index 145f309f..8af09e68 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -241,7 +241,7 @@ DATA is the content of an SVG picture (e.g., as returned 
> by
>"Return SVG data representing a star icon.
>  This can be used with `notmuch-tag-format-image-data'."
>"
> -
> + xmlns=\"http://www.w3.org/2000/svg\;>
>
>   d=\"m 290.25762,334.31206 -17.64143,-11.77975 -19.70508,7.85447 
> 5.75171,-20.41814 -13.55925,-16.31348 21.19618,-0.83936 11.325,-17.93675 
> 7.34825,19.89939 20.55849,5.22795 -16.65471,13.13786 z\"
> @@ -254,7 +254,7 @@ This can be used with `notmuch-tag-format-image-data'."
>"Return SVG data representing an empty star icon.
>  This can be used with `notmuch-tag-format-image-data'."
>"
> -
> + xmlns=\"http://www.w3.org/2000/svg\;>
>
>   d=\"m 290.25762,334.31206 -17.64143,-11.77975 -19.70508,7.85447 
> 5.75171,-20.41814 -13.55925,-16.31348 21.19618,-0.83936 11.325,-17.93675 
> 7.34825,19.89939 20.55849,5.22795 -16.65471,13.13786 z\"
> @@ -267,7 +267,7 @@ This can be used with `notmuch-tag-format-image-data'."
>"Return SVG data representing a tag icon.
>  This can be used with `notmuch-tag-format-image-data'."
>"
> -
> + xmlns=\"http://www.w3.org/2000/svg\;>
>
>   d=\"m 0.44642857,1040.9336 12.5043,0 2.700893,3.6161 
> -2.700893,3.616 -12.5043,0 z\"
> -- 
> 2.20.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: notmuch-emacs: svg icon cannot be rendered by emacs-mac

2022-01-13 Thread Tomi Ollila
On Wed, Jan 12 2022, LdBeth wrote:

> The svg icons included in notmuch-emacs cannot be correctly rendered
> by emacs-mac (https://bitbucket.org/mituharu/emacs-mac/src/master/),
>
> The empty SVG created by `svg-image' function from svg.el has XML
> attribute `xmlns' like:
>
> " xmlns=\"http://www.w3.org/2000/svg\; 
> xmlns:xlink=\"http://www.w3.org/1999/xlink\;>
> "
>
> which is missing from SVG icons defined in `notmuch-tag.el'

First, IMO mac svg renderer is lame not to be lenient enough 
(and dont follow Postel's Law...) to just render those... anyway

... probably just adding xmlns=\"http://www.w3.org/2000/svg\;
to the svg strings in notmuch-tag.el could work. 
This just needs someone to test it. Adding the code is pretty easy :D,
but either someone w/ mac should do and test the change -- and send
patch email -- or definite information what works so someone else(tm)
(or her friend!) can do the change w/o testing :D

This is very easy to test, in started emacs first load notmuch, then
load notmuch-tag.el into new buffer, edit suitable svg functions, then
M-x eval-buffer (all these before executing any notmuch functions as
the first evaluation of those functions may be the only time those 
are called...

Tomi

PS: the new notmuch-logo.svg has the above xmlns in its implementation so
that should work :D

>
> Thanks.
>
> --
> LDB
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v4] emacs: customizable names for search buffers

2022-01-12 Thread Tomi Ollila
On Mon, Jan 10 2022, j...@gnu.org wrote:

> Customizable names for buffers presenting search results, via two
> custom variables (notmuch-search-buffer-name-format and
> notmuch-saved-search-buffer-name-format), defaulting to values
> currently used for plain searches and including too tree and
> unthreaded search buffers.
>
> ---
>
> This is a much improved version of the patch in
> id:20220108204121.1053932-1-...@gnu.org, according to discussion on
> that thread.
>
> This version fixes a doc string.
>
> Signed-off-by: jao 
> ---
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 85a54706..afb0a115 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -915,7 +915,37 @@ See `notmuch-tag' for information on the format of 
> TAG-CHANGES."
> (notmuch-search-get-tags-region (point-min) (point-max)) "Tag all")))
>(notmuch-search-tag tag-changes (point-min) (point-max) t))
>  
> -(defun notmuch-search-buffer-title (query)
> +(defcustom notmuch-search-buffer-name-format "*notmuch-%t-%s*"
> +  "Format for the name of search results buffers.
> +
> +In this spec, %s will be replaced by a description of the search
> +query and %t by its type (search, tree or unthreaded).
> +
> +See also `notmuch-saved-search-buffer-name-format'"
> +  :type 'string
> +  :group 'notmuch-search)
> +
> +(defcustom notmuch-saved-search-buffer-name-format "*notmuch-saved-%t-%s*"
> +  "Format for the name of search results buffers.
> +
> +In this spec, %s will be replaced by the saved search name and %t
> +by its type (search, tree or unthreaded).
> +
> +See also `notmuch-search-buffer-name-format'"
> +  :type 'string
> +  :group 'notmuch-search)
> +
> +(defun notmuch-search-format-buffer-name (query type saved)
> +  "Compose a buffer name for the given QUERY, TYPE (search, tree,
> +unthreaded) and whether it's SAVED (t or nil)."
> +  (let ((fmt (if saved
> +  notmuch-saved-search-buffer-name-format
> +notmuch-search-buffer-name-format)))
> +(if (fboundp 'format-spec)
> + (format-spec fmt `((?t . ,(or type "search")) (?s . ,query
> +(format (replace-regexp-in-string "\\b%t\\b" (or type "search") fmt) 
> query)))

I am curious about this regexp, \b is matching word/non-word boundary -- so
I had to test it.

(replace-regexp-in-string "\\b%t\\b" "repl" "foo %t bar") ;; no replacement
(replace-regexp-in-string "\\b%t\\b" "repl" "foo-%t-bar") ;; no replacement
...
(replace-regexp-in-string "\\b%t\\b" "repl" "foox%t-bar") ;; replacement!

before % there is "word" character and after t there is "non-word" character.

I wonder whether that works... (or is it just something I don't
understand)..

Also tried (format-spec "foo-%t-bar" '((?t . "repl"))) ;; which works as
I'd expect.


Tomi


___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


FYI: emacs / notmuch-search-edit-search

2022-01-12 Thread Tomi Ollila
Hi all

I've had this for a while in .emacs.d/notmuch-config.el

---

(defun notmuch-search-edit-search ()
  "Edit current search"
  (interactive)
  (notmuch-search (read-from-minibuffer
   "Edit search: " notmuch-search-query-string)
  notmuch-search-oldest-first))

(define-key notmuch-search-mode-map "e" #'notmuch-search-edit-search)

---

It has been very useful for refining one saved search of me -- but today
it was shown been far more useful in a large saved search (one I have
for nmbug), so I eventually thought this is good thing to share.

I also have created commit for that -- and is in my copy of notmuch*.elc
but I have not been running it as the above overwrites it ;/ -- also
before long ago I had last line as 'notmuch-search-oldest-first)) 
which was (obviously) incorrect but did not affect me as I have set
that variable to true (which is also the default, I think).

Tomi

PS: initial version used notmuch-group-disjunctive-query-string
but it just made it mode complex and usually provided worse
content -- so if one thinks about that don't or think how use
of it can be improved :D
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: Ignore more options that Fedora spec macros expect

2022-01-11 Thread Tomi Ollila
On Tue, Jan 11 2022, michaeljgruber wrote:

> From: Michael J Gruber 
>
> Signed-off-by: Michael J Gruber 
> ---

LGTM.

Tomi


> This allows the Fedora packager to use the standard Fedora packaging
> macros rather than a hand-tailored configure call.
>
> [Sorry for resend, my mails don't seem to get through, again.]
>
>  configure | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/configure b/configure
> index e7bb7edc..9e45cbe6 100755
> --- a/configure
> +++ b/configure
> @@ -312,12 +312,22 @@ for option; do
>   true
>  elif [ "${option%%=*}" = '--host' ] ; then
>   true
> +elif [ "${option%%=*}" = '--bindir' ] ; then
> + true
> +elif [ "${option%%=*}" = '--sbindir' ] ; then
> + true
>  elif [ "${option%%=*}" = '--datadir' ] ; then
>   true
>  elif [ "${option%%=*}" = '--localstatedir' ] ; then
>   true
> +elif [ "${option%%=*}" = '--sharedstatedir' ] ; then
> + true
>  elif [ "${option%%=*}" = '--libexecdir' ] ; then
>   true
> +elif [ "${option%%=*}" = '--exec-prefix' ] ; then
> + true
> +elif [ "${option%%=*}" = '--program-prefix' ] ; then
> + true
>  elif [ "${option}" = '--disable-maintainer-mode' ] ; then
>   true
>  elif [ "${option}" = '--disable-dependency-tracking' ] ; then
> -- 
> 2.34.1.653.g3264c0b0fb
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/3] build: move LDFLAGS after notmuch libraries.

2021-12-29 Thread Tomi Ollila
On Fri, Dec 24 2021, David Bremner wrote:

> In [1] Ryan Schmidt reported a problem on macports [2] with notmuch
> finding an existing installed version of libnotmuch during the build
> when the user specified LDFLAGS including the libnotmuch install
> directory.
>
> This change should prevent that.
>
> LDFLAGS also occurs in FINAL_LIBNOTMUCH_LDFLAGS. The only built
> library linked to that is util/libtnotmuch_util.a, and that passed as
> explicit (relative) path, and is thus not affected by -L.
>
> [1]: id:7851cab5-4556-4931-a0a2-37003e56c...@ryandesign.com
>
> [2]: The problem does not arise when libnotmuch is installed into a
> "system" library path that the compiler/linker searches by default.

This series looks good to me, and id:87lf0thhft@tethera.net
should still work.

Tomi

> ---
>  Makefile.global | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile.global b/Makefile.global
> index fe79121d..e6b00815 100644
> --- a/Makefile.global
> +++ b/Makefile.global
> @@ -52,7 +52,7 @@ PV_FILE=bindings/python/notmuch/version.py
>  # Smash together user's values with our extra values
>  FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CPPFLAGS) $(CFLAGS) 
> $(WARN_CFLAGS) $(extra_cflags) $(CONFIGURE_CFLAGS)
>  FINAL_CXXFLAGS = $(CPPFLAGS) $(CXXFLAGS) $(WARN_CXXFLAGS) $(extra_cflags) 
> $(extra_cxxflags) $(CONFIGURE_CXXFLAGS)
> -FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lnotmuch_util -Llib -lnotmuch
> +FINAL_NOTMUCH_LDFLAGS = -Lutil -lnotmuch_util -Llib -lnotmuch $(LDFLAGS)
>  ifeq ($(LIBDIR_IN_LDCONFIG),0)
>  FINAL_NOTMUCH_LDFLAGS += $(RPATH_LDFLAGS)
>  endif
> -- 
> 2.34.1
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: calculate NOTMUCH_BUILDDIR, write to Makefile.config

2021-12-29 Thread Tomi Ollila
On Wed, Dec 22 2021, David Bremner wrote:

> This will correct the current use of an undefined variable when
> setting LD_LIBRARY_PATH in doc/Makefile.local
>
> It is tempting to try to replace the use of test/export-dirs.sh, but
> this is not as simple as it looks, as NOTMUCH_BUILDDIR is used to
> locate sh.config, so probably cannot also sensibly be used to define
> it.

LGTM.

Tomi


> ---
>  configure | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index d399457a..e7bb7edc 100755
> --- a/configure
> +++ b/configure
> @@ -55,6 +55,8 @@ subdirs="${subdirs} bindings"
>  # the directory structure and copy Makefiles.
>  if [ "$srcdir" != "." ]; then
>  
> +NOTMUCH_BUILDDIR=$PWD
> +
>  for dir in . ${subdirs}; do
>   mkdir -p "$dir"
>   cp "$srcdir"/"$dir"/Makefile.local "$dir"
> @@ -78,6 +80,8 @@ if [ "$srcdir" != "." ]; then
> "$srcdir"/bindings/python-cffi/notmuch2 \
> "$srcdir"/bindings/python-cffi/setup.py \
> bindings/python-cffi/
> +else
> +NOTMUCH_BUILDDIR=$NOTMUCH_SRCDIR
>  fi
>  
>  # Set several defaults (optionally specified by the user in
> @@ -1247,6 +1251,7 @@ cat > Makefile.config <  # directory (the current directory at the time configure was run).
>  srcdir = ${srcdir}
>  NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR}
> +NOTMUCH_BUILDDIR = ${NOTMUCH_BUILDDIR}
>  
>  # subdirectories to build
>  subdirs = ${subdirs}
> -- 
> 2.34.1
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database.

2021-12-29 Thread Tomi Ollila
On Sat, Dec 25 2021, David Bremner wrote:

> It makes perfect sense for users to want to pre-create .notmuch,
> e.g. to install hooks, so we should handle the case of a .notmuch
> directory without an actual xapian database more gracefully.

Series LGTM.

Tomi


> ---
>  lib/open.cc  | 8 ++--
>  test/T055-path-config.sh | 1 -
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/lib/open.cc b/lib/open.cc
> index a91d22ef..54510eac 100644
> --- a/lib/open.cc
> +++ b/lib/open.cc
> @@ -661,16 +661,12 @@ notmuch_database_create_with_config (const char 
> *database_path,
>  
>   err = mkdir (notmuch_path, 0755);
>   if (err) {
> - if (errno == EEXIST) {
> - status = NOTMUCH_STATUS_DATABASE_EXISTS;
> - talloc_free (notmuch);
> - notmuch = NULL;
> - } else {
> + if (errno != EEXIST) {
>   IGNORE_RESULT (asprintf (, "Error: Cannot create 
> directory %s: %s.\n",
>notmuch_path, strerror (errno)));
>   status = NOTMUCH_STATUS_FILE_ERROR;
> + goto DONE;
>   }
> - goto DONE;
>   }
>  }
>  
> diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
> index 374aea3b..1df240dd 100755
> --- a/test/T055-path-config.sh
> +++ b/test/T055-path-config.sh
> @@ -322,7 +322,6 @@ EOF
> *)
>  backup_database
>  test_begin_subtest ".notmuch without xapian/ handled gracefully 
> ($config)"
> -test_subtest_known_broken
>  rm -r $XAPIAN_PATH
>  test_expect_success "notmuch new"
>  restore_database
> -- 
> 2.34.1
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: update coolj-line-prefix-regexp to make space optional

2021-12-29 Thread Tomi Ollila
On Sat, Dec 25 2021, David Bremner wrote:

> Jani reported that lines prefixed with '>' (as opposed to '> ') are
> not highlighted properly [1]. David E responded with a updated regex
> [2]. This change implements David E's suggestion.
>
> [1]: id:87a8b5pcky@nikula.org
> [2]: id:m2pok1e3gv@dme.org

LGTM.

Tomi

> ---
>  emacs/coolj.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/coolj.el b/emacs/coolj.el
> index d820525b..79d2a1b7 100644
> --- a/emacs/coolj.el
> +++ b/emacs/coolj.el
> @@ -45,7 +45,7 @@ Otherwise respect `fill-column'."
>:group 'coolj
>:type 'boolean)
>  
> -(defcustom coolj-line-prefix-regexp "^\\(>+ \\)*"
> +(defcustom coolj-line-prefix-regexp "^\\(>+ ?\\)*"
>"Regular expression that matches line prefixes."
>:group 'coolj
>:type 'regexp)
> -- 
> 2.34.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test: test folder renames

2021-12-26 Thread Tomi Ollila
On Sun, Dec 26 2021, David Bremner wrote:

> From: Jani Nikula 
>
> In [1] Mark Walters reported a problem with messages being removed
> from the database when the parent directory was renamed. Jani Nikula
> proposed [2] these tests but observed

With that 'From:' line commit message starts to look weird...
>
>This test is not suitable for merging since it's not deterministic.
>
> After applying Jani's patch [3], the tests now pass deterministically,
> and could usefully act as regression tests.
>
> [1]: id:87siray6th@qmul.ac.uk
> [2]: id:1393191650-28333-1-git-send-email-j...@nikula.org
> [3]: id:1441445731-4362-2-git-send-email-j...@nikula.org
> ---
>  test/T051-new-renames.sh | 40 
>  1 file changed, 40 insertions(+)
>  create mode 100755 test/T051-new-renames.sh
>
> diff --git a/test/T051-new-renames.sh b/test/T051-new-renames.sh
> new file mode 100755
> index ..febe006f
> --- /dev/null
> +++ b/test/T051-new-renames.sh
> @@ -0,0 +1,40 @@
> +#!/usr/bin/env bash
> +test_description='"notmuch new" with directory renames'
> +. ./test-lib.sh
> +
> +for loop in `seq 10`; do

{1..10}

> +
> +rm -rf ${MAIL_DIR}
> +
> +for i in `seq 10`; do

{1..10}

> +generate_message '[dir]=foo' '[subject]="Message foo $i"'
> +done
> +
> +for i in `seq 10`; do

{1..10}

> +generate_message '[dir]=bar' '[subject]="Message bar $i"'
> +done
> +
> +test_begin_subtest "Index the messages, round $loop"
> +output=$(NOTMUCH_NEW)
> +test_expect_equal "$output" "Added 20 new messages to the database."
> +
> +all_files=$(notmuch search --output=files \*)
> +count_foo=$(notmuch count folder:foo)
> +
> +test_begin_subtest "Rename folder"
> +mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz
> +output=$(NOTMUCH_NEW)
> +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."
> +
> +test_begin_subtest "Rename folder back"
> +mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo
> +output=$(NOTMUCH_NEW)
> +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."
> +
> +test_begin_subtest "Files remain the same"
> +output=$(notmuch search --output=files \*)
> +test_expect_equal "$output" "$all_files"
> +
> +done
> +
> +test_done
> -- 
> 2.34.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] doc: add dep. on stamp file for rebuilding gzipped man pages.

2021-12-25 Thread Tomi Ollila
On Fri, Dec 24 2021, David Bremner wrote:

> In [1] Daniel observed that the gzipped man pages were only being
> rebuild every second time when building with `make -j4'. This may be
> caused by a race condition between sphinx-build rebuilding the roff
> files and the recipe to gzip them. This commit sequentializes these
> two steps by making the stamp file a prerequisite for (all of) the
> gzip files.
>
> [1]: id:87tveotn1g@fifthhorseman.net
> ---
>  doc/Makefile.local | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/doc/Makefile.local b/doc/Makefile.local
> index c2ae1743..d43ef269 100644
> --- a/doc/Makefile.local
> +++ b/doc/Makefile.local
> @@ -117,6 +117,11 @@ build-man:
>  install-man:
>   @echo "No sphinx, will not install man pages."
>  else
> +
> +# it should be safe to depend on the stamp file, because it is created
> +# after all roff files are moved into place.
> +${MAN_GZIP_FILES}: ${DOCBUILDDIR}/.roff.stamp
> +

This thread becomes hard to follow...

... but the change looks sensible... the comment *should* be more
"assuritive" though ... :D


>  build-man: ${MAN_GZIP_FILES}
>  install-man: ${MAN_GZIP_FILES}
>   mkdir -m0755 -p "$(DESTDIR)$(mandir)/man1"
> -- 
> 2.34.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v3] emacs: add notmuch-logo.svg and use it in emacs mua on graphic displays

2021-12-21 Thread Tomi Ollila
emacs/notmuch-logo.svg is handcrafted scalable vector graphics version
of the notmuch logo.

Emacs on graphic displays render this image four times in size compared
to the emacs/notmuch-logo.png, and the image is much sharper.

The rendered image size, 100x100 pixels, fits reasonably well with
text shown in various font sizes.

Scaling the image -- if desired -- may come in the future. For now
this is improvement on how the logo looked in notmuch-hello window.
---

Version 3 of id:m2o85gtd3y@guru.guru-group.fi

diffdiff: 100x100, viewbox, stroke-width=2, some adjustments

(viewbow was to support scaling -- unfortunately emacs 26
(librsvg) svg rendering did not scale -- it clipped
(imagemagick would have scaled -- but white backround)

;-Subject: [PATCH v2] emacs: add notmuch-logo.svg and use it in emacs
;+Subject: [PATCH v3] emacs: add notmuch-logo.svg and use it in emacs
;  mua on graphic displays
;@@ -12,3 +12,3 @@
;
;-The rendered image size, 100x110 pixels, fits reasonably well with
;+The rendered image size, 100x100 pixels, fits reasonably well with
; text shown in various font sizes.
;
;@@ -87,4 +73,4 @@
; +
;-+http://www.w3.org/2000/svg;
;-+ height="110" width="100" fill="#000" stroke-width="1">
;++http://www.w3.org/2000/svg; width="100" height="100"
;++ viewbox="0 0 100 100" fill="#000" stroke-width="2">
; +  
;@@ -95,7 +81,7 @@
; +  
;-+  
;++  
; +  
;@@ -106,7 +92,7 @@
; +  
;-+  
;-+  
;++  
;++  
; +  
;-+
;-+
;++
;++
; +  

 debian/elpa-notmuch.elpa |  2 +-
 emacs/Makefile.local |  2 +-
 emacs/notmuch-hello.el   |  2 +-
 emacs/notmuch-logo.svg   | 27 +++
 4 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 emacs/notmuch-logo.svg

diff --git a/debian/elpa-notmuch.elpa b/debian/elpa-notmuch.elpa
index 4712b73f..7b3ce0fa 100644
--- a/debian/elpa-notmuch.elpa
+++ b/debian/elpa-notmuch.elpa
@@ -1,3 +1,3 @@
 debian/tmp/usr/share/emacs/site-lisp/*.el
-debian/tmp/usr/share/emacs/site-lisp/notmuch-logo.png
+debian/tmp/usr/share/emacs/site-lisp/notmuch-logo.svg
 emacs/notmuch-pkg.el
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index d1b320c3..0f1f0eb2 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -42,7 +42,7 @@ emacs_mua := $(dir)/notmuch-emacs-mua
 emacs_mua_desktop := $(dir)/notmuch-emacs-mua.desktop
 
 emacs_images := \
-   $(srcdir)/$(dir)/notmuch-logo.png
+   $(srcdir)/$(dir)/notmuch-logo.svg
 
 emacs_bytecode = $(emacs_sources:.el=.elc)
 emacs_docstrings = $(emacs_sources:.el=.rsti)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index acd48c9b..fc007c4c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -198,7 +198,7 @@ (defcustom notmuch-saved-search-sort-function nil
 (defvar notmuch-hello-indent 4
   "How much to indent non-headers.")
 
-(defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
+(defimage notmuch-hello-logo ((:type svg :file "notmuch-logo.svg")))
 
 (defcustom notmuch-show-logo t
   "Should the notmuch logo be shown?"
diff --git a/emacs/notmuch-logo.svg b/emacs/notmuch-logo.svg
new file mode 100644
index ..2c65a73b
--- /dev/null
+++ b/emacs/notmuch-logo.svg
@@ -0,0 +1,27 @@
+
+http://www.w3.org/2000/svg; width="100" height="100"
+ viewbox="0 0 100 100" fill="#000" stroke-width="2">
+  
+  
+
+
+
+  
+  
+  
+
+
+
+
+  
+  
+  
+  
+
+
+  
+
-- 
2.25.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Fix order of -I and -L flags

2021-12-20 Thread Tomi Ollila
On Fri, Dec 17 2021, David Bremner wrote:

> Ryan Schmidt  writes:
>
>> The notmuch build system puts -I and -L flags in the wrong order.
>>
>> Specifically, -I flags the user might specify in the CPPFLAGS
>> environment variable appear before the -I flags for the project's own
>> directories, resulting in build failure if a previous version of
>> notmuch (whose headers differ sufficiently from the new version) was
>> already installed.
>>
>> https://trac.macports.org/ticket/63274
>>
>> Similarly, -L flags the user might specify in the LDFLAGS environment
>> variable appear before the -L flags for the project's own directories,
>> resulting in build failure if a previous version of notmuch (whose
>> libraries differ sufficiently from the new version) was already
>> installed.
>>
>> https://trac.macports.org/ticket/63665
>
> Although I don't consider GNU standards normative for notmuch, there is
> some value in doing things a standard way. In particular the way notmuch
> uses {C,CPP,LD,CXX}FLAGS follows e.g. [1].

Does it ?

I initially thought CFLAGS should be first so that user can modify
anything, but then I thought that CFLAGS should be last just so that
the "project internal" includes are taken first. 

2 things) (1) I was wrong with where user can modify anything: -I's, -L's
in c compiler options are used in order, but (OTOH) (probably) some other
options given later may override previously given option.

then (2) [1] seems to say that

"Put CFLAGS last in the compilation command, after other variables
 containing compiler options, so the user can use CFLAGS to override the
 others. "

^^ that would also say mean that the -I's and -L's given in ${CFLAGS}
would be effective after the -I's and -L' configured...

>
> I guess on the Linux / BSD side we expect the configure script to do the
> heavy lifting so that manual setting of CPPFLAGS / LDFLAGS at build time
> is not needed in general. So one question is why isn't this the case for
> macports?
>
> I think there is value in letting individual end-users use these
> variables to override things (we just saw a case the other day where
> that fixed someone's unique build problem). 

What was the case ?

> I'm open to ideas for how we can make things easier for macports without
> taking away existing functionality for other users.

Would putting CFLAGS last break someone's workflow? Did I understand 
correctly what [1] mean for use of CFLAGS ?

>
> d
>
> [1]: https://www.gnu.org/prep/standards/html_node/Command-Variables.html.


Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] emacs: add notmuch-logo.svg and use it in emacs mua on graphic displays

2021-12-16 Thread Tomi Ollila
On Thu, Dec 16 2021, David Bremner wrote:

> Tomi Ollila  writes:
>
>> emacs/notmuch-logo.svg is handcrafted scalable vector graphics version
>> of the notmuch logo.
>>
>> Emacs on graphic displays render this image four times in size compared
>> to the emacs/notmuch-logo.png, and the image is much sharper.
>>
>> The rendered image size, 100x110 pixels, fits reasonably well with
>> text shown in various font sizes.
>>
>> Scaling the image -- if desired -- may come in the future. For now
>> this is improvement on how the logo looked in notmuch-hello window.
>
> I wish it was possible to scale in units relative to text size. For me
> with default settings it looks a bit big (see attached). Anyway, I can
> live with this (not least since I don't normally display the logo).

Nice font, is that 20 pixels in height ? (and what font is it ?)

> Anyone else want to chime in before I apply this change?

I personally tried with 12x25 sized font (xrandr tells 1920x1200, 
294mm x 165mm so what is that in dpi...) -- and it could be that
majority of users uses smaller font so it could look a bit tall.

Let's wait for a while for more comments.

In the meanwhile, after sending the patch email, I noticed that the
.png is 50x58 in size and .svg 110x100 (I accidentally swapped 
dimensions). So now I tried to drop 10 pixels from bottom (making
it 100x100) which makes it look a bit more like the original. 

The modified image is available below; the html "decoration" is 
for your entertainment: copy the whole content into a file.html, 
open file://$PWD/file.html in your web browser -- if web browser
is firefox, ctrl-+ and ctrl-- scales the image... 

Tomi

--8<8<8<8<8<8<8<8<8<8<8<--




body {
background-color: #777;
}






http://www.w3.org/2000/svg;
 height="100" width="100" fill="#000" stroke-width="1">
  
  



  
  
  




  
  
  
  


  





--8<8<8<8<8<8<8<8<8<8<8<--
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2] emacs: add notmuch-logo.svg and use it in emacs mua on graphic displays

2021-12-14 Thread Tomi Ollila
emacs/notmuch-logo.svg is handcrafted scalable vector graphics version
of the notmuch logo.

Emacs on graphic displays render this image four times in size compared
to the emacs/notmuch-logo.png, and the image is much sharper.

The rendered image size, 100x110 pixels, fits reasonably well with
text shown in various font sizes.

Scaling the image -- if desired -- may come in the future. For now
this is improvement on how the logo looked in notmuch-hello window.
---

In this version 2, of id:20211101225336.29070-1-tomi.oll...@iki.fi.

Dropped dimensions from 200x220 to 100x110; scaling in emacs is nontrivial;
imagemagick can do it but then it renders background white which looks bad
when using "dark" mode. (press '+' and '-' on top of the image and see
background going white (in this case it also scales the pixel image, 
does not re-render svg).

Spent a bit of time with svg.el -- then noticed it does not support
translate, rotate nor scale. In order to use that I would have to
calculate the final pixels (and if we desired scaling, then dynamically
counting dimensions and pixel endpoints...)

If scaling does not improve in (future) emaces, one option could be
to parse the xml, change image dimensions, add scale (and background
rectangle) nodes, then write xml to string and load that image
(whether that works or not, I don't know -- or if that is good idea)


 debian/elpa-notmuch.elpa |  2 +-
 emacs/Makefile.local |  2 +-
 emacs/notmuch-hello.el   |  2 +-
 emacs/notmuch-logo.svg   | 27 +++
 4 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 emacs/notmuch-logo.svg

diff --git a/debian/elpa-notmuch.elpa b/debian/elpa-notmuch.elpa
index 4712b73f..7b3ce0fa 100644
--- a/debian/elpa-notmuch.elpa
+++ b/debian/elpa-notmuch.elpa
@@ -1,3 +1,3 @@
 debian/tmp/usr/share/emacs/site-lisp/*.el
-debian/tmp/usr/share/emacs/site-lisp/notmuch-logo.png
+debian/tmp/usr/share/emacs/site-lisp/notmuch-logo.svg
 emacs/notmuch-pkg.el
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index d1b320c3..0f1f0eb2 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -42,7 +42,7 @@ emacs_mua := $(dir)/notmuch-emacs-mua
 emacs_mua_desktop := $(dir)/notmuch-emacs-mua.desktop
 
 emacs_images := \
-   $(srcdir)/$(dir)/notmuch-logo.png
+   $(srcdir)/$(dir)/notmuch-logo.svg
 
 emacs_bytecode = $(emacs_sources:.el=.elc)
 emacs_docstrings = $(emacs_sources:.el=.rsti)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index acd48c9b..fc007c4c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -198,7 +198,7 @@ (defcustom notmuch-saved-search-sort-function nil
 (defvar notmuch-hello-indent 4
   "How much to indent non-headers.")
 
-(defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
+(defimage notmuch-hello-logo ((:type svg :file "notmuch-logo.svg")))
 
 (defcustom notmuch-show-logo t
   "Should the notmuch logo be shown?"
diff --git a/emacs/notmuch-logo.svg b/emacs/notmuch-logo.svg
new file mode 100644
index ..6fdeb71d
--- /dev/null
+++ b/emacs/notmuch-logo.svg
@@ -0,0 +1,27 @@
+
+http://www.w3.org/2000/svg;
+ height="110" width="100" fill="#000" stroke-width="1">
+  
+  
+
+
+
+  
+  
+  
+
+
+
+
+  
+  
+  
+  
+
+
+  
+
-- 
2.25.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 1/6] configure: have bash_absolute and perl_absolute always defined

2021-12-07 Thread Tomi Ollila
Since set -u is used, without bash or perl, configure would fail.

This has gone unnoticed as (almost) everyone always had both
bash and perl installed (and in $PATH).

Thanks to FreeBSD ports this bug became visible; this change is
verbatim copy of `patch-configure` in FreeBSD ports tree.
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 7d9df370..d399457a 100755
--- a/configure
+++ b/configure
@@ -734,6 +734,7 @@ if command -v ${BASHCMD} > /dev/null; then
 printf "Yes (%s).\n" "$bash_absolute"
 else
 have_bash=0
+bash_absolute=
 printf "No. (%s not found)\n" "${BASHCMD}"
 fi
 
@@ -744,6 +745,7 @@ if command -v ${PERL} > /dev/null; then
 printf "Yes (%s).\n" "$perl_absolute"
 else
 have_perl=0
+perl_absolute=
 printf "No. (%s not found)\n" "${PERL}"
 fi
 
-- 
2.25.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test/emacs: mark one test as fixed in newer emacs.

2021-12-06 Thread Tomi Ollila
On Sun, Dec 05 2021, David Bremner wrote:

> The remaining problem in this test is fixed upstream in Emacs
> 28. While most people are using earlier versions of emacs, the test
> still provides some documentation of a known bug.
> ---
>  test/T450-emacs-show.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
> index 4b5f5fde..2a192ed0 100755
> --- a/test/T450-emacs-show.sh
> +++ b/test/T450-emacs-show.sh
> @@ -220,7 +220,9 @@ test_emacs '(notmuch-show 
> "id:basic-encryp...@crypto.notmuchmail.org")
>  test_expect_equal_file $EXPECTED/notmuch-show-decrypted-message OUTPUT
>  
>  test_begin_subtest "show encrypted rfc822 message"
> -test_subtest_known_broken
> +if ${TEST_EMACS} --quick --batch --eval '(if (version< emacs-version
>  "28") (kill-emacs 0) (kill-emacs 1)))'; then

looks good but perhaps "drier" version:

(kill-emacs (if (version< emacs-version "28") 0 1))

Tomi

> +test_subtest_known_broken
> +fi
>  test_emacs '(notmuch-show 
> "id:encrypted-rfc822-attachm...@crypto.notmuchmail.org")
>  (test-visible-output)'
>  test_expect_code 1 'fgrep "!!!" OUTPUT'
> -- 
> 2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] emacs: drop C-tab binding in hello mode, document .

2021-11-03 Thread Tomi Ollila
On Sat, Oct 30 2021, David Bremner wrote:

> The  binding has always been there, but the docs were
> apparently mistakenly changed to say  [1]
>
> Revert to  in the documentation.
>
> The commit also drops the C- binding, since it seems redundant
> and it interferes with tab-bar-mode.
>
> [1]: 703dec7754da477b5683867c88cb940b8553be91.

I am not against :D

> ---
>  doc/notmuch-emacs.rst  | 2 +-
>  emacs/notmuch-hello.el | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
> index 12ee25e5..22aee340 100644
> --- a/doc/notmuch-emacs.rst
> +++ b/doc/notmuch-emacs.rst
> @@ -56,7 +56,7 @@ notmuch-hello key bindings
>  
>  Move to the next widget (button or text entry field)
>  
> -
> +
>  Move to the previous widget.
>  
>  
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 71487bd9..acd48c9b 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -702,7 +702,6 @@ with `notmuch-hello-query-counts'."
>;; that when we modify map it does not modify widget-keymap).
>(let ((map (make-composed-keymap (list (make-sparse-keymap) 
> widget-keymap
>  (set-keymap-parent map notmuch-common-keymap)
> -(define-key map (kbd "") 'widget-backward)
>  map)
>"Keymap for \"notmuch hello\" buffers.")
>  
> -- 
> 2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 4/4] python-cffi: switch to notmuch_database_{open,create}_with_config

2021-11-03 Thread Tomi Ollila
On Tue, Nov 02 2021, David Bremner wrote:

> Floris Bruynooghe  writes:
>
>> On Sat 30 Oct 2021 at 13:22 -0300, David Bremner wrote:
>>> +
>>> +.. deprecated:: 0.35
>>> +   Use the ``cfg_path`` parameter instead.
>>
>> Do you mean the ``config`` parameter to :meth:`__init__` or
>> :meth:`__create__` here instead of ``cfg_path``?
>>
>
> Good catch, that is indeed what I meant.
>
>
> [rest of patch snipped]
>
>> LGTM I think.
>>
>> As an aside, what is the oldest python version we still want to support?
>> I'm wondering if we can get rid of this `if not hasattr(os, 'PathLike')`
>> construct which only exists because of python 3.5.
>
> I usually go by what is in Debian oldstable, which is 3.7.x at this
> point. But maybe Tomi wants to comment, he is usually expert at finding
> old distros to run notmuch on ;)

I run nmbug using python 2.7 >;D

Last time I recall python 3.6 is the oldest supported version
(i.e. python 3.5 is EOL'd).

>
> d
>
> PS: I took the liberty of replying to the list, hope that's OK.

Tomi

Remembered this after spending some time creating svg image -- so
backupping it too :D

⠠⢄⣀⡀⠀⢾⡷
⢀⣠⣣⣉⠙⢺⡗⠦⢤⣀⡀
⠸⣌⣋⡼⠀⣸⡇⠀⠀⡜⡌⠁
⠀⣿⣷⠀⠺⠶⠾⠂
⠀⣿⣿
⠀⠀⣠⣴⣶⣿⣿⣶⣦⣄

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[RFC PATCH] emacs: add notmuch-logo.svg

2021-11-01 Thread Tomi Ollila
handcrafted scalable vector graphics version of the notmuch logo

for sharper image
---

Loads in emacs, on my screen letter was white on white background
(emacs dark background) so hints how to make it look better on
dark mode emacs (i.e. white lines instead of black) and how to
have transparent background for everyone...

(did not run (xml) conformity check (just realized should do) -- anyway
I did not see anything non-conforming there ;D

 emacs/notmuch-logo.svg | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 emacs/notmuch-logo.svg

diff --git a/emacs/notmuch-logo.svg b/emacs/notmuch-logo.svg
new file mode 100644
index ..6625e651
--- /dev/null
+++ b/emacs/notmuch-logo.svg
@@ -0,0 +1,26 @@
+
+http://www.w3.org/2000/svg; height="220" width="200">
+  
+  
+
+
+
+  
+  
+  
+
+
+
+
+  
+  
+  
+  
+
+
+  
+
-- 
2.25.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] rename built_with.sexpr_query to built_with.sexp_queries

2021-11-01 Thread Tomi Ollila
On Sat, Oct 30 2021, David Bremner wrote:

> It is confusing to use two different names (sexp vs sexpr) when
> compared with the command line option --query=sexp and (furthermore)
> singular vs plural when compared with the man page title.

like wrote before -- fine by me...

Tomi


> ---
>  doc/man7/notmuch-sexp-queries.rst | 2 +-
>  lib/built-with.c  | 2 +-
>  notmuch-config.c  | 4 ++--
>  test/T030-config.sh   | 2 +-
>  test/T055-path-config.sh  | 2 +-
>  5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/doc/man7/notmuch-sexp-queries.rst 
> b/doc/man7/notmuch-sexp-queries.rst
> index d3b18593..3c33232f 100644
> --- a/doc/man7/notmuch-sexp-queries.rst
> +++ b/doc/man7/notmuch-sexp-queries.rst
> @@ -21,7 +21,7 @@ build of notmuch supports it with
>  
>  ::
>  
> -   $ notmuch config get built_with.sexpr_query
> +   $ notmuch config get built_with.sexp_queries
>  
>  
>  S-EXPRESSIONS
> diff --git a/lib/built-with.c b/lib/built-with.c
> index 89958e12..275e72b8 100644
> --- a/lib/built-with.c
> +++ b/lib/built-with.c
> @@ -32,7 +32,7 @@ notmuch_built_with (const char *name)
>   return HAVE_XAPIAN_DB_RETRY_LOCK;
>  } else if (STRNCMP_LITERAL (name, "session_key") == 0) {
>   return true;
> -} else if (STRNCMP_LITERAL (name, "sexpr_query") == 0) {
> +} else if (STRNCMP_LITERAL (name, "sexp_queries") == 0) {
>   return HAVE_SFSEXP;
>  } else {
>   return false;
> diff --git a/notmuch-config.c b/notmuch-config.c
> index db00a26c..11d8d68b 100644
> --- a/notmuch-config.c
> +++ b/notmuch-config.c
> @@ -680,9 +680,9 @@ _notmuch_config_list_built_with ()
>  printf ("%sretry_lock=%s\n",
>   BUILT_WITH_PREFIX,
>   notmuch_built_with ("retry_lock") ? "true" : "false");
> -printf ("%ssexpr_query=%s\n",
> +printf ("%ssexp_queries=%s\n",
>   BUILT_WITH_PREFIX,
> - notmuch_built_with ("sexpr_query") ? "true" : "false");
> + notmuch_built_with ("sexp_queries") ? "true" : "false");
>  }
>  
>  static int
> diff --git a/test/T030-config.sh b/test/T030-config.sh
> index 3a585d1b..b99eb9e7 100755
> --- a/test/T030-config.sh
> +++ b/test/T030-config.sh
> @@ -51,7 +51,7 @@ cat < EXPECTED
>  built_with.compact=something
>  built_with.field_processor=something
>  built_with.retry_lock=something
> -built_with.sexpr_query=something
> +built_with.sexp_queries=something
>  database.autocommit=8000
>  database.mail_root=MAIL_DIR
>  database.path=MAIL_DIR
> diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
> index ef22e964..38f72e5e 100755
> --- a/test/T055-path-config.sh
> +++ b/test/T055-path-config.sh
> @@ -277,7 +277,7 @@ EOF
>  built_with.compact=something
>  built_with.field_processor=something
>  built_with.retry_lock=something
> -built_with.sexpr_query=something
> +built_with.sexp_queries=something
>  database.autocommit=8000
>  database.backup_dir
>  database.hook_dir
> -- 
> 2.33.0
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 4/4] python-cffi: switch to notmuch_database_{open,create}_with_config

2021-10-31 Thread Tomi Ollila
On Sat, Oct 30 2021, David Bremner wrote:

> Since release 0.32, libnotmuch provides searching for database and
> configuration paths. This commit changes the python module notmuch2 to
> use those facilities.
>
> This fixes the bug reported in [1], along with a couple of the
> deprecation warnings in the python bindings.
>
> Database.default_path is deprecated, since it no longer faithfully
> reflects what libnotmuch is doing, and it is also no longer used in
> the bindings themselves.
>
> This commit choose the default of config=CONFIG.EMPTY (equivalent to
> passing "" to notmuch_database_open_with_config).  This makes the
> change upward compatible API-wise (at least as far as the test suite
> verifies), but changing the default to CONFIG.SEARCH would probably be
> more convenient for bindings users.

Generally this series looks good to me -- some suspicious newlines I see,
some (if not all) of those might be ok...

>
> [1]: id:87h7d4wp6b@tethera.net
> ---
>  bindings/python-cffi/notmuch2/_build.py| 26 ---
>  bindings/python-cffi/notmuch2/_database.py | 81 --
>  doc/man1/notmuch-config.rst|  2 +
>  test/T055-path-config.sh   |  5 +-
>  test/T391-python-cffi.sh   |  8 ++-
>  5 files changed, 82 insertions(+), 40 deletions(-)
>
> diff --git a/bindings/python-cffi/notmuch2/_build.py 
> b/bindings/python-cffi/notmuch2/_build.py
> index 24df939e..f6184b97 100644
> --- a/bindings/python-cffi/notmuch2/_build.py
> +++ b/bindings/python-cffi/notmuch2/_build.py
> @@ -103,20 +103,18 @@ ffibuilder.cdef(
>  notmuch_status_to_string (notmuch_status_t status);
>  
>  notmuch_status_t
> -notmuch_database_create_verbose (const char *path,
> - notmuch_database_t **database,
> - char **error_message);
> -notmuch_status_t
> -notmuch_database_create (const char *path, notmuch_database_t 
> **database);
> -notmuch_status_t
> -notmuch_database_open_verbose (const char *path,
> -   notmuch_database_mode_t mode,
> -   notmuch_database_t **database,
> -   char **error_message);
> -notmuch_status_t
> -notmuch_database_open (const char *path,
> -   notmuch_database_mode_t mode,
> -   notmuch_database_t **database);
> +notmuch_database_create_with_config (const char *database_path,
> + const char *config_path,
> + const char *profile,
> + notmuch_database_t **database,
> + char **error_message);
> +notmuch_status_t
> +notmuch_database_open_with_config (const char *database_path,
> +   notmuch_database_mode_t mode,
> +   const char *config_path,
> +   const char *profile,
> +   notmuch_database_t **database,
> +   char **error_message);
>  notmuch_status_t
>  notmuch_database_close (notmuch_database_t *database);
>  notmuch_status_t
> diff --git a/bindings/python-cffi/notmuch2/_database.py 
> b/bindings/python-cffi/notmuch2/_database.py
> index c1fb88eb..92bfdef2 100644
> --- a/bindings/python-cffi/notmuch2/_database.py
> +++ b/bindings/python-cffi/notmuch2/_database.py
> @@ -31,6 +31,9 @@ class Mode(enum.Enum):
>  READ_ONLY = capi.lib.NOTMUCH_DATABASE_MODE_READ_ONLY
>  READ_WRITE = capi.lib.NOTMUCH_DATABASE_MODE_READ_WRITE
>  
> +class ConfigFile(enum.Enum):
> +EMPTY = b''
> +SEARCH = capi.ffi.NULL
>  
>  class QuerySortOrder(enum.Enum):
>  OLDEST_FIRST = capi.lib.NOTMUCH_SORT_OLDEST_FIRST
> @@ -71,6 +74,9 @@ class Database(base.NotmuchObject):
>  :cvar EXCLUDE: Which messages to exclude from queries, ``TRUE``,
> ``FLAG``, ``FALSE`` or ``ALL``.  See the query documentation
> for details.
> +:cvar CONFIG: Control loading of config file. Enumeration of
> +   ``EMPTY`` (don't load a config file), and ``SEARCH`` (search as
> +   in :ref:`config_search`)
>  :cvar AddedMessage: A namedtuple ``(msg, dup)`` used by
> :meth:`add` as return value.
>  :cvar STR_MODE_MAP: A map mapping strings to :attr:`MODE` items.
> @@ -81,9 +87,8 @@ class Database(base.NotmuchObject):
> still open.
>  
>  :param path: The directory of where the database is stored.  If
> -   ``None`` the location will be read from the user's
> -   configuration file, respecting the ``NOTMUCH_CONFIG``
> -   environment variable if set.
> +   ``None`` the location will be searched according to
> +   :ref:`database`
>  :type path: str, bytes, os.PathLike or pathlib.Path
>  :param mode: The 

Re: [PATCH] emacs: don't add space to tag completion candidates.

2021-10-31 Thread Tomi Ollila
On Sat, Oct 30 2021, David Bremner wrote:

> "inwit"  writes:
>
>> Works as expected under selectrum! Thanks!
>>
>>
>
> right, I guess the question is how annoying it is for users of standard
> emacs completion. I generally enter one tag at a time, so it won't
> really affect me.

I recall doing adding many tags, but very seldom. I'd guess the need to
press space before entering next is tolerable (basing my guess on my
experiences w/ various experiences w/ filename completion...)


>
> d

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC PATCH] python-cffi out-of-tree build

2021-10-31 Thread Tomi Ollila
On Sun, Oct 31 2021, David Bremner wrote:

> Tomi Ollila  writes:
>
>> setup.py and _build.py to refer some other files based on directory
>> where setup.py is located (os.path.dirname(sys.argv[0]).
>>
>> Dropped bindings/python-cffi/version.txt and refer ../../version.txt
>> instead -- _build.py already refers ../../lib so why have version.txt
>> twice (with identical content).
>>
>> Dropped copying of bindings/python-cffi source files to the build
>> directory bindings/python-cffi in configure.
>
> Apologies, I think I did not read this discussion very carefully
> before. I guess [1] is an alternative to the first two points. I'm not
> sure which approach is better. Mine is a bigger hammer, but maybe that
> could be useful in the future?
>
> The patch at [1] does not (by itself) allow the third change, but
> probably some similar hacking of setup.py, but using the newly created
> _notmuch_config.py would work.
>
> Tomi, did you happen to test "pip install ." with your approach? I'm
> afraid your patch doesn't (easily) apply anymore so I was too lazy to
> test myself.

IIRC my approaches had quite a few problems which I thought soon after
emailing so probablhy your versions are better. Have to look...

Tomi

>
> Cheers,
>
> db
>
> [1]: id:20211031100354.1697379-1-da...@tethera.net
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] NEWS: fix typo in 0.34 news.

2021-10-27 Thread Tomi Ollila
On Wed, Oct 27 2021, David Bremner wrote:

> David Bremner  writes:
>
>> Thanks to jrm on IRC for finding the typo.
>
> Applied to release and master.
>
> It (belatedly) occurs to me that it's a bit confusing to that the
> built_with option is sexpr_query, while the man page is
> notmuch-sexp-queries, and the option is --query=sexp
>
> What do people think about changing the built_with option to
> sexp_queries, to more or less match the man page?

I was thinking the same (when modifying wiki a few days ago...).

I'd say yes.

>
> d

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test/libconfig: use 'export' when restoring NOTMUCH_CONFIG

2021-10-27 Thread Tomi Ollila
On Wed, Oct 27 2021, David Bremner wrote:

> This is required when NOTMUCH_CONFIG has been unset, and is harmless
> otherwise.

LGTM.

Tested w/ the following than the commit message is correct:

(works the same way w/ dash, bash and zsh)

--8<8<8<8<--
export FOO

FOO=1

sh -c 'echo $FOO'

FOO=2

sh -c 'echo $FOO'
--8<8<8<8<--


> ---
>  test/T590-libconfig.sh | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
> index 59b82a6f..a9566c13 100755
> --- a/test/T590-libconfig.sh
> +++ b/test/T590-libconfig.sh
> @@ -461,7 +461,7 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} %NULL% 
> %NULL%
>  }
>  EOF
>  rm -f ${ovconfig}
> -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
> +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  test.key1 = overridden-home
> @@ -488,7 +488,7 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} %NULL% 
> %NULL%
>  }
>  EOF
>  rm -f ${ovconfig}
> -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
> +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  test.key1 = overridden-xdg
> @@ -515,7 +515,7 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} %NULL% 
> work
>  }
>  EOF
>  rm -f ${ovconfig}
> -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
> +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  test.key1 = overridden-xdg-profile
> @@ -541,7 +541,7 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} %NULL% 
> work
>  }
>  EOF
>  #rm -f ${ovconfig}
> -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
> +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  test.key1 = overridden-profile
> @@ -559,7 +559,7 @@ cat c_head - c_tail <<'EOF' | test_C %NULL% '' %NULL%
> printf("NOT RUN");
>  }
>  EOF
> -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
> +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  == stderr ==
> @@ -604,7 +604,7 @@ cat c_head - c_tail <<'EOF' | test_C %NULL% '' %NULL%
> printf("test.key2 = %s\n", val);
>  }
>  EOF
> -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
> +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
>  unset NOTMUCH_DATABASE
>  cat <<'EOF' >EXPECTED
>  == stdout ==
> @@ -783,7 +783,7 @@ cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} %NULL% 
> %NULL%
>  }
>  EOF
>  rm -f ${ovconfig}
> -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
> +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
>  cat <<'EOF' >EXPECTED
>  == stdout ==
>  test.key1 = overridden-home
> -- 
> 2.33.0
>
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/2] test/new: replace use of gdb in vanishing file test

2021-10-25 Thread Tomi Ollila
On Sun, Oct 24 2021, David Bremner wrote:

> Because the file to be removed has a predictable name, we can hard
> code it in the generated shim.

I am not sure about the message above -- the file name is as predictable
as it was before -- and the shim code is created dynamically, with same
amout of flexibility as it was w/ the gdb script

Anyway I ignore if the same message appears in style-fixed email
(see below)...

Tomi

> ---
>  test/T050-new.sh| 44 
>  test/notmuch-test.h |  1 +
>  2 files changed, 25 insertions(+), 20 deletions(-)
>
> diff --git a/test/T050-new.sh b/test/T050-new.sh
> index 1141c1e3..5a03998b 100755
> --- a/test/T050-new.sh
> +++ b/test/T050-new.sh
> @@ -368,31 +368,35 @@ chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.*
>  test_expect_equal "$output" "A Xapian exception occurred opening database"
>  
>  
> +make_shim dif-shim< +#include 
> +notmuch_status_t
> +notmuch_database_index_file (notmuch_database_t *database,
> +  const char *filename,
> +  notmuch_indexopts_t *indexopts,
> +  notmuch_message_t **message)
> +{
> +  static notmuch_status_t (*orig_notmuch_database_index_file)
> +(notmuch_database_t *database,
> + const char *filename,
> + notmuch_indexopts_t *indexopts,
> + notmuch_message_t **message) = NULL;
> +  TEST_SAVE_ORIG(notmuch_database_index_file);
> +
> +  if (unlink("${MAIL_DIR}/vanish")) {
> + fprintf(stderr, "unlink failed\n");
> + exit(42);

style not 'exit (42)' like in sources, and in previous change -- mostly
in previous change, there was also at least one fn() use, which I failed
to comment... anyway, asking for consistent style.

> +  }
> +  return orig_notmuch_database_index_file(database, filename, indexopts, 
> message);
> +}
> +EOF
> +
>  test_begin_subtest "Handle files vanishing between scandir and add_file"
>  
>  # A file for scandir to find. It won't get indexed, so can be empty.
>  touch ${MAIL_DIR}/vanish
> -
> -# Breakpoint to remove the file before indexing
> -cat < notmuch-new-vanish.gdb
> -set breakpoint pending on
> -set logging file notmuch-new-vanish-gdb.log
> -set logging on
> -break notmuch_database_index_file
> -commands
> -shell rm -f ${MAIL_DIR}/vanish
> -continue
> -end
> -run
> -EOF
> -
> -${TEST_GDB} --batch-silent --return-child-result -x notmuch-new-vanish.gdb \
> ---args notmuch new 2>OUTPUT 1>/dev/null
> +notmuch_with_shim dif-shim new 2>OUTPUT 1>/dev/null
>  echo "exit status: $?" >> OUTPUT
> -
> -# Clean up the file in case gdb isn't available.
> -rm -f ${MAIL_DIR}/vanish
> -
>  cat < EXPECTED
>  Unexpected error with file ${MAIL_DIR}/vanish
>  add_file: Something went wrong trying to read or write a file
> diff --git a/test/notmuch-test.h b/test/notmuch-test.h
> index 8613a299..94348d69 100644
> --- a/test/notmuch-test.h
> +++ b/test/notmuch-test.h
> @@ -7,6 +7,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  inline static void
>  expect0 (int line, notmuch_status_t ret)
> -- 
> 2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] test/count: replace use of gdb with a LD_PRELOAD shim

2021-10-25 Thread Tomi Ollila
On Sun, Oct 24 2021, David Bremner wrote:

> There is a certain amount of boilerplate to pass the call on the
> original function, so abstract it out as a C preprocessor macro, plus
> some extra includes in notmuch-test.h

Looks like good progress -- some comments...

> ---
>  test/T060-count.sh  | 29 +
>  test/notmuch-test.h | 22 ++
>  2 files changed, 39 insertions(+), 12 deletions(-)
>
> diff --git a/test/T060-count.sh b/test/T060-count.sh
> index 6ad80df9..acf51d88 100755
> --- a/test/T060-count.sh
> +++ b/test/T060-count.sh
> @@ -102,22 +102,27 @@ output=$(sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' 
> OUTPUT)
>  test_expect_equal "${output}" "A Xapian exception occurred opening database"
>  restore_database
>  
> -cat < count-files.gdb
> -set breakpoint pending on
> -set logging file count-files-gdb.log
> -set logging on
> -break count_files
> -commands
> -shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.*
> -continue
> -end
> -run
> +make_shim qsm-shim< +#include 
> +notmuch_status_t
> +notmuch_query_search_messages (notmuch_query_t *query, notmuch_messages_t 
> **messages) {
> +  static notmuch_status_t (*orig_notmuch_query_search_messages)
> + (notmuch_query_t *query, notmuch_messages_t **messages) = NULL;
> +  TEST_SAVE_ORIG(notmuch_query_search_messages);

The C preprocessor macro could do both of the lines above, deduplicating
orig_notmuch_query_search_messages and notmuch_query_search_messages to
one, but perhaps this way is clearer...(?)

> +
> +  /* XXX WARNING THIS CORRUPTS THE DATABASE */
> +  int fd = open("target_postlist",O_WRONLY|O_TRUNC);
missing space after ,

> +  if (fd < 0)
> +exit (8);

close(fd) ?

> +
> +  return orig_notmuch_query_search_messages(query, messages);
> +}
>  EOF
>  
>  backup_database
>  test_begin_subtest "error message from query_search_messages"
> -${TEST_GDB} --batch-silent --return-child-result -x count-files.gdb \
> ---args notmuch count --output=files '*' 2>OUTPUT 1>/dev/null
> +ln -s ${MAIL_DIR}/.notmuch/xapian/postlist.* target_postlist
> +notmuch_with_shim qsm-shim count --output=files '*' 2>OUTPUT 1>/dev/null
>  cat < EXPECTED
>  notmuch count: A Xapian exception occurred
>  A Xapian exception occurred performing query
> diff --git a/test/notmuch-test.h b/test/notmuch-test.h
> index 34dbb8e0..8613a299 100644
> --- a/test/notmuch-test.h
> +++ b/test/notmuch-test.h
> @@ -3,6 +3,10 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  inline static void
>  expect0 (int line, notmuch_status_t ret)
> @@ -14,4 +18,22 @@ expect0 (int line, notmuch_status_t ret)
>  }
>  
>  #define EXPECT0(v)  expect0 (__LINE__, v);
> +
> +#define TEST_SAVE_ORIG(func) \
> +  if (! orig_##func) { \
> +void *handle; \
> +char *error; \
> +handle = dlopen("libnotmuch.so", RTLD_LAZY); \

could have void *handle = dlopen... to reduce one macro line

> +if (! handle) { \
> +  fputs(dlerror(), stderr); \
> +  exit(1); \
> +} \
> +orig_##func = dlsym(handle, #func); \
> +if ((error = dlerror()) != NULL) { \
> +  fprintf(stderr, "%s\n", error); \
> +  exit(1); \
> +} \
> +  }
> +
> +
>  #endif
> -- 
> 2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Emacs notmuch extracts text attachments as if they had Windows (CRLF) encoding

2021-10-14 Thread Tomi Ollila
On Wed, Oct 13 2021, Martin Jambor wrote:

> Hi,
>
> I have stumbled upon strange behavior of emacs-notmuch.  When I extract
> (some?) plain text attachments into files using notmuch-show-save-part
> (by pressing ".s"), the file they end up in has Windows encoding of line
> ends (CRLF) even though both the machine used to send and receive the
> email are Linux ones.
>
> I can reproduce the issue with the attached example email.  Emacs
> notmuch extracts the attachment into a windows encoding file while mutt
> or metamail does not.
>
> Can anyone else reproduce this behavior?  Any ideas how to fix it?

Are you talking about this attachment in the gzipped email content:

  ---1609908220-525021627-1633684545=:5930
  Content-Type: text/plain; charset=US-ASCII; name=status
  Content-Transfer-Encoding: BASE64
  Content-Description: test
  Content-Disposition: attachment; filename=status

  U3RhdHVzDQo9PT09PT0NCg0KVGhlIEdDQyBkZXZlbG9wbWVudCBicmFuY2gg
  ...
  NTgzMS5odG1sDQo=

  ---1609908220-525021627-1633684545=:5930--

I manually extracted the BASE64 content, it does have the 
CRLF line endings...

>
> Thanks a lot,
>
> Martin
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 2/5] lib: remove enum names from typedefs

2021-10-13 Thread Tomi Ollila
On Wed, Oct 13 2021, David Bremner wrote:

> Jani Nikula  writes:
>
>> Given the named enum typedef:
>>
>> typedef enum _name_t { ... } name_t;
>>
>> Hawkmoth uses _name_t as the name for documentation. Typedef the
>> anonymous enum:
>>
>> typedef enum { ... } name_t;
>>
>> instead to use name_t. We don't really need the enum names for
>> anything, and not all of the enum typedefs have them anyway.
>> ---
> I guess that change would be fine independent of the rest?

I had the same thought.

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 1/5] doc: replace doxygen with hawkmoth sphinx extension for api docs

2021-10-13 Thread Tomi Ollila

Interesting stuff...

On Tue, Oct 12 2021, Jani Nikula wrote:

> Hawkmoth is a Sphinx extension for incorporating documentation
> comments from C source to Sphinx. For Notmuch API documentation needs,
> Doxygen is overkill, and Hawkmoth also directly integrates with
> Sphinx.

// stuff deleted //

> +
>  # -- Options for HTML output --
>  
>  # The theme to use for HTML and HTML Help pages.  See the documentation for
> @@ -172,6 +178,13 @@ man_pages = [
>   [notmuch_authors], 1),
>  ]
>  
> +if tags.has('WITH_API_DOCS'):
> +man_pages += [
> +('man3/notmuch', 'notmuch',
> + u'notmuch library',

öld stuff...??? (the u'' i mean) :O

Tomi 


> + [notmuch_authors], 3),
> +]
> +
>  # If true, show URL addresses after external links.
>  #man_show_urls = False
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: whitespace cleanup

2021-10-10 Thread Tomi Ollila
On Sat, Oct 09 2021, David Bremner wrote:

> In order to make it easier to keep the whitespace consistent in the
> configure script, use the same style defined in devel/STYLE for
> C/C++.
>
>   Specifically, a line should begin with zero or more tabs followed
>   by fewer than eight spaces.
>
> Presumably this will be no more difficult for people editing configure
> than for people editing the C and C++ code.

LGTM. 

Tomi


> ---
>  configure | 136 +++---
>  1 file changed, 68 insertions(+), 68 deletions(-)
>
> diff --git a/configure b/configure
> index e2d40d11..6c3a38f1 100755
> --- a/configure
> +++ b/configure
> @@ -496,16 +496,16 @@ int main () {
>  }
>  EOF
>  if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XX"); then
> -printf 'No.\nCould not make tempdir for testing session-key 
> support.\n'
> -errors=$((errors + 1))
> + printf 'No.\nCould not make tempdir for testing session-key support.\n'
> + errors=$((errors + 1))
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


  1   2   3   4   5   6   7   8   9   10   >