From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id qLvkFt8DYl9vQAAA0tVLHw (envelope-from ) for ; Wed, 16 Sep 2020 12:23:59 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id QNytEt8DYl9GCAAAbx9fmQ (envelope-from ) for ; Wed, 16 Sep 2020 12:23:59 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AE3169403C6 for ; Wed, 16 Sep 2020 12:23:58 +0000 (UTC) Received: from localhost ([::1]:44896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIWTd-00071o-CA for larch@yhetil.org; Wed, 16 Sep 2020 08:23:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIWQS-0004ZG-1q for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 08:20:40 -0400 Received: from mail.tuxteam.de ([5.199.139.25]:47573) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1kIWQL-0004Jg-Mq for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 08:20:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=u2Lkr4XVJQgPl2jyKxJT7SuCQBc7nzfN9AHVwYful1E=; b=k8pJ0MUKGM/ISFtxcsZVYTAE+Z2UEDJsGVg+5hB364eEJ2/YRA6MOG8RcQwdk0gw4Y3szzNDjL/SZE28R9uATXnLNY40Jsw8btkWFtepBwy7hbbQNPkfnJRBfIR+T8QOvlGhYmeL6mkox4KR2++89xs9AaKWgn+wX8rL+KKumAtS0VHbnJg7WWhf83fbuEHMl923QhvYh379D5wd4iibSxsioNfMRDGEmLOTP4Zp2PudNnjJTNLn8kJz+o2QswGQ0slhd8jhukufZuhhcqMqgrCUpAvDaozH5c51OxfRIYY05mtOL6XsgkJrprsfB5XIkaBRAAp5Ty7TauYjjbL+Fg==; Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1kIWQI-0005yg-A6 for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 14:20:30 +0200 Date: Wed, 16 Sep 2020 14:20:30 +0200 To: emacs-orgmode@gnu.org Subject: Re: official orgmode parser Message-ID: <20200916122030.GE13405@tuxteam.de> References: <68dc1ea1-52e8-7d9e-fb2d-bcf08c111eca@intrepidus.pl> <87d02n2yyr.fsf@gmail.com> <482cea5c-4214-57ac-dfeb-1e305180fee5@intrepidus.pl> <20200915095548.GP20869@maokai> <20200915123722.GA20532@tuxteam.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Uwl7UQhJk99r8jnw" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/16 02:54:14 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=tuxteam.de header.s=mail header.b=k8pJ0MUK; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -3.31 X-TUID: FMWbV8EyhcgK --Uwl7UQhJk99r8jnw Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 16, 2020 at 02:09:42PM +0200, Przemys=C5=82aw Kami=C5=84ski wro= te: [...] > So I looked at (pp (org-element-parse-buffer)) however it does print > out recursive stuff which other schemes have trouble parsing. >=20 > My code looks more or less like this: >=20 > (defun org-parse (f) > (with-temp-buffer > (find-file f) > (let* ((parsed (org-element-parse-buffer)) > (all (append org-element-all-elements org-element-all-objects)) > (mapped (org-element-map parsed all > (lambda (item) > (strip-parent item))))) > (pp mapped)))) Actually I'd tend to not modify the result, but to walk it. See `pcase' for a powerful pattern matcher which might help you there. Cheers - t --Uwl7UQhJk99r8jnw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl9iAw4ACgkQBcgs9XrR2kbMTQCeO0fWslYEnzfAiHQ7/fQbr78q eQYAn1CmmCZqNRs7sWGO6b0Qwj0l4Jbj =fs0D -----END PGP SIGNATURE----- --Uwl7UQhJk99r8jnw--