From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id eO79IiSlcGIPKwAAbAwnHQ (envelope-from ) for ; Tue, 03 May 2022 05:44:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IDPuIiSlcGIGcwAA9RJhRA (envelope-from ) for ; Tue, 03 May 2022 05:44:36 +0200 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 D3A843712A for ; Tue, 3 May 2022 05:44:32 +0200 (CEST) Received: from localhost ([::1]:46462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nljSh-00070i-9q for larch@yhetil.org; Mon, 02 May 2022 23:44:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nljRt-0006yu-Ku for emacs-orgmode@gnu.org; Mon, 02 May 2022 23:43:41 -0400 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:39676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nljRr-0008CA-Tb for emacs-orgmode@gnu.org; Mon, 02 May 2022 23:43:41 -0400 Received: by mail-qk1-x730.google.com with SMTP id b20so10247958qkc.6 for ; Mon, 02 May 2022 20:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=rasAUueSZ210OcJhfCD+TSQYXADosvaWablq/VXI7lM=; b=CMtaNaTg39mLTBSjkXaVWbtx2ximA0zlXpX6knd9k6f+9b8vyHeyL0+cpINptDB08I xQoY9hhVbkVKw7yuzJMEKiJZncky6Dl3t27kfKh3wrppYXNMwSGDUc0FjlY08/E7fE5B ZDCQV70vnHRWVIrYmlWsbZ5MT04ZFjGWUzYpGCVCil+0cF3n96yehrGBxq+uhaDPDwE/ Ci60yWlzHzic4FDqZZi+CQ0jlPP48NAseAaGVZmyEM7NMrO7Fih9LfI/XhOXfOb3wxxZ G/GxtQ9BqBzGjsb1TIFMRXUWQ313nCdcQAwVV21Rht1VH59xsVZkUMQE5z/hWKmVi53s yUpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=rasAUueSZ210OcJhfCD+TSQYXADosvaWablq/VXI7lM=; b=i940FSUYsQwDaGAgLxAb8sFc+wntYbw3jOVX9mzDH6fmDXSSRUrCvgJyyjZvdowAt9 nyfc+ZmqoIWe332J/g/Ya5IwxlNSkSJMtqq67d0o/5jLKzsULQVMntJheBqSplSdASbI gNGzpsQtabkyKgA8aDuTby/+IYHULV87dyMUhkC+o9yGDvsD5vZK1bmkWONPqTlFLF9F bj+Xc0d4wWTdj8+4YCud5qy69weTnECpmXvXd8P5S+pl6OvibCKAWNG1IXqVMVwabVhS bElJJ3rxEdimhP+N3r0bKiRW5KUiN1jCPSc63naQ0htHsWPBxSReNFN98yTi6Wz3MON6 DNdA== X-Gm-Message-State: AOAM533WX6gx0NtUHvhF77eqrHZdy49oK6/2fxepK3CizgqWFljBQcvx HPBC8eeJB6eCdc/95qRDXOQ= X-Google-Smtp-Source: ABdhPJxqRrHCmH8yigZoh2C1HZIMsro8c3VmQgP6uXC5WlT9KK/ohFqt0MtMt31G5PUY7ctO90lASA== X-Received: by 2002:a37:55c7:0:b0:69b:f3fd:4fde with SMTP id j190-20020a3755c7000000b0069bf3fd4fdemr10906429qkb.101.1651549418845; Mon, 02 May 2022 20:43:38 -0700 (PDT) Received: from localhost (22.b2.a86c.ip4.static.sl-reverse.com. [108.168.178.34]) by smtp.gmail.com with ESMTPSA id z13-20020ac875cd000000b002f39b99f6a1sm5188640qtq.59.2022.05.02.20.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 20:43:38 -0700 (PDT) From: Ihor Radchenko To: Phil Hudson Cc: emacs orgmode-mailinglist Subject: [PATCH] Re: [BUG] org-element-map doco should refer to org-element-parse-buffer [9.5.2 (9.5.2-gfbff08 @ /home/phil/.emacs.d/elpa/org-9.5.2/)] In-Reply-To: References: Date: Tue, 03 May 2022 11:44:25 +0800 Message-ID: <87ee1bgu06.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::730; envelope-from=yantar92@gmail.com; helo=mail-qk1-x730.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651549473; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=rasAUueSZ210OcJhfCD+TSQYXADosvaWablq/VXI7lM=; b=hzftyTo3nLaFYUlHwWn5+t8/4LcT9r2417VD2uRkmFLnZElbzgBPTIeZv085lee6mw4xp6 LnlF7lQa/wcYoVHKBDMigrkJwXmX1PyXkMmCUcah9mBSeeavCNTzIq9Keo25T4NTWT5BI/ V5ezMXq4PB/tcxZVjSYHB+hbZIQr6MIbnoik9ckBjm5f8Qovo4jR5iGAyZhEv1Sr4RoEfE ts38z2ZEoMzJTjy2jZJrhS7smFahcXJEg/LTT4JAMEM9gmUpJ8B+tRWLoWyI4jJVJK1CLN uyHP9CferAMZKfDoFkxcvx6tt5y3mbGJyl+xNNeD1DEvn6OnCwstAeht5zPhUw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651549473; a=rsa-sha256; cv=none; b=uTmfR9dXVfRufVWreXC8JAlSDwtAcgqdzgpDImqfgiQ2L8Yk882q//dKw8SGAEtrFs8ZxX Qtv2clrCHBZ6JORi5RdI7VjQ99/nsjMjx/fSFibwuk+2CJ4QWt/z43eW8GVSBiNLbwNUSC jw2WSyxehOQmf8+tlzsXvgvE84PoptPoWHIEFCM8T2/Oqh7+fUeF8lJFtn7DJg63KT9cSW 3pjhzqJDEf42pR0B1Caqb3fMgzMvjyX9KLNWmLvJmtvShGvIni7jvEu3EP14azBx+6Z6h+ HiGJZbtLXl2dmRoy3qk/Au9PLF7W0CZuYre70Is7qslnj6U8ms0A5iTGLi8YWg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CMtaNaTg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.28 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CMtaNaTg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D3A843712A X-Spam-Score: -3.28 X-Migadu-Scanner: scn0.migadu.com X-TUID: EmZR1sOzHPDo --=-=-= Content-Type: text/plain Phil Hudson writes: > The documentation for function `org-element-parse-buffer' helpfully > directs the user to that of function `org-element-map', but the > documentation for the latter makes no mention of > `org-element-parse-buffer'. It contains lengthy and helpful explanations > of what to do with its `data' parameter, but no hint as to how to obtain > that data. Sounds reasonable. Will something like the attached do? Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-element-map-Refer-to-org-element-parse-buffer-in.patch >From 6041817f426aa0976f557f4c108203b8eed37ac1 Mon Sep 17 00:00:00 2001 Message-Id: <6041817f426aa0976f557f4c108203b8eed37ac1.1651549348.git.yantar92@gmail.com> From: Ihor Radchenko Date: Tue, 3 May 2022 11:40:26 +0800 Subject: [PATCH] org-element-map: Refer to `org-element-parse-buffer' in the docstring * lisp/org-element.el (org-element-map): Update docstring. Mention that parse tree can be obtained using `org-element-parse-buffer'. Add an example. --- lisp/org-element.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 3856079aa..4be345001 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4524,12 +4524,12 @@ (defun org-element-map (data types fun &optional info first-match no-recursion with-affiliated) "Map a function on selected elements or objects. -DATA is a parse tree, an element, an object, a string, or a list -of such constructs. TYPES is a symbol or list of symbols of -elements or objects types (see `org-element-all-elements' and -`org-element-all-objects' for a complete list of types). FUN is -the function called on the matching element or object. It has to -accept one argument: the element or object itself. +DATA is a parse tree (e.g. returned by `org-element-parse-buffer'), an element, +an object, a string, or a list of such constructs. TYPES is a symbol +or list of symbols of elements or objects types (see `org-element-all-elements' +and `org-element-all-objects' for a complete list of types). FUN is the function +called on the matching element or object. It has to accept one +argument: the element or object itself. When optional argument INFO is non-nil, it should be a plist holding export options. In that case, parts of the parse tree @@ -4557,6 +4557,7 @@ (defun org-element-map the following example will return a flat list of all `src-block' and `example-block' elements in it: + (setq tree (org-element-parse-buffer)) (org-element-map tree \\='(example-block src-block) #\\='identity) The following snippet will find the first headline with a level -- 2.35.1 --=-=-=--