From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70036: a fix that Date: Fri, 19 Apr 2024 13:51:12 +0200 Message-ID: <87cyqllgen.fsf@thornhill.no> References: <4e670617-6483-4159-a5cf-27a921764c38@email.android.com> <864jbxden1.fsf@gnu.org> <86r0f1bopx.fsf@gnu.org> <87r0f1mvtx.fsf@thornhill.no> <87frvhlgl0.fsf@thornhill.no> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18864"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 70036@debbugs.gnu.org, felician.nemeth@gmail.com To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 19 13:52:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rxmmr-0004fq-C1 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Apr 2024 13:52:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxmmX-00077p-CU; Fri, 19 Apr 2024 07:51:53 -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 1rxmmT-00077M-9C for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 07:51:49 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rxmmT-0001br-0U for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 07:51:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxmmg-0006EF-PR for bug-gnu-emacs@gnu.org; Fri, 19 Apr 2024 07:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Apr 2024 11:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70036 X-GNU-PR-Package: emacs Original-Received: via spool by 70036-submit@debbugs.gnu.org id=B70036.171352749723722 (code B ref 70036); Fri, 19 Apr 2024 11:52:02 +0000 Original-Received: (at 70036) by debbugs.gnu.org; 19 Apr 2024 11:51:37 +0000 Original-Received: from localhost ([127.0.0.1]:58142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxmmH-0006AY-7l for submit@debbugs.gnu.org; Fri, 19 Apr 2024 07:51:37 -0400 Original-Received: from out-179.mta0.migadu.com ([2001:41d0:1004:224b::b3]:65500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxmmF-0006AO-Oj for 70036@debbugs.gnu.org; Fri, 19 Apr 2024 07:51:36 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1713527475; h=from:from: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; bh=l3XnPx6JijQLsIWycFmwCwTkpg1TJCnPqSXNNMR9cUI=; b=sitGlPQhYUVqQpdBixlGTtY4W2Ug4/7jRGYQoMh2L1C+oNl4e2b/f7raYnSkoJzCWo8Ut3 wQQTEndjoiTmLItSX2nE5ZPrbnzDw+xBQQVtYOXJ3VxsOq2tCeNyAM8QW0RxqR9q8c/8V4 6l1mcCu3mnUGCGENMgoRotHO8KVzUmcTvjbSL9l5BkrU4WfZfBbXDhslJlszqbKY17OwLh PQ3/TaqROkm3vncMfyl5xuwzhI45KX0ppFAoYMbz1jYADvzhod3EqgxuSQ41n9O6A/ffmJ WSLDHONaP6tFcwWS9hJjANmFFPP7spLllmKE+hk9wEGimUxEY/cnjdc4gjc4UQ== In-Reply-To: <87frvhlgl0.fsf@thornhill.no> X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283672 Archived-At: Theodor Thornhill writes: > Jo=C3=A3o T=C3=A1vora writes: > >> On Fri, Apr 19, 2024 at 12:32=E2=80=AFPM Theodor Thornhill wrote: >> >>> I wonder - why can't we use just buffer-file-truename? >>> >>> In the below function, wouldn't buffer-file-truename let us avoid the >>> file-truename in eglot-path-to-uri? >> >> Never used, but try it out. It seems it's already a built-in cache >> of whatever the buffer's truename is (and the docstring says >> it does call the slow `file-truename`). But like in my patch, it's >> a one-time thing. So yeah, if it's available in old Emacsen as well, >> it could replace `eglot--cached-tdi`, but then the search in the >> publishDiagnostics >> handler would have to be adjusted accordingly to call uri-to-path again. > > What would you consider as a sufficiently old Emacs? > I guess this should be enough: commit f6ed2e848d23035748b621a86be74956c093823f Author: Richard M. Stallman Date: Tue Feb 14 16:33:19 1995 +0000 (syms_of_buffer): Set up Lisp var buffer-file-truename. (init_buffer_once): Set up flag and default value for file_truename. (reset_buffer): Init file_truename slot. diff --git a/src/buffer.c b/src/buffer.c --- a/src/buffer.c +++ b/src/buffer.c @@ -3011,0 +3014,5 @@ + DEFVAR_PER_BUFFER ("buffer-file-truename", ¤t_buffer->file_truenam= e, + make_number (Lisp_String), + "Truename of file visited in current buffer, or nil if not visiting a = file.\n\ +The truename of a file is calculated by `file-truename'.\n\ +Each buffer has its own value of this variable."); Theo