From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 iFlMIkvcUGO1OAEAbAwnHQ (envelope-from ) for ; Thu, 20 Oct 2022 07:27:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WMxPIkvcUGOUZgAAauVa8A (envelope-from ) for ; Thu, 20 Oct 2022 07:27:39 +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 4F9C646384 for ; Thu, 20 Oct 2022 07:27:39 +0200 (CEST) Received: from localhost ([::1]:49296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olO5i-0004GG-Hb for larch@yhetil.org; Thu, 20 Oct 2022 01:27:38 -0400 Received: from [::1] (port=52746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olO5g-00034C-ON for larch@yhetil.org; Thu, 20 Oct 2022 01:27:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olO57-00032X-UW for emacs-orgmode@gnu.org; Thu, 20 Oct 2022 01:27:01 -0400 Received: from mout01.posteo.de ([185.67.36.65]:33675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olO56-0007Zn-8h for emacs-orgmode@gnu.org; Thu, 20 Oct 2022 01:27:01 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 11B64240026 for ; Thu, 20 Oct 2022 07:26:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1666243618; bh=5NJwJmg1QJwb8FXSd6n5o8oNLIBCmbHgdVIzft9w7To=; h=From:To:Cc:Subject:Date:From; b=TeKA5cXVcbV2nCk4TBgj/gYvrx+rvc3mUvSUCuC95vi7lIsxPYk4J+IMcCcpm8Qod aaJ/FxAPVc5ARunM7jafYMvm6O39XTPFuAOs9Zcin4k0W0SsryAukzWbmfI7UFZqgl zPQca6JReMtZtZjK0NKEBGAEH/z2WHpPaoFQRLbWsQjUr0Lwa8QVUqL14B+Z6ZGKVr cMrZvqDyEwVc+gnrFXjMBgCUMZn5dgQFmqL5+yRzqARZPCKp0qpfYDXiBTSmFOAp71 SXIQbAWdnlYQiiqcSH+iLN49VTFbMG1rOkGe+rM/T0qCAGaueZNIx4JMjUutdYgG4B vDVlGZw1CyRJA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MtGLS5QHLz6tnF; Thu, 20 Oct 2022 07:26:56 +0200 (CEST) From: Ihor Radchenko To: Damien Cassou Cc: emacs-orgmode@gnu.org Subject: Re: Weird behavior of org-element-object-lex In-Reply-To: <87fsfjd3ds.fsf@cassou.me> References: <87fsfjd3ds.fsf@cassou.me> Date: Thu, 20 Oct 2022 05:27:41 +0000 Message-ID: <87v8of83oy.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de 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, RCVD_IN_DNSWL_NONE=-0.0001, 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.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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666243659; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=G9HADOZMaPXegPuPqQ62Dtw0AKwFl86qR+0LByl52jk=; b=N0m3qhXhUc60A77nfm96/oHR991BA1h9U4q2m9+tssrQu2TAA0jY30Ij30HvLwWo+ora7l /64M/PUJS2yCyfPGYxAGySoW6CptxvvKgEvFWtQSMty7zPta76iy/WZFf6840gRBQ5PorI sm/ZwYcXO7QIcCnh93UTyRhym4MydBvIsmwbVbSbUXjoJvJbwS6YDvMZUtDUdOFA0vwcCO jXPzGdIDx6Dc8ZBfPQscf3RC6/wy7eb6uUVNBP2BmKK8x3kX85NnOEuXq/1WyVtms1xHip e5tKQU092DG5ikf+d8b8uuvlhG4a5K3QGkosFrfMfI55KIqQCQ8fURWYvKcWiA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666243659; a=rsa-sha256; cv=none; b=SCV79xBgbbBOFp+PFUIYR2pwBsSBjrdibENs46XV/XY8Q3T9QY14EcUYNH5tm1MukMFYH6 DKYVkQj1eMggnjP+1tVxs4V/Do3IzUFkYvWcWfjyUNhCVEeyUBjCFTRIx4UrAoIBK/9Pme fGpLE11fL4fEAdQaeZDZyyq0KWn2vnuY4ofc4HtJd3zZ/1FmxXkdbaLzQj8RjOEACR1VJa ly6iafe62ZG8vksE8p1350bSea2F9zdCR9c01WVUKRPV9tEFRkPIKvkaE8Nx7GIaqj+zis hFnwEJh/rLJ5Eh6yxNpgdhBl6e9DsqHsb2hMVbSRkEYWUGSGHuWjPjANSm0v6Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=TeKA5cXV; dmarc=pass (policy=none) header.from=posteo.net; 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: -1.93 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=TeKA5cXV; dmarc=pass (policy=none) header.from=posteo.net; 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: 4F9C646384 X-Spam-Score: -1.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: /5xY/IBLY7bm Damien Cassou writes: > here is the beginning of `org-element-object-lex`: > > (defun org-element--object-lex (restriction) > "Return next object in current buffer or nil. > RESTRICTION is a list of object types, as symbols, that should be > looked after. This function assumes that the buffer is narrowed > to an appropriate container (e.g., a paragraph)." > (cond > ((memq 'table-cell restriction) (org-element-table-cell-parser)) > ((memq 'citation-reference restriction) > (org-element-citation-reference-parser)) > (t =E2=80=A6))) > > From what I understand, if `restriction` includes 'table-cell (or > 'citation-reference), and if the content isn't a table-cell, > `org-element--object-lex` will immediately return nil without trying > other object types. > > Is that a bug? Not really. table-cell and citation-reference do not have a regexp signature and are handled specially. For these two types of objects, org-element--object-lex is called only when the parent is a table-row or citation object. Not very elegant, but it is internal function, and it works :) --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at