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 aHpDFo1ZnmLoDQAAbAwnHQ (envelope-from ) for ; Mon, 06 Jun 2022 21:46:21 +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 ANk9Fo1ZnmIE4AAAauVa8A (envelope-from ) for ; Mon, 06 Jun 2022 21:46:21 +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 5EC793FD8E for ; Mon, 6 Jun 2022 21:46:17 +0200 (CEST) Received: from localhost ([::1]:46234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyIg4-0005xG-7d for larch@yhetil.org; Mon, 06 Jun 2022 15:46:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyIf0-0005x5-4D for emacs-orgmode@gnu.org; Mon, 06 Jun 2022 15:45:10 -0400 Received: from st43p00im-ztbu10063601.me.com ([17.58.63.174]:45008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyIew-0007hA-Qt for emacs-orgmode@gnu.org; Mon, 06 Jun 2022 15:45:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1654544703; bh=yWZpjXypQsCIm2WevLxnYisZjmnP2LcsIAdAbq8tulU=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=bujYaUewv14r13szPJPkvu3HPhlKeE/ZBuu2pQa+TmV0CLtLDDJTQkfamLZbfs/RS go/aDjy/qsFfuNnHuWTN9YAYKgUO/tZAOQFIYu2un3iiNQw6npGheKzDOCRXf097a3 mhS8vyQUmqeBANfcKzPFpY6hGIgsNm92fGfwGuEj0vsxO/XPDPYhcLoseENd7NcVNe K7+6oyJcVxKu3SJgSiuJBT1G7ghvoLIWS3ukxCEsPa7TKop5gElVwsw/Pk2i06ol97 zWvszRalzYhbpi8C/mTxuvgHjx3dfN6yvzcakGQd/cMfvH6GdG7DF5FVlTJX/f7vHy nujuC85KpPFNg== Received: from Workstation.local (st43p00im-dlb-asmtp-mailmevip.me.com [17.42.251.41]) by st43p00im-ztbu10063601.me.com (Postfix) with ESMTPSA id 44CD18C0C02 for ; Mon, 6 Jun 2022 19:45:03 +0000 (UTC) From: =?utf-8?Q?Rudolf_Adamkovi=C4=8D?= To: emacs-orgmode@gnu.org Subject: [PATCH] Fix shadowed radio targets Date: Mon, 06 Jun 2022 21:44:59 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-06_06:2022-06-02, 2022-06-06 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=793 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2009150000 definitions=main-2206060079 Received-SPF: pass client-ip=17.58.63.174; envelope-from=salutis@me.com; helo=st43p00im-ztbu10063601.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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=1654544777; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=yWZpjXypQsCIm2WevLxnYisZjmnP2LcsIAdAbq8tulU=; b=Wbn/MS1z8xue0N1kWH271phfCRwedSqY5+x2gbrN3gWZhDaK8ojiLiT0A5FjW3+4GVLH+b Tklc5+ifBzttoyCrXg3hljvubeHS2zgpY20M0Q8iDHtXSLHa6LaS72ewtAmgY8FcUwobLB N98iq9dnWlZUKscQoPcP2mu1Yc/peeQF6TNQya4fvgoj0jC8BpUa/LygAwgg8LVTmI6tcv YdFwfAaJZbol0uk3PDGtQQ5LQvJc8UwFIm2KR6g3Iw/D4N0d3B/gGjtis8Fn+E8aHHjLZn nXGITkYUOgTgTZXwQ9f2UAIUHlVE4bHPDq1axBFjZMo6a39f57jH/TNqkmqFYw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654544777; a=rsa-sha256; cv=none; b=IMezJPOqMPa07wp3FTHJz8GCXbEOsKBiUOuXGKbLk+imVX5ul9vNkQGOy5svyEJ064/KKv E8h/XHT4dWVS4OXzTymuZf7gprmAB4dd0EDBOw2ZJPLG8Pg8Ua1c4387kI/QMbOTBI9J3Q AkJA8dDjM6TLftyuC0jAzEFlLc4A1lGUeUZpaowrfUg6tw39hPqVA54ecfQZB5ebVIm1f1 XMeOJDEOp9UbDLQIyUPFDOuST9I2wwbXMyZH/5NYoFLggIB3xXDbmeyxfrPqW+a/6Abso5 pNFGpuwHa/DiMk6ZCVkfn05q0Lbq3mVaQnMtWSNP2mpjKusck46Vs7f8t0opww== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=bujYaUew; dmarc=pass (policy=quarantine) header.from=me.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: -8.91 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=bujYaUew; dmarc=pass (policy=quarantine) header.from=me.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: 5EC793FD8E X-Spam-Score: -8.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: NwiG1F09Mzn3 --=-=-= Content-Type: text/plain Hello everyone! If one defines two radio targets, say <<>> and <<>>, the first one does not work if defined first. Please, see the attached patch. I have the copyright papers signed. Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ol.el-Fix-shadowed-radio-targets.patch >From f0077a592fbf4ddfde02f5899dc428db4f7ecbf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Sat, 23 Apr 2022 11:39:33 +0200 Subject: [PATCH] lisp/ol.el: Fix shadowed radio targets * lisp/ol.el (org-update-radio-target-regexp): Sort radio targets before building the regexp that matches them. * testing/lisp/test-org.el: Test shadowed radio targets. The bug occurs when two targets share the same prefix and when and the longer target appears first. --- lisp/ol.el | 3 +++ testing/lisp/test-org.el | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lisp/ol.el b/lisp/ol.el index d4bd0e40c..189e31b1e 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -2040,6 +2040,9 @@ Also refresh fontification if needed." (cl-pushnew (org-element-property :value obj) rtn :test #'equal)))) rtn)))) + (sort targets + (lambda (a b) + (> (length a) (length b)))) (setq org-target-link-regexp (and targets (concat before-re diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 5f13e89a4..121f9efd5 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -2915,6 +2915,18 @@ Foo Bar (org-open-at-point) (eq (org-element-type (org-element-context)) 'radio-target)))) +(ert-deftest test-org/open-at-point/radio-target-shadowed () + "Test `org-open-at-point' on shadowed radio targets." + (should + (org-test-with-temp-text + "<<>> <<>> target shadowed" + (org-update-radio-target-regexp) + (org-open-at-point) + (string= + (org-element-property :value + (org-element-radio-target-parser)) + "target shadowed")))) + (ert-deftest test-org/open-at-point/tag () "Test `org-open-at-point' on tags." (should -- 2.36.1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 "One can begin to reason only when a clear picture has been formed in the imagination." -- Walter Warwick Sawyer, Mathematician's Delight, 1943 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --=-=-=--