From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 8OAUHwk7JWZ2ZAAAqHPOHw:P1 (envelope-from ) for ; Sun, 21 Apr 2024 18:12:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 8OAUHwk7JWZ2ZAAAqHPOHw (envelope-from ) for ; Sun, 21 Apr 2024 18:12:57 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=h96EVzxZ; dmarc=pass (policy=none) header.from=outlook.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"; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713715977; 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=z9/XJNwfuaao1FbUULAESeI8rgkXaI6OAy3adm9xKYc=; b=oaHB2HcxBe99OHX6//SJ5RN2JSnSLDXaG0KcN2sZLAZQdqgB65UsiF110NXRzgX1NX8SNY yjvO78XZ8p9/QEaTnUD8msJ8ABtWHwysPtk8/JHHxx0WY7Qs3VeJUuegjsWF72xCT7uBE7 5xdCByFMYfiyO+RSHRzobra0c2smlllFYnrPQzprt/jzJSLj76aZ8XT4oqmvb6Cul6DGbm u54RWBE1ii4eRqEwbzmV4csLgTVi12m/W4qXTBts9LNmmDqzYsg6+EeOWtLV6TOQTrYOHH iE1TauVqLC+IY+kd0feh9kTf+spSDBbCYfeU17/PEF33EXyrAYfVAggUMfj/4g== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=h96EVzxZ; dmarc=pass (policy=none) header.from=outlook.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"; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=key1; d=yhetil.org; t=1713715977; a=rsa-sha256; cv=pass; b=hER7cV5JuW3XHROElWzp/XvrTOsZLxTMnAfu0bVM8XfbWRlKoB/RjQjXYS7J+/psjvHaQi nJlEJRT7sERaOIcYjcINCPSt++3RBm/A5gjhTZu8m3vJita2ZIroe8lv84uKTvAgafeDdc CtMS3QgwVGnByULpC5zmtzBQ7G2t6T4kIRtVIdpbhDJYny4T/AcBEondwm99lmNdC2Mh0T BvHtMFJRvjDGhlDsCeeODSHmVY7+I/K9oHX9GbDPoJySxst2CWFkQNB4twLSB8zSC2QWii ICSmiR5KR5bgoOIqUz+rLprRz7nCL6s+Mc7gOY/qXSJWI8h7/Kvbl1yAThL0Iw== 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 409FDB622 for ; Sun, 21 Apr 2024 18:12:57 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryZnS-0008Uf-9k; Sun, 21 Apr 2024 12:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ryZnP-0008UO-Sl for emacs-orgmode@gnu.org; Sun, 21 Apr 2024 12:12:03 -0400 Received: from mail-dm6nam12olkn20800.outbound.protection.outlook.com ([2a01:111:f403:2c17::800] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ryZnN-0004n4-OC for emacs-orgmode@gnu.org; Sun, 21 Apr 2024 12:12:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lq81YFVfIB046KoukuUASI96A38/0k00Wxi1QQ7KViJAxkFq6mmGw/eq/4Gs08gI5FU2HWjc5RVvcoWUs3tkLHRcNiXTNH5Xo+/X/cYg+4+4ES7BZn13sz3ec9SJjQbbO3DRR5fenNH88PF6edhUFztZnLj1nhKfN2RKKyyez5h+tZvBsDUP6sjJWggOdPDTO5XNw2b2mNiHSCWw3yMATcIP4Ks0Nsp+DL2f+8HqwibEq8ODPeyIAivmy8qLTP8Sfn8pZk/L7QUN0RLBhGJ3Rc853zC1tnBwcO4YbP1o1wOA0HxOi0o2RGyHwzIlOoXsLdQsAFnLAS6g6v6/q2Gsrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z9/XJNwfuaao1FbUULAESeI8rgkXaI6OAy3adm9xKYc=; b=JbVkWNacwvuw4btqkXDQDeElvvLpa7/kaSCfDA78540ufBYQO8Zur1hBloRl/pbinglZdpETFYtPTx/zyF+jN2DX1ZQJRqsZMJM3/HiAYpP+QDD+0vJiNWRqWyZQr0Y1Yl8SnYi7Wk9GhJbWNcgV+Gp1SMs1HkKoF66DUbKt6kRPr/lU0vU96vLj+n5bQ/vDN+D0wj/9knbWibxUZ+cjtFlAHpGMbZKCoAovNRWUglwrt0maJliG3W++B8p5f4hj1RcFRQzh4NSypJL5a1JFIUvd3tdc3frxrBwW8CAMEMlDx7U7n0slrAKN614Pl1r28J4kwg3zOvALS4mqVbwYEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z9/XJNwfuaao1FbUULAESeI8rgkXaI6OAy3adm9xKYc=; b=h96EVzxZnNRWjz+ydbwJC5htmPncW4ZXCWA4sg8J0RPaneyMjew5asDKALy2xZzvBJOijjM1OIU9OdkyKjISAj06EG7+troTEDsuBrzTdDCqb/OWSj2EpMhbIeze1MhqvxhuFChb5/Aa4hOqlz9jJktCh74+Nx8xz8j9AGEMgPITMziZwkNt6vMFIm7hqmL7RR3CLzlyr9zmD4GnO1r+yJ184yKqUmlNlHpI75jPXNTUNmZZdR0st1tKEGdvN6q3gKd8zpXIrjMkguOM1/3Ij8pQZF48oLXKRR16cnniF6E+bN33RJ0o1/pYRWmoZfFecObiHjPKlgMo2k4ZWQ9tQA== Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) by CH3PR84MB3945.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1df::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.20; Sun, 21 Apr 2024 16:06:58 +0000 Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::178d:1518:8a49:2a45]) by CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::178d:1518:8a49:2a45%6]) with mapi id 15.20.7519.018; Sun, 21 Apr 2024 16:06:58 +0000 From: Morgan Smith To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: `org-element-cache-map' misses elements at end of buffer In-Reply-To: <875xwbq6mb.fsf@localhost> (Ihor Radchenko's message of "Sun, 21 Apr 2024 11:48:12 +0000") References: <875xwbq6mb.fsf@localhost> X-Hashcash: 1:20:240421:emacs-orgmode@gnu.org::O1oI5CIxiSskdJuR:2m4G X-Hashcash: 1:20:240421:yantar92@posteo.net::+snqupGfVTLRPCb9:9d97 Date: Sun, 21 Apr 2024 12:06:56 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Content-Type: multipart/mixed; boundary="=-=-=" X-TMN: [VPb+OJdrqpa1htlCcIE5kClnYPoigQOt0c1hyIlpUxI=] X-ClientProxiedBy: YQZPR01CA0089.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:84::9) To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) X-Microsoft-Original-Message-ID: <87plui1yzj.fsf@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR84MB3424:EE_|CH3PR84MB3945:EE_ X-MS-Office365-Filtering-Correlation-Id: bdbdff58-8503-4108-0577-08dc621d1217 X-Microsoft-Antispam: BCL:0; ARA:14566002|6092099003|461199019|440099019|3412199016; X-Microsoft-Antispam-Message-Info: ilN6WOOeFai4WuzMNxiVvihF55g0EXMpQdPSEREmr8AvBhBnmaFXJ+fi2DEu1xeXVEVgiJ+pp7G8Rl7+w+gSbiTFfWgybFxHKNMFPXFptvP/fv0WhfeASfq25AaPNyR51P/990zI9EDoOfXrC2gVh8+02SdoyFAzyUE3obueI/SLJpYx6HKUpo32wCF2+f5KvEu4T/sOn349v58y2Dyqlj3sERl0/PQzGSOxqp66Ssh9+bGCdS2pQuxOcq1eaU974JJ2UoP1QW2gT43CtLWXRIBgrW+/0gUEOykdWg6L5ZDF0rT75Q/n10FIr7tGgOqAaqbrqv0ZEeMQuco9PU+U6ywX+0r4tgO5b9g53mEEL1x5WhO5ZIdyL3zD1FyXUs7YCThTTcY83pWFihxgUdzbOxTHYSzuZkAc94i555zf+W5ppBPjZpMeBljgccoP19leDwF6YpQFMDQh7/+oBRmopgJQ/fiCHYkkYd9IjnavgkzYsNe1PIvPPNy3+cc7RkrRzMZT+ciIQnB5urltUNfPuHE+PyolaAMLKcnQm+K8A3mBvYWEMSDg5cUi9r/R7WvIjYApi1gjFS30DOlLCwd6BUzyUs6Oj+w9RE5jfFVi2gc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6SzEypVRVBMmv9Xn84PdRA186mjQ8noakhGWkqayARPpTIQ2FNhosmcwTAE5?= =?us-ascii?Q?JanyjLK0lxLOWvheHkeCy8UMIr6/N03mMnac9UOLyPMCblSPsxT1wuQFtg6U?= =?us-ascii?Q?+IDmVqlQMuSe/Dx0a9iNa8THsFrSQITd3McXV3nx5vdwGO332XKAvUhA0DyQ?= =?us-ascii?Q?Cr3UWq0J9pqczoDhJl8l/SGPYRLq82RYq91R7rqTHnXwkskUFDNFlAuIkbVZ?= =?us-ascii?Q?pjAV1vqQfbXOcMgSjHOdzbKwJIp5Opm87Ev3u+0w73g22mE3ldfImQaijwGc?= =?us-ascii?Q?BlU1XYlq6PdJ4HAQ7JhQ5/rk7m2L2RJTRGBWFiz+9p2tiNNvtpbIDAMQS113?= =?us-ascii?Q?p7xFqKfjl4EGbXamI1+6oewUvC93bCdAbGjNsIZsm8PvF0f8cfS0VG5GNYsy?= =?us-ascii?Q?jN9/3FaLeokqmDa8wPYarm9tMadckCAoCALKIbT+r/A8LgmJyMzCHitVoL74?= =?us-ascii?Q?Xo+CL8P86FJAVKJHlW7moHuFHFtt882D7ZX3GcqJgq/gagouNvem4Vbl0kwL?= =?us-ascii?Q?fGTmpmpGmUJQNOMZVMSi1d4u8V7HaebaORhq+exdzG5LwqYWUAxT/ti+Crof?= =?us-ascii?Q?Hm/0Mvjf3yDKh04NSxgP0W1qGPeD+VJGvzRO4LW5nZWd9lSZuucFW+7oAyx7?= =?us-ascii?Q?5fzAiKWOqZ6g8OsCxCdA/UCKWYhXZOF/xyDCIU5/AhoT1oYfXDgb6LP+XTq9?= =?us-ascii?Q?6o8iePF37V7iUEu4jl7dJXLa4s3vHRzEKgi/vrZ3B8Fkcb7qnSio15CWQQ+k?= =?us-ascii?Q?DCI2sf9Crwdd0MyaeAsMFs9Hdd1/zIleCBNuAyXfBXtaVF1Fw747UN6yNBVN?= =?us-ascii?Q?y4hiJZfNgp1yXrk+vTQpk/DFot/XMtXjT8ZOZMLFLLgGgLQ04bkTXHyHbygy?= =?us-ascii?Q?GLnGZiTnsRyu6ntX1mOYJKny0A6Yf2cuUkDWmNq4PcUDiEfMG82os8EsE52M?= =?us-ascii?Q?JLUGqay/TuLv8WsLCla7vo0ahn35OsxIqr8XVlH87Q/+0hFqvCwyE1kBTISs?= =?us-ascii?Q?pP+9aoDuht5ng2Os1J6XfoLqEmjBtq0rxOGZuceD/I94SWKqDNkfFDhsyO8i?= =?us-ascii?Q?sx7SN6fjvvBcrvRQYe6AjxdJBm2Wpq2feFP4QNT9G2P594FmldlLEypeDPMO?= =?us-ascii?Q?rDR2aBDxAhUj/VczyQoqqsmKvFoKqg5z/WMr62AUMRcOA3TYFrNT9uoRphxv?= =?us-ascii?Q?P7nnct6xKOULLesyn4unTrqR3nRC7CTp89BPZpsvy6rUbowoGX8lBVttSyPh?= =?us-ascii?Q?OmUtKfSmK7+m82NlHZfi?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdbdff58-8503-4108-0577-08dc621d1217 X-MS-Exchange-CrossTenant-AuthSource: CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2024 16:06:57.9741 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR84MB3945 Received-SPF: pass client-ip=2a01:111:f403:2c17::800; envelope-from=morgan.j.smith@outlook.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com 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, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.77 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -9.77 X-Migadu-Queue-Id: 409FDB622 X-TUID: w7GzA1V992P2 --=-=-= Content-Type: text/plain Ihor Radchenko writes: > > Hmm. :after-element keyword logic is broken. It does not account for the > case when :after-element is past the START point. > > It is the time to refactor this function yet again. > (a tricky endeavour considering all the edge cases we can encounter when > there are changes in buffer while `org-element-cache-map' is mapping > over it). See attached for a way to break :from-pos as well. I would like to help refactor but studying this function is a little dizzying for me. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-test-org-element-cache-map-Add-test-for-from-pos.patch >From eb37560b9c94bed6e91d6834462173d0a6d7d44b Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Fri, 19 Apr 2024 10:46:28 -0400 Subject: [PATCH] test-org-element/cache-map: Add test for :from-pos * testing/lisp/test-org-element.el (test-org-element/cache-map): Add test for :from-pos. --- testing/lisp/test-org-element.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index ad4ff1ce9..a0dbc726e 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -4994,7 +4994,21 @@ Text (equal '(org-data headline section drawer paragraph) (org-test-with-temp-text "* headline\n:DRAWER:\nparagraph\n:END:" - (org-element-cache-map #'car :granularity 'element))))) + (org-element-cache-map #'car :granularity 'element)))) + (should + (equal + ;; This fails returning '(paragraph paragraph) because it returns + ;; the paragraph under "headline". This is because at + ;; org-element.el:8028 we travel up the parents of drawer trying + ;; to find a paragraph. + '(paragraph) + (org-test-with-temp-text "* headline\nparagraph\n** subheading\n:DRAWER:\nparagraph\n:END:\n" + (let ((subheading (org-element-at-point))) + (org-element-cache-map + #'car + :granularity 'element + :restrict-elements '(paragraph) + :from-pos (org-element-contents-begin subheading))))))) (ert-deftest test-org-element/cache () "Test basic expectations and common pitfalls for cache." -- 2.41.0 --=-=-=--