[PATCH 0/2] Escape message ID queries in Emacs
Austin Clements
amdragon at MIT.EDU
Tue Mar 27 00:01:52 PDT 2012
On Tue, 27 Mar 2012, Tomi Ollila <tomi.ollila at iki.fi> wrote:
> On Tue, Mar 27 2012, Austin Clements wrote:
>
>> Currently, Emacs does not escape message ID queries and is
>> inconsistent about quoting them. This patch centralizes this in one
>> function that always produces a properly quoted and escaped message ID
>> query.
>>
>> With this, Emacs no longer gets confused by Tomi's crazy message,
>> id:"id:""1332281811-24710-2b-git-send-email-tomi.ollila at iki.fi"""
>
> LGTM. Things work!
>
>
> One observation, though:
>
> In search bar the following queries return one match:
>
> id:id:"1332281811-24710-2b-git-send-email-tomi.ollila at iki.fi"
> id:"id:""1332281811-24710-2b-git-send-email-tomi.ollila at iki.fi"""
>
> but
>
> id:"id:"1332281811-24710-2b-git-send-email-tomi.ollila at iki.fi""
>
> return 0 matches.
>
> It looks like the (above) search strings goes verbatim to command line
>
> i.e. 'notmuch' 'search' '--sort=oldest-first' 'id:...'
>
> can be used to compare... so that would be CLI issue if there
> is ever need to do do anything with it.
I'm not sure I would consider this a CLI "issue". It may not be
intuitive, but it is an intentional part of the Xapian query parser's
grammar. If a boolean prefix is followed immediately by a quote, then
the term is between that quote and the next quote, modulo an escaping
rule that lets you include a literal quote in the term by doubling it in
the query string. Together, these rules let you reliably put anything
in a boolean search term.
> +1
>
> Thanks for fixing this.
>
> Tomi
More information about the notmuch
mailing list