From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 6FYRKHRSSWU4TAAAauVa8A:P1 (envelope-from ) for ; Mon, 06 Nov 2023 21:54:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 6FYRKHRSSWU4TAAAauVa8A (envelope-from ) for ; Mon, 06 Nov 2023 21:54:12 +0100 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 554F515960 for ; Mon, 6 Nov 2023 21:54:12 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=I3efItMb; 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=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699304052; 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=d98Z+eIEI27hF9SSHxjuETENIYN/AlDTWOYnFNW5df0=; b=qMJn3NIUPsl9U+pnp4ZJTSyGyuk0ihudhip9WgrocZk5rXTi5aWlvyrANnjWUtEH4FOs7f xXnDztl1d99ZW0JVGlHX1Hem4+SoZy551j2CwElcgV3QH/34S6h1mQsimv96+5sjgZ3tt5 Bge6TXKl/dTNOHBftBUYZeTa2kmXQcSewU8KnHdF1goq/uvzPAGfcC+e8h/RkcKlxTWTpD s4PF/7ENik9ZTv28NEEt8Ppr6iJEoB40iXEfYjGWYyPd5npHB6OqIzUhH68kBnc+aeOhg/ WH+1z2z2IDSJIHZ8Ef+PeXQrLtdBWSgB4km5bZbu+Ap5B2uz2zkkkmfHwWYVCA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=I3efItMb; 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=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699304052; a=rsa-sha256; cv=none; b=aduwp9cnePy1G/z6sIF1XsICYI8HPVVIFdXFoX9cPTWgy1iyqlisq9TCyNOY7WIehuWXXx wvfWL8v1ykSvrQdTsM/x7yghCyrIE74oGKohwnrmbwoXyWS0RkvQwI2LRJTQ1uxD6q4GjV WvriKeIPKcMeWshmYpagg7RmvKZU7lrlyhgqChQf10lFttzY6bx9b0dY2B/R55eTVnao5m wi67bWgR3dLp9A5qAwWpF7RtxyOSDPrkKIou4VNc3bKDCmllKnQCKiSr4HpLSdHQ/BRQx1 Tyo8Lqsqmh7AKUSPeCHMFFgtGB97WCGKI2jQAEWCDoxqBWkMfPWASMRsxE1tgA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r06ar-0004aC-9a; Mon, 06 Nov 2023 15:53:09 -0500 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 1r06ap-0004Zs-TR; Mon, 06 Nov 2023 15:53:07 -0500 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r06ao-00022k-79; Mon, 06 Nov 2023 15:53:07 -0500 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b709048f32so4603512b3a.0; Mon, 06 Nov 2023 12:53:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699303984; x=1699908784; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=d98Z+eIEI27hF9SSHxjuETENIYN/AlDTWOYnFNW5df0=; b=I3efItMb9VJvRA1ANISPvxcwezOpa+4uMcDyj4O3g8nH2JXQJrOZ9+hbWkoiGY8PzK 6lvuV+1bic2M21sAQFATTUY5S6iphOVvHH97RlVlnJs7KrSUw2EKptXhuzAEvpZ+1zM+ MRp49FRidDTCH68yuzq9xqUhXTC1ZxPOvL0+oYZJVsUy/vjS6Cam2Zv0j+GCo3LhoWiT wVrS1qtKHTt2yKtpiyFsS3QIqpvI3cSzGFUGwx3lprUdL5ZaQd1x7WQG+nDS/vJBsFAr kxMSe7M/QPBhkHQbp0+uEaN2+iFyJWvKLpYbOgC5e04adtJE1sJ27DZsHks25+7D9O8I wyng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699303984; x=1699908784; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d98Z+eIEI27hF9SSHxjuETENIYN/AlDTWOYnFNW5df0=; b=EsYHfNGttmbKzyRj5+HFc7aVDwPawYlm9kJrcT5iltYujNmEH9Kjk3D7EIeRq298g6 bbwFlO+dCKrvJvx8Efheqb0IHptcgzFo4c8E9I6OXug4IXT3SQuxOfmiGuULnE217B+9 wmRDn8C+A3x3kY6NUJoZE/jVq12hBvin7P8BQzZ3icv3MYe9NSWKjubmN14iXFCQXbQA 1zSQpWwn7iPRVKvpbvm4g+z7h+yy4Gn0aj1Yyj2Zb84dhYvF5IoMU84HftA1GKhk657i vFnKxVHXYFGgbO4V+cxgdWNGvInE1F4PCJxsL40JUblHGttKBhbRzKO22i7UTDoMpXu+ JSzw== X-Gm-Message-State: AOJu0Yx8/KTvo7UzVIOcPWNrwhp6uNf2d87RnKpcHYTtfMdmEbRcwt1m W2m2tyGrRZ/mIad96N30MBs= X-Google-Smtp-Source: AGHT+IEdaOpp8YcHX+qLfLLFx4iWPcrxddUdNNBxM4WN/hBxqVMLxtg6NajmmiL9vPnNloQavt4WHg== X-Received: by 2002:a05:6a00:1345:b0:6bd:f760:6ab1 with SMTP id k5-20020a056a00134500b006bdf7606ab1mr28830736pfu.14.1699303984061; Mon, 06 Nov 2023 12:53:04 -0800 (PST) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id q9-20020a056a0002a900b006c33c82da66sm6000484pfs.75.2023.11.06.12.53.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Nov 2023 12:53:03 -0800 (PST) Message-ID: <88435424-afa3-d7a3-56ff-df9f0a2ca6ba@gmail.com> Date: Mon, 6 Nov 2023 12:53:02 -0800 MIME-Version: 1.0 Subject: Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point) Content-Language: en-US To: Ihor Radchenko , emacs-devel@gnu.org Cc: emacs-orgmode@gnu.org References: <87leba3ame.fsf@localhost> From: Jim Porter In-Reply-To: <87leba3ame.fsf@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x431.google.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, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.42 X-Spam-Score: -9.42 X-Migadu-Queue-Id: 554F515960 X-Migadu-Scanner: mx13.migadu.com X-TUID: 9jvA8/akXVSb On 11/6/2023 12:11 PM, Ihor Radchenko wrote: > [ Branching to emacs-devel for further input from Emacs devs ] > > Jim Porter writes: > >> This is similar to Emacs bug#66752[1]. It would be nice if >> "(thing-at-point 'url)" would return the URL when point is over an Org >> link. With this, it's easier to write a function that copies (or browses >> to) the URL at point without coding so many special cases. >> ... >> +(defun org--url-at-point () >> + "`thing-at-point' provider function." >> + (org-element-property :raw-link (org-element-context))) > > Supporting thingatpt.el is certainly welcome. However, I have some > doubts about how mature thingatpt.el is. > > In particular, I am concerned whether `thing-at-point-provider-alist' is > reliable enough in non-trivial scenarios like when given URL string is > not matching some generic URL regexp. The nice thing about 'thing-at-point-provider-alist' is that your provider has absolute control over what to return, so Org's URL provider could do whatever it wants. As far as I can tell, this code path completely avoids calling 'bounds-of-thing-at-point' ('botap'). However, it *would* call 'botap' if point wasn't on an Org link, since it would fall back to the last condition in 'thing-at-point'. Still, this is what happens today with no provider, so it's not really any worse than before... Maybe it would make sense for 'thing-at-point' to have a "(catch 'not-found ...)" form around the loop over 'thing-at-point-provider-alist'. Then Org could definitively say, "There's no URL at point, no matter what anyone else says". > Looking into the source code of `bounds-of-thing-at-point', I see that > for standard "things" (like url), > `thing-at-point-bounds-of-url-at-point' is used unconditionally. In the > case of Org links, we may have something like [[https://orgmode.org]] > that will not match default URL regexp as is. AFAIU, there is no > documented way to customize the behaviour of `bounds-of-thing-at-point' > and `forward-thing'. I think it would make sense to add some sort of 'bounds-of-thing-at-point-provider-alist' (that's a mouthful!) that would let modes override the behavior of 'botap', but I don't think that's necessary for the narrower purpose of asking, "I want the value of THING at point, if any." > I also have concerns about Org-specific part of the patch, but the above > is far more important, and we need to discuss it before starting to > consider anything for Org mode. For better or worse, I mostly modeled this patch on how EWW integrates with thing-at-point, since that's the only place I saw in the Emacs tree that did this already.