From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point) Date: Tue, 06 Feb 2024 14:47:32 +0200 Message-ID: <86y1bxzrmj.fsf@gnu.org> References: <87leba3ame.fsf@localhost> <88435424-afa3-d7a3-56ff-df9f0a2ca6ba@gmail.com> <875xz39cgp.fsf@localhost> <87mssebjwa.fsf@localhost> <864jel22ym.fsf@gnu.org> <87mssdlqdg.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39294"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jporterbugs@gmail.com, stefankangas@gmail.com, emacs-devel@gnu.org, emacs-orgmode@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 06 13:48:01 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rXKro-000A1U-P4 for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Feb 2024 13:48:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXKrY-00036r-VO; Tue, 06 Feb 2024 07:47:44 -0500 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 1rXKrX-00036Y-V1; Tue, 06 Feb 2024 07:47:43 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXKrO-0007Kg-PJ; Tue, 06 Feb 2024 07:47:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=q7bofUzICxxOHsfYdEeiGstFvn6tjaaPe3r8xTIRF90=; b=Q58xewFYg6ao kt2elu5yVlIT5RdGVIMjaw5xxfvOOFpNBj31C8JrLzwhQFnQ6nSx4KpFth6FwB7d6DC/teAsDGbv8 Lh4Qy0iC5RChfg2wLSpBWZ3gfqxiU3C9UVVw9RW5vZGv3CTo4BB/DECTO6Tw/C4Tio00HX4iv4NtB wMiEye4uOmAwOsmciB0LK6jfSGc9K+74s/WVkP51GJiU8+qPc0IMCQt0ugpJqCPJFhHEd1H345ycJ ZuvU9fhsqGbbwLXhfJIPZ14nICDHJtpjx6zg5tOCiEG5GyiZ3ksr+NW7GhsmQgsCXWzsgyTgxBfbt 15sw+5HIeoYt1b3uL7L1eQ==; In-Reply-To: <87mssdlqdg.fsf@localhost> (message from Ihor Radchenko on Tue, 06 Feb 2024 12:38:19 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315929 gmane.emacs.orgmode:159632 Archived-At: > From: Ihor Radchenko > Cc: jporterbugs@gmail.com, stefankangas@gmail.com, emacs-devel@gnu.org, > emacs-orgmode@gnu.org > Date: Tue, 06 Feb 2024 12:38:19 +0000 > > Eli Zaretskii writes: > > > I think we do want to allow extending of this, but doesn't > > thingatpt.el already provide such capabilities? For example, I see > > this in bounds-of-thing-at-point: > > ... > > (cond > > ((get thing 'bounds-of-thing-at-point) <<<<<<<<<<<<<<<<<<<<<<<< > > (funcall (get thing 'bounds-of-thing-at-point))) > > > > Doesn't this provide the extension capabilities you are looking for? > > If not, why not? > > Unlike `thing-at-point-provider-alist', which can be buffer-local, > symbol property is always global and setting it would override other > thing providers. > > Note how `thing-at-point' uses > > (cond > ((let ((alist thing-at-point-provider-alist) > elt result) > (while (and alist (null result)) > (setq elt (car alist) > alist (cdr alist)) > (and (eq (car elt) thing) > (setq result (funcall (cdr elt))))) > result)) > ((get thing 'thing-at-point) > (funcall (get thing 'thing-at-point))) > > checking `thing-at-point-provider-alist' and only then falling back to > `get'. What I am proposing is to add the equivalent alists for other > operators used by thingatpt.el. I guess it's fine, then. But we probably should have such alists in all the other thingatpt methods as well.