Re: sexp and strings

2022-07-01 Thread David Bremner
David Bremner  writes:

>
> Although you have one too many sets of (), there is still a bug here.
>
>  $ notmuch config set squery.D '(macro (dossier) (tag (regex 
> ,dossier))'
>
> also doesn't work.  Apparently both for regex and wildcard expansion I
> did not do macro parameter expansion. In the regex case the regex
> matching for tags actually happens at query construction time, so that's
> why it ends up as an empty query (presumably none of your tags starts
> with ,dossier).
>
> Anyway, I think I know how to fix this, it will mean that in the corner
> case of a regex starting with a comma, we'll have to use (regex ",foo").

This bug should be fixed in master as of

 6a9ae990990848ec99107f2e2e6b6ae12dcd33df


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


Re: sexp and strings

2022-06-13 Thread David Bremner
erik colson  writes:

> Hi,
>
> I would like to define a squery in my notmuch configuration which would
> ease a query I often use.  The query is
>
>   tag:/d/
>
> where d are decimal numbers.
> Now I would like to shorten this to
>
>   D d
>
> wherefor I was thinking of using a macro like:
>
>   D=(macro (dossier) ((tag (regex ,dossier
>
> But this doesn't seem to do the job.
> Any ideas how I can achieve this ?
>

Although you have one too many sets of (), there is still a bug here.

 $ notmuch config set squery.D '(macro (dossier) (tag (regex ,dossier))'

also doesn't work.  Apparently both for regex and wildcard expansion I
did not do macro parameter expansion. In the regex case the regex
matching for tags actually happens at query construction time, so that's
why it ends up as an empty query (presumably none of your tags starts
with ,dossier).

Anyway, I think I know how to fix this, it will mean that in the corner
case of a regex starting with a comma, we'll have to use (regex ",foo").
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: sexp and strings

2022-06-13 Thread erik colson
Michael J Gruber  writes:

> (Until then there is copr mjg/notmuch-sfsexp at your own risk ;))

how could I possibly overlook that repo !
thanks a lot !!!
-- 
erik colson
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: sexp and strings

2022-06-13 Thread Michael J Gruber
Am Mo., 13. Juni 2022 um 11:31 Uhr schrieb erik colson :
>
> Michael J Gruber  writes:
>
> > That search works without the macro, but not as a macro: notmuch
> > computes an empty `Query()` for this (as per `NOTMUCH_DEBUG_QUERY=1`).
> > I'm not sure whether this is intended or an artefact of the
> > implementation, since both the macro and the regex need
> > expansion/evaluation before being fed to xapian, and the order
> > matters.
> >
> > Defining `D=(macro (dossier) ((tag ,dossier)))` and calling it with
> > `(D (rx d))` works, btw (but is not what you want, obviously), so
> > something tells me lazy evaluation of macros is not completely lazy ;)
>
> Thanks for checking this out Michael.  I decided to write an emacs lisp
> function which I keybind and which prompts for the variable, and then
> launches notmuch-search with that:
>
> (defun ec/notmuch-search-dossier ()
>   "Zoek mails van een dossier"
>   (interactive
>(let* ((dossier (read-no-blanks-input "Dossier:"))
>   (zoek (concat "tag:/" dossier "/")))
>   (notmuch-search zoek nil nil nil nil
>
> This works like a charm ;) Well, I am of course open to enhancement
> suggestions!
>
> Also I upgraded my OS to fedora36 and now I use the standard notmuch
> package instead of compiling it myself.  So I don't have sexp support
> anymore and therefor I am moving the squeries I added to my notmuch
> config into emacs lisp functions.

FYI: I submitted sfsexp to fedora (review pending), and as soon as
that is in, I will adjust the notmuch package.
(Until then there is copr mjg/notmuch-sfsexp at your own risk ;))

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


Re: sexp and strings

2022-06-13 Thread erik colson
Michael J Gruber  writes:

> That search works without the macro, but not as a macro: notmuch
> computes an empty `Query()` for this (as per `NOTMUCH_DEBUG_QUERY=1`).
> I'm not sure whether this is intended or an artefact of the
> implementation, since both the macro and the regex need
> expansion/evaluation before being fed to xapian, and the order
> matters.
>
> Defining `D=(macro (dossier) ((tag ,dossier)))` and calling it with
> `(D (rx d))` works, btw (but is not what you want, obviously), so
> something tells me lazy evaluation of macros is not completely lazy ;)

Thanks for checking this out Michael.  I decided to write an emacs lisp
function which I keybind and which prompts for the variable, and then
launches notmuch-search with that:

(defun ec/notmuch-search-dossier ()
  "Zoek mails van een dossier"
  (interactive
   (let* ((dossier (read-no-blanks-input "Dossier:"))
  (zoek (concat "tag:/" dossier "/")))
  (notmuch-search zoek nil nil nil nil

This works like a charm ;) Well, I am of course open to enhancement
suggestions!

Also I upgraded my OS to fedora36 and now I use the standard notmuch
package instead of compiling it myself.  So I don't have sexp support
anymore and therefor I am moving the squeries I added to my notmuch
config into emacs lisp functions.

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


Re: sexp and strings

2022-06-13 Thread Michael J Gruber
Am Mo., 13. Juni 2022 um 01:20 Uhr schrieb erik colson :
>
> Hi,
>
> I would like to define a squery in my notmuch configuration which would
> ease a query I often use.  The query is
>
>   tag:/d/
>
> where d are decimal numbers.
> Now I would like to shorten this to
>
>   D d
>
> wherefor I was thinking of using a macro like:
>
>   D=(macro (dossier) ((tag (regex ,dossier
>
> But this doesn't seem to do the job.
> Any ideas how I can achieve this ?

That search works without the macro, but not as a macro: notmuch
computes an empty `Query()` for this (as per `NOTMUCH_DEBUG_QUERY=1`).
I'm not sure whether this is intended or an artefact of the
implementation, since both the macro and the regex need
expansion/evaluation before being fed to xapian, and the order
matters.

Defining `D=(macro (dossier) ((tag ,dossier)))` and calling it with
`(D (rx d))` works, btw (but is not what you want, obviously), so
something tells me lazy evaluation of macros is not completely lazy ;)

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


sexp and strings

2022-06-12 Thread erik colson
Hi,

I would like to define a squery in my notmuch configuration which would
ease a query I often use.  The query is

  tag:/d/

where d are decimal numbers.
Now I would like to shorten this to

  D d

wherefor I was thinking of using a macro like:

  D=(macro (dossier) ((tag (regex ,dossier

But this doesn't seem to do the job.
Any ideas how I can achieve this ?

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