Gnus development mailing list
 help / color / mirror / Atom feed
* nnir notmuch backend and the string-match function
@ 2013-11-27 20:26 Alexander Baier
  2013-11-27 23:33 ` Alexander Baier
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Baier @ 2013-11-27 20:26 UTC (permalink / raw)
  To: ding

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,
-- 
 Alexander Baier



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nnir notmuch backend and the string-match function
  2013-11-27 20:26 nnir notmuch backend and the string-match function Alexander Baier
@ 2013-11-27 23:33 ` Alexander Baier
  2013-12-26 16:23   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Baier @ 2013-11-27 23:33 UTC (permalink / raw)
  To: ding

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nnir notmuch backend and the string-match function
  2013-11-27 23:33 ` Alexander Baier
@ 2013-12-26 16:23   ` Lars Ingebrigtsen
  2013-12-28 12:35     ` Alexander Baier
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2013-12-26 16:23 UTC (permalink / raw)
  To: ding

Alexander Baier <lexi.baier@gmail.com> writes:

> 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?

It sounds like a bug in edebug.  I haven't seen edebug doing anything
like that -- it seems to work fine for me with stuff like that.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nnir notmuch backend and the string-match function
  2013-12-26 16:23   ` Lars Ingebrigtsen
@ 2013-12-28 12:35     ` Alexander Baier
  2014-01-30  0:31       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Baier @ 2013-12-28 12:35 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: ding

On 2013-12-26 17:23 Lars Ingebrigtsen wrote:
> Alexander Baier <lexi.baier@gmail.com> writes:
>
>> 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?
>
> It sounds like a bug in edebug.  I haven't seen edebug doing anything
> like that -- it seems to work fine for me with stuff like that.

I am still using Emacs 24.3, do you use the current trunk by any chance?
I might have been fixed there.

Regards,
-- 
 Alexander Baier



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nnir notmuch backend and the string-match function
  2013-12-28 12:35     ` Alexander Baier
@ 2014-01-30  0:31       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2014-01-30  0:31 UTC (permalink / raw)
  To: ding

Alexander Baier <lexi.baier@gmail.com> writes:

> I am still using Emacs 24.3, do you use the current trunk by any chance?
> I might have been fixed there.

Yeah, I use the current trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-30  0:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-27 20:26 nnir notmuch backend and the string-match function Alexander Baier
2013-11-27 23:33 ` Alexander Baier
2013-12-26 16:23   ` Lars Ingebrigtsen
2013-12-28 12:35     ` Alexander Baier
2014-01-30  0:31       ` Lars Ingebrigtsen

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).