From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id cPRhAjbUlmaG4AAAqHPOHw:P1 (envelope-from ) for ; Tue, 16 Jul 2024 20:12:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id cPRhAjbUlmaG4AAAqHPOHw (envelope-from ) for ; Tue, 16 Jul 2024 22:12:38 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=red-bean.com header.s=202005newsp header.b=XhWgQ8MJ; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=red-bean.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1721160757; h=from:from:sender:sender:reply-to: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=SNUHcdwntsQtqUzroq90dsEQyTOcEO80ccv2tK4WwEo=; b=r5TlvzKzYJvS8QlMs+Dy+QpSqxuZABIOgw1A8pm2gyvcDHgdMSVL523SuV3cUZksyVsMUf f8AFJIC/6ad2G0HCgqKS1WdLDAFkqDQ838iZzrXW/m8k16YkyjVakRM8hFtqZqw9h0Pzou pHCR2/wMYoJm3czw+9UmVWzxv+6f9mb3fyM+yAFo60VlzkLC+jacaacC4c4U/GM2QNygss qvBT8fpxilzMH/SW54a14MBuf2iPFLKI6paFS7zPvS+DBIUdE/o9FisCtHBQy+vjZvDzy0 B7R442zEhH4/iZ09dgD2RMuG4lw8PEuqJCj5BXdDv5WOsQ/WFXM5SpwHUb+Hvg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=red-bean.com header.s=202005newsp header.b=XhWgQ8MJ; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=red-bean.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1721160757; a=rsa-sha256; cv=none; b=ZtsCkiugEJa1zsr0NifHQ2HhAcLgxS3but14yjeXN5EbXCJ7N9FGOZ9PKIxZR0S5X4vpWs dwEu0eY3W7HR2M0kRzkrpa2h7eAA/PAHG8XTgrWYboNK0F0Q7PTokszLt3KB1zwYPN5jgj 8kNOhSCVLmCkvbd4hCkOrYyedktGXhTcjH+YTcNLdysf6nHuGXwaKfZQw1TPPrXcS59fub vx6K9xmcQnQJ1JsxF8fCuylHqdBtY/U5JnfrhTUtU1tUgFA7oYMjRT4YepsLkp5AM9e3Zk 2MY+5hrznw2pOE7HyUvujtiuso5utEHu+5azJztpWAN7jXauuIR14sffIpO8aA== 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 0E9656798D for ; Tue, 16 Jul 2024 22:12:37 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sToVg-0000px-S4; Tue, 16 Jul 2024 16:10:52 -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 1sToVb-0000mN-P1 for emacs-orgmode@gnu.org; Tue, 16 Jul 2024 16:10:48 -0400 Received: from sanpietro.red-bean.com ([45.79.25.59]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sToVY-00008p-5h for emacs-orgmode@gnu.org; Tue, 16 Jul 2024 16:10:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=red-bean.com; s=202005newsp; h=Content-Type:MIME-Version:Message-ID:Date: Reply-To:Subject:To:From:Sender:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=SNUHcdwntsQtqUzroq90dsEQyTOcEO80ccv2tK4WwEo=; t=1721160636; x=1722370236; b=XhWgQ8MJUo5MmHIrGo4/Dvo6DP9xZG3n0Ei95U6zXSEfNq8tzURF+RwlS8Zi//2Gw8h/dOu7BfP Zt0FAI6gwoorzHLzoYnFl4YJa1NAYP+CnOeglALn09O0wOabrJkeO8oYDJlupLpgZSwIb1ZTKOSGQ VxMeWAUmX/WN6sjn3C9NmvHRKk/VWh5Q5Q/yeneZvf3Wr4tJ0PM7TwqAXjY86P9aIOtdH2JfK9z3W YWOL6fsPrfzMz71/ube5d2qu6ZDD4Ra1Xav+2Ab4e/F2l8gsTnWRshU8xvh87SCssLCdmBwcArLdI 0EKIyflnX1Z81F87KNvxtXjHGWvQB6GaJ+Qw==; Received: from [12.106.183.66] (port=53189 helo=hummy) by sanpietro.red-bean.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sToVP-002DbJ-0p for emacs-orgmode@gnu.org; Tue, 16 Jul 2024 20:10:35 +0000 From: Karl Fogel To: Org Mode Subject: Possible bug getting bounds of URL at point? Date: Tue, 16 Jul 2024 15:10:35 -0500 Message-ID: <87h6cp9jyc.fsf@red-bean.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=45.79.25.59; envelope-from=kfogel@red-bean.com; helo=sanpietro.red-bean.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, 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: , Reply-To: Karl Fogel Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 0E9656798D X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -4.31 X-Spam-Score: -4.31 X-TUID: gCuM1AKt6ODS In Org Mode buffers, `bounds-of-thing-at-point-provider-alist' names a Org-Mode-specific URL provider: ((url . org--bounds-of-link-at-point)) That handler is defined in org.el: (defun org--bounds-of-link-at-point () "`bounds-of-thing-at-point' provider function." (let ((context (org-element-context))) (when (eq (org-element-type context) 'link) (cons (org-element-begin context) (org-element-end context))))) (This is in the tree as of today, commit f2141541b45.) I think this is causing URL boundaries to be calculated incorrectly. REPRODUCTION: Assume we have this line in an Org Mode buffer (note there are three trailing spaces after the final "m" -- hopefully the MTAs and MUAs will leave those spaces there): https://example.com Let's say the initial "h" is at position 22205, the position right after the final "m" is 22224, and the final position on the line (after the three spaces) is 22227. With point anywhere inside the URL, if I run (bounds-of-thing-at-point 'url), I currently get this result: (22205 . 22227) But I expected this result instead: (22205 . 22224) Is (22205 . 22227) correct, and I'm just misunderstanding how URL boundaries are supposed to work in Org Mode? I haven't yet debugged into `org-element-end' (nor into `org-element-property', which is what `org-element-end' wraps). First I want to check that my expectations are correct. Is there a bug here? Best regards, -Karl