From: Alexander Baier <lexi.baier@gmail.com>
To: ding@gnus.org
Subject: Re: nnir notmuch backend and the string-match function
Date: Thu, 28 Nov 2013 00:33:26 +0100 [thread overview]
Message-ID: <87d2llxvw9.fsf@gmail.com> (raw)
In-Reply-To: <87fvqh4mmk.fsf@gmail.com> (Alexander Baier's message of "Wed, 27 Nov 2013 21:26:27 +0100")
Hello again,
On 13-11-27 21:26 Alexander Baier wrote:
> Hello,
>
> I am currently trying to set up maildir search while using notmuch as a
> nnir backend. So far, however, this has not been very successful.
>
> Issuing a search using "G G" on a nnmaildir group presents me with the
> following error message:
>
> "Unknown header type nil while requesting articles of
> group nnmaildir+gmail:gmail.Inbox"
>
> So I started digging around in nnir.el and came across a very strange
> bug I can't explain. In the function `nnir-compose-result' there is
> the following expression:
>
> #+begin_src emacs-lisp
> (when (string-match (concat "^" prefix) dirnam)
> (setq dirnam (replace-match "" t t dirnam)))
> #+end_src
>
> I stepped through this code with edebug and was very confused:
> The value of dirnam is "/home/delexi/Mail/gmail/Inbox/cur/" and the value of
> prefix is "/home/delexi/Mail/". To my surprise `string-match' did not
> match anything! This of course leads to errors in the code following
> this snippet. I tried this snippet in my scratch buffer and everything
> worked fine (it matched the prefix correctly).
>
> How is this possible? Is there something about string-match I am
> missing? How is it possible, that this does not match anything?
>
> #+begin_src emacs-lisp
> (string-match "^/home/delexi/Mail/"
> "/home/delexi/Mail/gmail/Inbox/cur/")
> #+end_src
>
> Thanks in advance,
I tested this a bit more and found out that edebug apparently alters
match-data in some way which in turn alters the programs execution
depending on whether I am currently debugging or not.
#+begin_src emacs-lisp
(when (string-match (concat "^" prefix) dirnam)
(message "%s" (match-data)) ;; this was added
(setq dirnam (replace-match "" t t dirnam)))
#+end_src
Executing the code with the modified piece above and without edebug
prints the right match-data. So this explains the weird matching
behavior. Is this a bug in edebug, or is this some unavoidable
restriction?
Regards,
--
Alexander Baier
next prev parent reply other threads:[~2013-11-27 23:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-27 20:26 Alexander Baier
2013-11-27 23:33 ` Alexander Baier [this message]
2013-12-26 16:23 ` Lars Ingebrigtsen
2013-12-28 12:35 ` Alexander Baier
2014-01-30 0:31 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d2llxvw9.fsf@gmail.com \
--to=lexi.baier@gmail.com \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).