Discussion:
Message-ID with "+" in
Ben Fitzgerald
2018-09-30 18:48:55 UTC
Permalink
Hi,

I'm trying to have org-mode store a folder and Message-ID so that
I can then have a function that will cause mutt to lookup the
message.

Works okay so far, except when I hit a message with "+" in, for
example:

CAJxp15h8mE6UcYStOyUzH_T490X+hOq5dTo+***@mail.gmail.com

Here when mutt is given:

/ ~i CAJxp15h8mE6UcYStOyUzH_T490X+hOq5dTo+***@mail.gmail.com

Lookup fails. Simple attempts to work around this such as enclosing the
Message-ID in single/double quotes, escaping the "+" as below has no effect:

/ ~i "CAJxpU5h8mE6UcYStOyUzH_T490R\+hOp5dTo\+***@mail.gmail.com"

Probably this is fairly simple, but I'm stuck. Would appreciate advice.

Regards,
--
Ben Fitzgerald
Kevin J. McCarthy
2018-09-30 19:30:15 UTC
Permalink
Try doubling the \:
/ ~i "CAJxpU5h8mE6UcYStOyUzH_T490R\\+hOp5dTo\\+***@mail.gmail.com"
--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
Ben Fitzgerald
2018-09-30 20:40:06 UTC
Permalink
thanks Kevin, this worked. FYI I also had to escape = with a single slash.

So Message-ID

CAJ=12345+6789 => CAJ\=12345\\+6789


Regads,
--
Ben Fitzgerald
Nathan Stratton Treadway
2018-10-01 03:39:53 UTC
Permalink
Post by Ben Fitzgerald
Works okay so far, except when I hit a message with "+" in, for
Lookup fails. Simple attempts to work around this such as enclosing the
Probably this is fairly simple, but I'm stuck. Would appreciate advice.
The key thing to remember is that the parsing of the string typed into
the search prompt "uses up" one level of escaping (unless the argument
is inside a single-quote string), and the regular expression itself
uses another level. So, if you are trying to use a backslash to escape
the "+" in the regular expression, you have to make sure a backslash
survives the parsing step and is included in the regex -- or, you can
instead get the "+" to match using a different sort of "escaping"....

So, (assuming I have cut-and-pasted and counted correctly), the
following should all find the message in question:
/ ~i CAJxpU5h8mE6UcYStOyUzH_T490R\\+hOp5dTo\\+***@mail.gmail.com
/ ~i "CAJxpU5h8mE6UcYStOyUzH_T490R\\+hOp5dTo\\+***@mail.gmail.com"
/ ~i 'CAJxpU5h8mE6UcYStOyUzH_T490R\+hOp5dTo\+***@mail.gmail.com'
/ ~i CAJxpU5h8mE6UcYStOyUzH_T490R[+]hOp5dTo[+]***@mail.gmail.com
/ ~i ***@mail.gmail.com

(Note that of course the final option will match any character in those
specific positions, rather than only matching a "+" character.)

Hope that makes sense.

Nathan
Ben Fitzgerald
2018-10-01 23:25:46 UTC
Permalink
Post by Nathan Stratton Treadway
So, (assuming I have cut-and-pasted and counted correctly), the
(Note that of course the final option will match any character in those
specific positions, rather than only matching a "+" character.)
Hope that makes sense.
Thanks, crystal clear!
--
Ben Fitzgerald
Loading...