From unknown Sun Jun 22 13:36:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64608: 29.0.90; Eglot: reuse server when visiting external files Resent-From: Filippo Argiolas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jul 2023 07:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64608 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 64608@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168931995715658 (code B ref -1); Fri, 14 Jul 2023 07:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2023 07:32:37 +0000 Received: from localhost ([127.0.0.1]:41402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKDI5-00044T-5O for submit@debbugs.gnu.org; Fri, 14 Jul 2023 03:32:37 -0400 Received: from lists.gnu.org ([2001:470:142::17]:50382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKBiX-0001FE-MG for submit@debbugs.gnu.org; Fri, 14 Jul 2023 01:51:50 -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 1qKBiR-0006VI-TK for bug-gnu-emacs@gnu.org; Fri, 14 Jul 2023 01:51:43 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKBiQ-0001do-EA for bug-gnu-emacs@gnu.org; Fri, 14 Jul 2023 01:51:43 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1b0156a1c4bso998334fac.1 for ; Thu, 13 Jul 2023 22:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689313900; x=1691905900; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=xX94Aiw9E49LNRuZB1a7WdApsuF7YsrU9zI8HBcGMvw=; b=mH0raNa1kkfMy89+ZtU+/F86/IPefFpBvys7pAcH/+RKhj2nUvLodmclEgyeRHrAH+ HwOAavY5hrPWPY/11gcViVuYAsK45FMGR57T5VuNxeXoygEffu4BFsB1T9sRXcgdLgmh 4xCltjzhP7sWe+RUzOZyEoHqnAYszlfX/plMTUrtYx2HSGjdoiiKzd7bmG3zNC52MFMs Uej63zLxbDIb+INxF8aL52jQ0xN7pZDJZX/Oww80sdbwDZWQHteic+uF+PnKXvqqryNa WZof9VnvqYHUWcBKzYu3MMWXURXqW7bhgmeHyJwoEqFDap8vjjiShzYFrU76EIel9Y0Q 3n9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689313900; x=1691905900; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=xX94Aiw9E49LNRuZB1a7WdApsuF7YsrU9zI8HBcGMvw=; b=IiKwUJRnL6tpsz9uRlko/Jby3Xdq4gTJoqaqaXXpne6DzjDJX16sd7NdAkNDwStF1s acbEcRDRXbDs5xFtRLkAD9WAfTo6+tUJoZxZed1z7wY32Qtj7wkksQIJaQji4AgktP7+ 2DqjoVz931oiFIO+Ld2W93PqhxQOt1KPXstQ5Rsgb0vyGjJim8GwxrYgavSO2qeCSFlB nDIxCKxbtp/Tly76TN2Pd1ui5GnQOTSLazaAet9cs9eRLE/+5GWPGAQROzBRvp/Tehur /4SwemlgWKTUE0gcMuDxD7S/GlR6D3Z2Gk/biiHTE2JP741A9BU4oygEUjqAvEGhQNA/ Fcsw== X-Gm-Message-State: ABy/qLYo7qTPB0eX/4zE6V/kQuVFWl9v35jYEPAxqLSnZDWV8Ski4jt7 LH0Dcu7nDtRgbEoAWGD4gOFgqHqIh8/G00NuSHGv/8aDHhE= X-Google-Smtp-Source: APBJJlGHn/2JCZGyDpTzSDgA9hjc6NkuAauGgt/kqwYhbDwSK2JS2EUiCRkPU0mRSzmD1I5vNmwVSdjGMkLq92+HMTs= X-Received: by 2002:a05:6871:8a6:b0:1b0:1388:b58a with SMTP id r38-20020a05687108a600b001b01388b58amr3839240oaq.52.1689313899950; Thu, 13 Jul 2023 22:51:39 -0700 (PDT) MIME-Version: 1.0 From: Filippo Argiolas Date: Fri, 14 Jul 2023 07:51:28 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2001:4860:4864:20::35; envelope-from=filippo.argiolas@gmail.com; helo=mail-oa1-x35.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-Spam-Score: 1.0 (+) X-Mailman-Approved-At: Fri, 14 Jul 2023 03:32:31 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hi, I'm working on a couple of projects each with their main root and all sharing some common code in an external root dir. Each project has a compile_commands.json that knows how to compile the external shared code. External root has no compile db and doesn't know how to compile itself. Eglot currently allows me to jump to external files using xref while keeping the current active running server by setting eglot-extend-to-xref. Project.el allows me to visit external files using project-or-external- functions by defining project-external-roots on my custom backend or project-vc-external-roots-functions with the default backend. It would be great if I configure Eglot to not switch to a new server when visiting an external file in a similar way it does with xref. Any pointer to achieve something like this with current project.el and eglot code would also be great. Maybe with a custom project backend? Best regards, Filippo From unknown Sun Jun 22 13:36:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64608: 29.0.90; Eglot: reuse server when visiting external files Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jul 2023 10:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64608 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Filippo Argiolas , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Cc: 64608@debbugs.gnu.org Received: via spool by 64608-submit@debbugs.gnu.org id=B64608.16893311234668 (code B ref 64608); Fri, 14 Jul 2023 10:39:01 +0000 Received: (at 64608) by debbugs.gnu.org; 14 Jul 2023 10:38:43 +0000 Received: from localhost ([127.0.0.1]:41512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKGCB-0001DE-1Y for submit@debbugs.gnu.org; Fri, 14 Jul 2023 06:38:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKGC5-0001Cx-QZ for 64608@debbugs.gnu.org; Fri, 14 Jul 2023 06:38:41 -0400 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 1qKGBz-0007pI-Q2; Fri, 14 Jul 2023 06:38:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=JJUQ4tpqi5BE0phqpQJG2/udb+y5J8kUQJACZBXePOI=; b=J9+2YgF3M6LSRsPVxJRV UodPQUOSVLnmDK3/bWZzzSUr1AfhFAXV1BN+8NQ2CjWj803q0sO6JxYEgUdZptq9vno9Ke+r2nk/a SBs8whhCjO54MU+ox1VT08zIW9zvmP4I5g79Nc9c5axTslckH99AhoRnV8CSc1yKo9UZP8Bn58Drc 9ObCcjh7h+rKRUUKJse5lvH86YruMV+dytLCWrRn4z28kkIGM/4BEmPS7y+2ERi11sDNiJYfgZLSE RGXN4PmLHMQpOJd8OHt7Pxfanbjzn44dg2wpr5hvvuE9+EsbS/MWwQmio0yBSMuDn1aaJA8SkV6bz nuefJhbukz0Reg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKGBz-0003Ec-AD; Fri, 14 Jul 2023 06:38:31 -0400 Date: Fri, 14 Jul 2023 13:38:49 +0300 Message-Id: <837cr24w1y.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Filippo Argiolas on Fri, 14 Jul 2023 07:51:28 +0200) References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Filippo Argiolas > Date: Fri, 14 Jul 2023 07:51:28 +0200 > > Hi, > > I'm working on a couple of projects each with their main root and all > sharing some common code in an external root dir. > > Each project has a compile_commands.json that knows how to compile the > external shared code. External root has no compile db and doesn't know > how to compile itself. > > Eglot currently allows me to jump to external files using xref while > keeping the current active running server by setting > eglot-extend-to-xref. > > Project.el allows me to visit external files using project-or-external- > functions by defining project-external-roots on my custom backend or > project-vc-external-roots-functions with the default backend. > > It would be great if I configure Eglot to not switch to a new server > when visiting an external file in a similar way it does with xref. > > Any pointer to achieve something like this with current project.el and > eglot code would also be great. Maybe with a custom project backend? Sorry, I don't understand: AFAIU Eglot reuses the same server for all the buffers under the same major-mode, so you should already have what you want? Or what am I missing? Adding João to this discussion. From unknown Sun Jun 22 13:36:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64608: 29.0.90; Eglot: reuse server when visiting external files Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jul 2023 14:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64608 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 64608@debbugs.gnu.org, Filippo Argiolas Received: via spool by 64608-submit@debbugs.gnu.org id=B64608.16893432558657 (code B ref 64608); Fri, 14 Jul 2023 14:01:02 +0000 Received: (at 64608) by debbugs.gnu.org; 14 Jul 2023 14:00:55 +0000 Received: from localhost ([127.0.0.1]:43101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKJLq-0002FY-PQ for submit@debbugs.gnu.org; Fri, 14 Jul 2023 10:00:55 -0400 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]:59715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKJLo-0002FD-Gy for 64608@debbugs.gnu.org; Fri, 14 Jul 2023 10:00:53 -0400 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3a3efee1d44so1472097b6e.3 for <64608@debbugs.gnu.org>; Fri, 14 Jul 2023 07:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689343247; x=1691935247; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LNWXf2Uv0YDKk8hkbbCuz3wraHlfZx147DoaO1kTTLU=; b=CaTWCk0AvUU4FUVUytgJ4vOsUgT7n189E69txnc7KFdvXDB2TfEtv8SjJbIN/N2eWq b+xtzpth/XPhVhowFIJH9/Nsb5ela1VCctMZTy6hfOiReyMpBFTuw7iN4GkpG2B6k7tv ARkAiKzEJmFi4aVBfk64HNPMR3mgRzYROkNoeUqyzponFK1o4Y4FmwLdLsV+y79ORU1D MxcRTzapiD05PdJ93ALhXXrckN/ysdihfI8iCddIifXlMufv3uVAIrBsCwZZQNzBkEPE ck3W8r0AvUNlOMfwpeZSZZct2/J9qX2y8Nv76ofN0E9pL6mMYWUamkyo+ezVjIKzTLgz Oucg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689343247; x=1691935247; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LNWXf2Uv0YDKk8hkbbCuz3wraHlfZx147DoaO1kTTLU=; b=YiJv6k8alwYzGP3wWIL1d5aERdoNhdri9kwyN4/CNpeJMPEjiEcDqXe3nAprBbNYc7 kf53jaYCfopLtZoX67NH7/hFWut9vhajyUIcpp2Sz/L+1mHaRi5hgZ2iHd8E6uhMZQ+s DZWeAS6qV5aChDd6GlDD4SZxWHpHbXw/vx7u6/zZC4llZLXRzuXXZj7JJlSubSnkPwyN SCF50pyX/JL6glyzb6QPgAzc6zmOmLT+CJtdkAMZn8ev9iJZahivUzR753is4njgcGy8 fuHmLjB7dkOF1TI5FdseAS6x7Bz6ogaDmZ+1rRIMkFvhIM3Urv3bWWvIk7RgCYTsBVdq o7uw== X-Gm-Message-State: ABy/qLZANykE3i8bSrsBDEQ09aDwsbsZMVPBYWJ2rfyTru0K3zm4cjkL ueMFmZxCIOJe2aVAFcPxNvw8HbZ9w3DOrWibcvg= X-Google-Smtp-Source: APBJJlGsPb8IeTq3OqYI/WkpDh//jHg5d/oXlVvdPwzdB8YcF0KbTAXAidA5vtnA3rCy3SGYzlSBqklhz1ZKMPNeJAs= X-Received: by 2002:aca:de06:0:b0:3a3:7db3:81a6 with SMTP id v6-20020acade06000000b003a37db381a6mr4507402oig.35.1689343246508; Fri, 14 Jul 2023 07:00:46 -0700 (PDT) MIME-Version: 1.0 References: <837cr24w1y.fsf@gnu.org> In-Reply-To: <837cr24w1y.fsf@gnu.org> From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Date: Fri, 14 Jul 2023 15:00:34 +0100 Message-ID: Content-Type: multipart/alternative; boundary="0000000000001cf140060072e0d8" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000001cf140060072e0d8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jul 14, 2023, 11:38 Eli Zaretskii wrote: > > > > Any pointer to achieve something like this with current project.el and > > eglot code would also be great. Maybe with a custom project backend? > > Sorry, I don't understand: AFAIU Eglot reuses the same server for all > the buffers under the same major-mode, so you should already have what > you want? Or what am I missing? > Not really like that Eli. Within the set of all the buffers in the major mode, subsets are defined for every project, i.e. return value of project-current. Broadly, that pair {major-mode , project} is the discriminator that determines Eglot's choice of server instance to manage a given buffer. The exception is buffers visited by eglot-extend-to-xref. I believe this is explained in the manual. If it's not clear, we should improve it. Fillipo, to fully understand your use case and what's missing I need you to create a structural example of those related projects, closely representative of the real one, pack it as a zip or a reference to a Git repository, in a way that I can experience the same limitation you are experiencing myself. Is the server you are using Clangd? If so, say the version. In summary, please follow the seven steps outlined in https://joaotavora.github.io/eglot/#Troubleshooting-Eglot, else it's going to be hard to help you. Jo=C3=A3o --0000000000001cf140060072e0d8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Jul 14, 2023, 11:38 Eli Zaretskii <eliz@gnu.org> w= rote:
>=C2=A0
> Any pointer to achieve something like this with current project.el and=
> eglot code would also be great. Maybe with a custom project backend?
Sorry, I don't understand: AFAIU Eglot reuses the same server for all the buffers under the same major-mode, so you should already have what
you want?=C2=A0 Or what am I missing?

Not really like that Eli. Within the = set of all the buffers in the major mode, subsets are defined for every pro= ject, i.e. return value of project-current. Broadly, that pair {major-mode = , project} is the discriminator that determines Eglot's choice of serve= r instance to manage a given buffer. The exception is buffers visited by eg= lot-extend-to-xref. I believe this is explained in the manual. If it's = not clear, we should improve it.

Fillipo, to fully understand your use case and what's missing= I need you to create a structural example of those related projects, close= ly representative of the real one, pack it as a zip or a reference to a Git= repository, in a way that I can experience the same limitation you are exp= eriencing myself. Is the server you are using Clangd? If so, say the versio= n.

In summary, please fo= llow the seven steps outlined in https://jo= aotavora.github.io/eglot/#Troubleshooting-Eglot, else it's going to= be hard to help you.

Jo= =C3=A3o
--0000000000001cf140060072e0d8-- From unknown Sun Jun 22 13:36:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64608: 29.0.90; Eglot: reuse server when visiting external files Resent-From: Filippo Argiolas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jul 2023 14:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64608 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 64608@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Received: via spool by 64608-submit@debbugs.gnu.org id=B64608.168934415210712 (code B ref 64608); Fri, 14 Jul 2023 14:16:02 +0000 Received: (at 64608) by debbugs.gnu.org; 14 Jul 2023 14:15:52 +0000 Received: from localhost ([127.0.0.1]:43131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKJaK-0002mh-6u for submit@debbugs.gnu.org; Fri, 14 Jul 2023 10:15:52 -0400 Received: from mail-oa1-x2a.google.com ([2001:4860:4864:20::2a]:52640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKJHF-00023H-1O for 64608@debbugs.gnu.org; Fri, 14 Jul 2023 09:56:09 -0400 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1b0719dd966so1536431fac.1 for <64608@debbugs.gnu.org>; Fri, 14 Jul 2023 06:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689342963; x=1691934963; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/ztRj8Le9ZTFkqOeQIEsxzysnasXsMF+rZHUpHMI454=; b=kntgYkWZf1750Aep0ST8mdIbAokkiNefUgeYTM2ElATj0DY9FVm6kX4mmhD9QyKv64 11LD3V8Fxb2lHHzj9p+mwDLwwJ987P5IMjdjuxkonvx0itAOD2bwCQ+FwTJE62yx2CqJ S3YFuKd9q72d20s5RYhPmNiqsls2HzDJfOeY2L0ysGlzaVVpJBRSHvMJet/ZnX2X6tB1 dQAtl2E7na8TvK+rl7PVPRP3yzUxzDITWZEAYcJFKPXPs2vit4MCg0AT5s8pWsj+5pgz P9T6Ze8+02cLnlEpMh8ct7iI9wc26/mOuH/fa15q0yOwXFwxozdoC4i1ACY2ls9IEDvb xVOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689342963; x=1691934963; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/ztRj8Le9ZTFkqOeQIEsxzysnasXsMF+rZHUpHMI454=; b=A2J2j7M75N+b9gNIw+/isQJ1N1Nn0D9Pb4dA7+YgZezIIc0lKrkTEyMgD6rKqWlmp/ pvBe63yDRWpsuPNFQ5yp8iqw4aKOhr2sdDIgjGYtj5AWCavg5ivFXxVRFP/+BfZRyH0L PSpnS+wp7YbPW6PO/+ZNzTZYsd5Mhfy49YxUhH3ZFFFnbxDZEIAStGGYjvXp4cjqgj3y Jqgiax05kn4ATQ4T1N2DwcauWE7KSdfHGnk9ep1gQH/fz/U3/vWhVSbGMWMO2fqR39dW g8fat+fOumnbzmG+vHxkT0iXrjR2owxn1GSUYhFpSbY2jDS+M9izuyVnTjwkRrEm7+3V zfrw== X-Gm-Message-State: ABy/qLYAAdCe9xRJcasBLZRrwlohj0nZW4UsgcLrpy1I5HIpobw7FgMn jFCAq7WkyeYO7sU34cL1Wwwyz52JynlFVWPqtHY= X-Google-Smtp-Source: APBJJlGD2EYOxhVLvsviYXkkV1DFOymWHx3hTL4TAInbq6MYRm2QbAbEiOl0p6QiKG6aDfsdvyHKGnoiYr2iOF2NIqg= X-Received: by 2002:a05:6870:c115:b0:1b3:e896:9bfa with SMTP id f21-20020a056870c11500b001b3e8969bfamr6006105oad.25.1689342963211; Fri, 14 Jul 2023 06:56:03 -0700 (PDT) MIME-Version: 1.0 References: <837cr24w1y.fsf@gnu.org> In-Reply-To: <837cr24w1y.fsf@gnu.org> From: Filippo Argiolas Date: Fri, 14 Jul 2023 15:55:50 +0200 Message-ID: Content-Type: multipart/alternative; boundary="00000000000039e4f8060072cfa7" X-Spam-Score: -0.0 (/) X-Mailman-Approved-At: Fri, 14 Jul 2023 10:15:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --00000000000039e4f8060072cfa7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Il ven 14 lug 2023, 12:38 Eli Zaretskii ha scritto: > > From: Filippo Argiolas > > Date: Fri, 14 Jul 2023 07:51:28 +0200 > > > > Hi, > > > > I'm working on a couple of projects each with their main root and all > > sharing some common code in an external root dir. > > > > Each project has a compile_commands.json that knows how to compile the > > external shared code. External root has no compile db and doesn't know > > how to compile itself. > > > > Eglot currently allows me to jump to external files using xref while > > keeping the current active running server by setting > > eglot-extend-to-xref. > > > > Project.el allows me to visit external files using project-or-external- > > functions by defining project-external-roots on my custom backend or > > project-vc-external-roots-functions with the default backend. > > > > It would be great if I configure Eglot to not switch to a new server > > when visiting an external file in a similar way it does with xref. > > > > Any pointer to achieve something like this with current project.el and > > eglot code would also be great. Maybe with a custom project backend? > > Sorry, I don't understand: AFAIU Eglot reuses the same server for all > the buffers under the same major-mode, so you should already have what > you want? Or what am I missing? > > Adding Jo=C3=A3o to this discussion. > I could be misusing the word server here, what I'm seeing is a clangd instance for each project. Each with its own hidden stdout/stderr buffer. Not sure if they're actually different processes, far from the laptop at the moment and cannot check, but I guess so. When I visit a file in a new project it starts a new clangd instance associated to its root dir and its compile db if it exists. All buffers from the same project share the same instance. Not sure what happens with different major modes as I'm using c-mode only. What I'd like is to reuse the same instance and the same compile db if I'm visiting an external file from project-or-external- functions. Filippo --00000000000039e4f8060072cfa7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Il ven 14 lug 2023, 12:38 Eli Zaretskii <eliz@gnu.org> ha scritto:
> From: Filippo Argiolas <filippo.argiolas@gmai= l.com>
> Date: Fri, 14 Jul 2023 07:51:28 +0200
>
> Hi,
>
> I'm working on a couple of projects each with their main root and = all
> sharing some common code in an external root dir.
>
> Each project has a compile_commands.json that knows how to compile the=
> external shared code. External root has no compile db and doesn't = know
> how to compile itself.
>
> Eglot currently allows me to jump to external files using xref while > keeping the current active running server by setting
> eglot-extend-to-xref.
>
> Project.el allows me to visit external files using project-or-external= -
> functions by defining project-external-roots on my custom backend or > project-vc-external-roots-functions with the default backend.
>
> It would be great if I configure Eglot to not switch to a new server > when visiting an external file in a similar way it does with xref.
>
> Any pointer to achieve something like this with current project.el and=
> eglot code would also be great. Maybe with a custom project backend?
Sorry, I don't understand: AFAIU Eglot reuses the same server for all the buffers under the same major-mode, so you should already have what
you want?=C2=A0 Or what am I missing?

Adding Jo=C3=A3o to this discussion.

I could be misusing the word server h= ere, what I'm seeing is a clangd instance for each project. Each with i= ts own hidden stdout/stderr buffer. Not sure if they're actually differ= ent processes, far from the laptop at the moment and cannot check, but I gu= ess so.

When I visit a f= ile in a new project it starts a new clangd instance associated to its root= dir and its compile db if it exists. All buffers from the same project sha= re the same instance. Not sure what happens with different major modes as I= 'm using c-mode only.

What I'd like is to reuse the same instance and the same compile db i= f I'm visiting an external file from project-or-external- functions.

Filippo




--00000000000039e4f8060072cfa7-- From unknown Sun Jun 22 13:36:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64608: 29.0.90; Eglot: reuse server when visiting external files Resent-From: Filippo Argiolas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jul 2023 09:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64608 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Cc: Eli Zaretskii , 64608@debbugs.gnu.org Received: via spool by 64608-submit@debbugs.gnu.org id=B64608.168941425718288 (code B ref 64608); Sat, 15 Jul 2023 09:45:02 +0000 Received: (at 64608) by debbugs.gnu.org; 15 Jul 2023 09:44:17 +0000 Received: from localhost ([127.0.0.1]:44184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKbp3-0004ku-4K for submit@debbugs.gnu.org; Sat, 15 Jul 2023 05:44:17 -0400 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]:54771) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKZk9-0000v0-EG for 64608@debbugs.gnu.org; Sat, 15 Jul 2023 03:31:05 -0400 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3a43cbb4343so1027202b6e.1 for <64608@debbugs.gnu.org>; Sat, 15 Jul 2023 00:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689406259; x=1691998259; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=V0hAd97CUtP+eyy4PGYW+g0gLx53LWLJ0/38NwQ4SzM=; b=qlbQZmJYIGp5A7QhXWUZKMerpSv1dlEpyFdbBItd0n1q/tGKi1yW+i68Htj2QPKhR3 Fssb/4YCUbz5sXEz4AEUrqn38Qx6Uj+PpzDheB8NJahxRJ7XGA7FTbzGWkxhMBujon5n pApXu1BJkxDW+IyiU4BWm+PS2RG3l4p3bkjIDzRof3V0pOUOIqtnqnw5Blrp94qYtb7b SzJsde/L8YnNes1XnREW2P//cVBhT3fwYpVndeMlFBXF4F+0u/HMpfKLLWJOIIahdiqH ZMlgznE/9eHapoOgtXaKVAGBHGJQsHPzHIhZJOneTrBVEmp0Md8+uDhLXal/zLoG+d8K t8wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689406259; x=1691998259; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V0hAd97CUtP+eyy4PGYW+g0gLx53LWLJ0/38NwQ4SzM=; b=ahhJtW7oUxH+6ZzsdxE1Z+ChiouG+FPuSzD5AeFPnsJfuSWagyfVbb1S9dyA6l1VDG /CnG2rMHfP/jQvL2yHMQQbop6o5azmIkNw5lgpfsvvGCXyds1pxs7CmQGUQxRuBXFMk8 akQbUdW1knrWa1Dwq2vgFRw52yKuTjFtEUTsP60/Dei7uMhsDg4AzxHL91NpgKCeq3HT jFEV3FIGSHTpw7SOlqbHd8wrUPeWVvu0yNFZvevLbIWPMKExfzPy09zUq3DcRylkwNp7 fqnlvLU+244rt1GACGWZBjV9Utx16D9EX8KpyiDhbxucnSRCyHzVivqekdJAyJ308Lk7 OUDw== X-Gm-Message-State: ABy/qLYtyfsaZIVtYpnYFsBER1O52/aNk6QjYA3iUmQgidw4kP+cbtxq gNhx+87LmMfS1jvhrQtah91d8AsXtzCApFe+g1Q= X-Google-Smtp-Source: APBJJlFpHTWhYR2PPjQ4BfrEzOn1c9fTnS50BUy42UI2oqG34noc/hOujuRw3dDzkL/ujA1tyTwB/NuZ/mgqjT+GLIY= X-Received: by 2002:a05:6808:1382:b0:3a4:3d81:6857 with SMTP id c2-20020a056808138200b003a43d816857mr5094678oiw.40.1689406259075; Sat, 15 Jul 2023 00:30:59 -0700 (PDT) MIME-Version: 1.0 References: <837cr24w1y.fsf@gnu.org> In-Reply-To: From: Filippo Argiolas Date: Sat, 15 Jul 2023 09:30:47 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Mailman-Approved-At: Sat, 15 Jul 2023 05:44:16 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Il giorno ven 14 lug 2023 alle ore 16:00 Jo=C3=A3o T=C3=A1vora ha scritto: > Fillipo, to fully understand your use case and what's missing I need you = to create a structural example of those related projects, closely represent= ative of the real one, pack it as a zip or a reference to a Git repository,= in a way that I can experience the same limitation you are experiencing my= self. Is the server you are using Clangd? If so, say the version. I tried to setup a minimal work dir to show you what I'd like to obtain. https://people.freedesktop.org/~fargiolas/eglot-external-test-case.tar.gz It's configured (compile db and dir locals) to be unpacked inside /tmp/ Inside you will find three dirs: - foo and bar are normal projects - ext contains shared code that can be compiled only when paired with one or the other project. ext is is added as an external root to each of the projects with .dir-local= s.el foo and bar include compile_commands.json that build both the project and the external code. Each project builds the external code differently (e.g. by setting different defines). Only relevant settings in init.el are: (add-hook 'c-mode-hook 'eglot-ensure) (setq eglot-extend-to-xref t) emacs 29.0.90 clangd 6.0.6 With eglot-extend-to-xref I can jump from foo/main.c into ext functions while keeping the same active clangd server (eglot:foo in the modeline). If I open foo/main.c and then visit ext/ext.c with project-or-external-find-file or project-or-external-find-regexp it switches to a new clangd instance (eglot:ext in the modeline) as it detects ext/ as its own project. What I'd like is to keep the same clangd instance if I'm visiting and external file in a similar way that xref does. Is it something achievable in current eglot? may be something I should configure about workspaces? Thanks! Filippo From unknown Sun Jun 22 13:36:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64608: 29.0.90; Eglot: reuse server when visiting external files Resent-From: Filippo Argiolas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jul 2023 09:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64608 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Cc: Eli Zaretskii , 64608@debbugs.gnu.org Received: via spool by 64608-submit@debbugs.gnu.org id=B64608.168941425818297 (code B ref 64608); Sat, 15 Jul 2023 09:45:02 +0000 Received: (at 64608) by debbugs.gnu.org; 15 Jul 2023 09:44:18 +0000 Received: from localhost ([127.0.0.1]:44186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKbp3-0004l0-QX for submit@debbugs.gnu.org; Sat, 15 Jul 2023 05:44:18 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]:51397) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKZld-0000xS-Js for 64608@debbugs.gnu.org; Sat, 15 Jul 2023 03:32:38 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3a43cbb4326so1178062b6e.2 for <64608@debbugs.gnu.org>; Sat, 15 Jul 2023 00:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689406352; x=1691998352; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=H26ZlPjaklUG4evZXXZp9XEOiqnxrfPPhm78/KvF4Eg=; b=A1y7KZJAF4V7fsi8R4OV6oOX3uJuHiXg+QRyJ/5jmz/tc9x8cArWCJesNW85p1tUv7 wpipXPv2SoPYYRWKpVcJhHdGfHl1Ra9G/JoB1T+c1c7FeCXyXTiG6tl+KC5SyR5UgCBA dI2bZUflRt0vIQ/RJd5Oj6+uT7FydpPHC4r1LIKGof+RQDeqhH3BPnEPQXBo3wuam9HJ 3oXy1tpHmqPPmBcAyrBo0ZTnJddZFV7h2MMDKn2VozQrHxvTzoxGddbt1x3k2oDCqqyN t1dPZmPdToJBSaiAt97ct9rbQ9zOsEiAVtgfhhc/n2/M4RMD/Z4rASAEeGsntbwGcOH8 rBHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689406352; x=1691998352; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=H26ZlPjaklUG4evZXXZp9XEOiqnxrfPPhm78/KvF4Eg=; b=PzPvsBB+R6b2T5yrFvxDLAAkB2Gn04F9l2gMWY0Fz1BkDZ7oMcwV2Y8mtcmMM3WG1i tiiSG7YXm33IrSSzvnYU79wVkjHhk8gUY5fyuqJObitsiiEyn7+8bVKk97T4ithyK2WW SGDYJe4eUVcnBcwjgp1lrjMJ5L4tPNvCzwO//gRvX/t31aF6DM2aUp//sXb0qbYAk3lK lV6yB7wyanUUkCiUYMmxyZzgBCj68YGXos53f9rWfVobJU5eyUavZM0MONGtqKr5+sp4 L03SEr83BOg9aAsW/kFSYdDy2EuvNjd8+b1e20mWfzKSSE+yuVOUBzaC44xKuHn1wudR eYLA== X-Gm-Message-State: ABy/qLZVedxOR8GnJt80AXfJZ5Z0s9tWkEM4va1wS9JDcyZrG82n3F4f /8Gmu2mSeWg5b2g0QHWDEKRqUbCdBq3WwVMrUWs= X-Google-Smtp-Source: APBJJlGJyE6M9RXnHrg4Joy1Pm9+hrB3zRzfYdaUdebPLCynMU2lpZDtjL3iPPe+ilsc2bAhffZ/XqFGxiCyUUjA2V4= X-Received: by 2002:aca:dbc5:0:b0:3a1:d3f2:70b7 with SMTP id s188-20020acadbc5000000b003a1d3f270b7mr5569671oig.18.1689406351923; Sat, 15 Jul 2023 00:32:31 -0700 (PDT) MIME-Version: 1.0 References: <837cr24w1y.fsf@gnu.org> In-Reply-To: From: Filippo Argiolas Date: Sat, 15 Jul 2023 09:32:20 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Mailman-Approved-At: Sat, 15 Jul 2023 05:44:16 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Il giorno sab 15 lug 2023 alle ore 09:30 Filippo Argiolas ha scritto: > emacs 29.0.90 > clangd 6.0.6 clangd 16.0.6, sorry for the typo