From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.orgmode,gmane.emacs.devel Subject: Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point) Date: Tue, 30 Apr 2024 11:39:42 +0000 Message-ID: <87sez36pvl.fsf@localhost> References: <87leba3ame.fsf@localhost> <88435424-afa3-d7a3-56ff-df9f0a2ca6ba@gmail.com> <875xz39cgp.fsf@localhost> <87ttk6da89.fsf@localhost> <673a0f71-c91f-8461-7388-9efbed6ba24f@gmail.com> <0c66ae28-7088-3ac7-be39-7714b8f80455@gmail.com> <87mspcave3.fsf@localhost> <253c058a-d349-41a7-7733-c73075bffcb6@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40102"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eliz@gnu.org, emacs-devel@gnu.org, emacs-orgmode@gnu.org To: Jim Porter Original-X-From: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Tue Apr 30 13:39:34 2024 Return-path: Envelope-to: geo-emacs-orgmode@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s1lpe-000AEm-C9 for geo-emacs-orgmode@m.gmane-mx.org; Tue, 30 Apr 2024 13:39:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1lov-00075p-7m; Tue, 30 Apr 2024 07:38:49 -0400 Original-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 1s1los-00075T-VH for emacs-orgmode@gnu.org; Tue, 30 Apr 2024 07:38:47 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1loo-00015t-C6 for emacs-orgmode@gnu.org; Tue, 30 Apr 2024 07:38:45 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 8AE77240104 for ; Tue, 30 Apr 2024 13:38:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1714477118; bh=Y1dC4DjkESueECx14JwtvptK1G4PBaX5Thn6NMB8iF0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=mOQdR7N3meScQb/44BMCi5+5uzePXT4DmBiuZgWNkmrPh0+WR9D/c3f+Vr/PXpJ1i pRNx2Pnw9xXZEf76cd7wkCL4Tdc8pl7qsaKjl9rIJYPCm3UOB5BG7Gz2aAEBKXxmFl cjuhimrVsim8pvK2Ylehw6sLICPBCX4XGGQhMQU9aESXYuLu6MElbCay6hHFgk/y47 UYIbQyN1YgVrrl3/GxYTb0aQZX3gUd4OPwurm0Fj0KdHTK+JS28JBYQcsH2/hwFnnZ fVE0cWYxaoDdmJNB803GKu22ZxYhJVAxJCvvQDCHYOJEvFtTYXIFzYBuEvQVhmMum1 srGNz4cmttuDg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VTJ9n130Gz9rxS; Tue, 30 Apr 2024 13:38:36 +0200 (CEST) In-Reply-To: <253c058a-d349-41a7-7733-c73075bffcb6@gmail.com> Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Original-Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.orgmode:161350 gmane.emacs.devel:318417 Archived-At: Jim Porter writes: > + (setq-local bounds-of-thing-at-point-provider-alist > + (append bounds-of-thing-at-point-provider-alist > + '((url . eww--bounds-of-url-at-point)))) > + (setq-local forward-thing-provider-alist > + (append forward-thing-provider-alist > + '((url . eww--forward-url)))) > ... What happens if you have multiple providers for an URL? You add the provider to the end, so it will have the lower priority in this scenario. I guess that you want the opposite - EWW provider to take precedence. Same for other changes. > +(ert-deftest thing-at-point-providers () > ... > +(ert-deftest forward-thing-providers () > ... > +(ert-deftest bounds-of-thing-at-point-providers () > + (with-temp-buffer > + (setq-local bounds-of-thing-at-point-provider-alist > + `((url . ,(lambda () > + (bounds-of-thing-at-point-for-text-property > + 'my-url))))) It would make sense to add tests for "first wins" behaviour. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at