From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83927 Path: news.gmane.org!not-for-mail From: Alexander Baier Newsgroups: gmane.emacs.gnus.general Subject: Re: nnir notmuch backend and the string-match function Date: Thu, 28 Nov 2013 00:33:26 +0100 Message-ID: <87d2llxvw9.fsf@gmail.com> References: <87fvqh4mmk.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1385595273 395 80.91.229.3 (27 Nov 2013 23:34:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Nov 2013 23:34:33 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M32182@lists.math.uh.edu Thu Nov 28 00:34:37 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vloct-0004gB-Rg for ding-account@gmane.org; Thu, 28 Nov 2013 00:34:36 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1VlocD-0007SR-9q; Wed, 27 Nov 2013 17:33:53 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1VlocC-0007SI-3W for ding@lists.math.uh.edu; Wed, 27 Nov 2013 17:33:52 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1VlocA-0001mI-Sp for ding@lists.math.uh.edu; Wed, 27 Nov 2013 17:33:51 -0600 Original-Received: from mail-ea0-f178.google.com ([209.85.215.178]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1Vloc9-00035Q-EU for ding@gnus.org; Thu, 28 Nov 2013 00:33:49 +0100 Original-Received: by mail-ea0-f178.google.com with SMTP id d10so5157289eaj.23 for ; Wed, 27 Nov 2013 15:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:mail-followup-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=u7A/qO67ZGEshgM8MohsBnAgH9gTxuFZtV4yx41Vh+4=; b=swe3bhBBbGABWgBAG+FyGD9JSnAScDw+FwfJnqY9Q/HoxHJxdS2BQ4jE6UdIcnXgR4 Vvg43SB2kWF1QOo2cXgdFy2stM7WmCbFn5F+N/1hXBboNgEqd4wEgSQXzUT1K5CHujmZ HmRRyAvYErtiL+cQZquHnIrIyDKqfGF+hw0vWpTkWrB3+I64k43xlHJKE0p88BbdljpQ 4KCZ9AOSsTXr+IkcdmlIqV/X30jAruBaatTFEo2ZQ6M5emeyv4lSaM8aCetkqO5QpRFQ L7FF49m9+sK9Imu7+lYPOweO38DkDr0iEreEJsosEay3iy2nRNkaK492Lef0D0PHUKbz qKBQ== X-Received: by 10.15.65.11 with SMTP id p11mr3401381eex.58.1385595224120; Wed, 27 Nov 2013 15:33:44 -0800 (PST) Original-Received: from T420s (nat-wh-wh36.rz.uni-karlsruhe.de. [141.70.81.154]) by mx.google.com with ESMTPSA id c46sm11534365eep.17.2013.11.27.15.33.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2013 15:33:43 -0800 (PST) Mail-Followup-To: ding@gnus.org In-Reply-To: <87fvqh4mmk.fsf@gmail.com> (Alexander Baier's message of "Wed, 27 Nov 2013 21:26:27 +0100") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) X-Spam-Score: -3.0 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83927 Archived-At: 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