From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: How to find the headline matching a string Date: Tue, 03 Jun 2014 22:21:11 +0200 Message-ID: <87ioohpww8.fsf@gmail.com> References: <87bnuedl38.fsf@ericabrahamsen.net> <87ha45r9hi.fsf@gmail.com> <874n05e0ls.fsf@ericabrahamsen.net> <87r436mkgb.fsf@gmail.com> <877g4y723u.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrvCK-0003xA-5s for emacs-orgmode@gnu.org; Tue, 03 Jun 2014 16:20:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrvCE-0006Rc-32 for emacs-orgmode@gnu.org; Tue, 03 Jun 2014 16:20:40 -0400 Received: from mail-we0-x232.google.com ([2a00:1450:400c:c03::232]:59200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrvCD-0006RR-SQ for emacs-orgmode@gnu.org; Tue, 03 Jun 2014 16:20:34 -0400 Received: by mail-we0-f178.google.com with SMTP id u56so7330743wes.37 for ; Tue, 03 Jun 2014 13:20:33 -0700 (PDT) In-Reply-To: <877g4y723u.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 03 Jun 2014 17:51:17 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Abrahamsen Cc: emacs-orgmode@gnu.org Hello, Eric Abrahamsen writes: > I guess it shouldn't be too surprising -- the org element stuff is > completely parsing the entire buffer on every pass. The other function > probably boils down to passing a few targeted regexps over the buffer. > I've sneakily cc'd Nicolas to see what he thinks. My guess is we could > replace the call to org-element-parse-buffer with something that > creates/accesses the cached version of the parse tree, and things would > go much more swiftly. I didn't look closely into the issue, but I think the main reason is that Element parses headlines thoroughly, including all properties, scheduled keywords, which is not, by default, the case for `org-map-entries'. For most use-cases, you don't need the parser for headlines, as their grammar is context free. IOW, `org-element-parse-buffer' doesn't predate `org-map-entries'. Regards, -- Nicolas Goaziou