GNU bug report logs - #76423
Major-mode provided LSP server for Eglot

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Stefan Monnier <monnier@HIDDEN>; Keywords: patch; dated Wed, 19 Feb 2025 20:34:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 76423 <at> debbugs.gnu.org:


Received: (at 76423) by debbugs.gnu.org; 20 Feb 2025 20:01:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 20 15:01:14 2025
Received: from localhost ([127.0.0.1]:41874 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlCjR-0000uk-Bt
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 15:01:14 -0500
Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:57377)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>)
 id 1tlCjN-0000kD-Dk
 for 76423 <at> debbugs.gnu.org; Thu, 20 Feb 2025 15:01:10 -0500
Received: by mail-ej1-x629.google.com with SMTP id
 a640c23a62f3a-ab78e6edb99so194268366b.2
 for <76423 <at> debbugs.gnu.org>; Thu, 20 Feb 2025 12:01:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740081663; x=1740686463; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=iYztawKaqgCs1jBBL8aCGV4S7jTN2W8VewD3uAOZWFs=;
 b=Hx/tClCxanOOJTFYrl5FjDiFAc2VvZSTVE1VmzQwJxMMAtKJuZPMrgVBFlIuIMe6kN
 VmT++NBZN36bFOyviJv8KEv0p/lFkhSkdneQrvTwW3HdiMcBPC14wysyVZMjHPSG/uYl
 /40JA0apOAW7JKDlY/AGCbslFPiDrm2IkHdHtKv1ZZIEgiU9EEA3FVse2MaPmrhcFWA4
 N4CvuqnTTwKD5wkgmA08YiKN+KvZrW1pxGDyjHDUlPRxe10JKxsthw6Kxh0cOLRIdGWB
 GpTdflFKlfd+kQUdENC4N0QDHI4aVE2mm19dM5ff5fJNM5vcl/3Ke/cw6GqFZeMyrvp7
 f4fQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740081663; x=1740686463;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=iYztawKaqgCs1jBBL8aCGV4S7jTN2W8VewD3uAOZWFs=;
 b=uxYJMXFtMkHxYQGQbX4dSDL58a5eljWAooP0pgnIKRBIBM706tJfo44DujUUO9IHIj
 AU6jht+W7GDpIogpPUbPbf2RWF2Z2SKz9wkfBRXq9jPfptfBhB+rv4U9AWzDApMViP5G
 WyoYnW3Dgcvn7Laexk16kxRVupGqctxPVfx7XMObe69CLf+Df+2L+uyBbcI9os8Mr0V1
 cAtmgXri+G3fdMNibnokZOf5MHiNMfEKjRE9xdikfe0nGYM9PSsnlupGO+bzqDJ7SmBs
 GjA5Jew0VL9nanEY2c5hlWfu2OWUsEv+5OVHGYcv9Ab2T6DhDPCCWkOtkuWX+3QgawL4
 rD6g==
X-Forwarded-Encrypted: i=1;
 AJvYcCXpfTULQ8eDFMSpQFQdQ0V3UpCeMZaZyM+MxGQbljQAlwTV5qfGdN+qPmnVV1gzwTv23PTpHw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxN66Kl/UBE/fK8UImY/IUpFARu8A0BHv2NX46VjKY++TJsmXmG
 wQcy3WNFvr3+EP94DWZS6zeJUc/Xe57aF0iDZtUMCyRfKArQXDGq7BrT/Q==
X-Gm-Gg: ASbGncuYjm2dh+DUNI9rm4FEoeNEzIOPG2CkeVttVYJ+/CpBDeHTXXcmF/29uZAj0ky
 f3ikVsqYDKENkuJzDNZfsnlmdxzwyhW6dVM9wuDjLMY/EOgKG+1l0MwYSwQHMVib9oqqnNfM7Ho
 mDJNE9VNNcdh9HqJvV35JlB8S29s7NUj1rSXoTiZSnXhvCFxIiOfjCp/yHZhFwo3OtswodCHg33
 j1zfJew2r6B+PhjRH7AzU/AFrH2PbuwQFSkiLlPbIte5eEcRaogu+6yYpOJF4Aot9Aa52oSgAnB
 flq9byTZ4Wdx4kzZYSJCq9csR8kAqw==
X-Google-Smtp-Source: AGHT+IHDhn/RfjDyLVdUPqQ6KawG9tVYL9JeRJ/6JLEx1shcE8duMZ9LmrAhZq/urIKAuUSbOKjnUw==
X-Received: by 2002:a17:907:7242:b0:abc:4b7:e3d3 with SMTP id
 a640c23a62f3a-abc09abed3fmr62686366b.27.1740081662690; 
 Thu, 20 Feb 2025 12:01:02 -0800 (PST)
Received: from krug (87-196-76-63.net.novis.pt. [87.196.76.63])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-abb916db37bsm916307666b.165.2025.02.20.12.01.01
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Feb 2025 12:01:02 -0800 (PST)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Kevin Brubeck Unhammer <unhammer@HIDDEN>
Subject: Re: bug#76423: Major-mode provided LSP server for Eglot
In-Reply-To: <87v7t4evhy.fsf@HIDDEN>
References: <jwvcyfd7jzw.fsf@HIDDEN>
 <87wmdl4n6u.fsf@HIDDEN>
 <jwv34g97fa8.fsf-monnier+emacs@HIDDEN>
 <875xl4udg7.fsf@HIDDEN> <87v7t4evhy.fsf@HIDDEN>
Date: Thu, 20 Feb 2025 20:01:15 +0000
Message-ID: <87msegfks4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76423
Cc: 76423 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Kevin Brubeck Unhammer <unhammer@HIDDEN> writes:

>>>> Wouldn't the patch make harder for the users to customize Eglot to use
>>>> their preferred LSP server instead of the server suggested by the major
>>>> mode?
>>>
>>> Could be, tho it depends.
>>
>> To me it seems both the current and the proposed approaches are too
>> complex for newbies, but quite straightforward to write with a little
>> bit of elisp knowledge.  So maybe it is enough to add some simple
>> examples to the documentation.

Who wrote this?  I agree :-)

>> Or we could have two variables defining server-programs:
>> eglot-user-server-programs and eglot-server-programs (alternatively
>> eglot-server-programs and eglot-default-server-programs.  Where the
>> former is only set by the users and it takes precedence over the latter
>> if there is a match in it.  But it is possible that I'm once again
>> overthinking this.

No.

> I would prefer that solution over users having to understand and/or
> copy-paste lambdas, eval-after-loads and setq-locals.

Please see my reply to Stefan.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76423; Package emacs. Full text available.

Message received at 76423 <at> debbugs.gnu.org:


Received: (at 76423) by debbugs.gnu.org; 20 Feb 2025 19:59:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 20 14:59:43 2025
Received: from localhost ([127.0.0.1]:41850 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlChy-0007lD-Ss
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 14:59:43 -0500
Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:49391)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>)
 id 1tlChv-0007js-Q9
 for 76423 <at> debbugs.gnu.org; Thu, 20 Feb 2025 14:59:41 -0500
Received: by mail-ed1-x52b.google.com with SMTP id
 4fb4d7f45d1cf-5deb1266031so2480685a12.2
 for <76423 <at> debbugs.gnu.org>; Thu, 20 Feb 2025 11:59:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740081573; x=1740686373; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=oeJcMIAbp8o4m3M70VwUV4DIIKMqCUnhiCr2rj7tx1Y=;
 b=NdWKOVZ8HHYaVeXs3jbGYKAaspPTAXh0UQHliloabpkLfLL2wMBRxoF38mWvoz7Ik5
 VkVOtRVObEOl1xfM84y1eXcuGl2h/87CivobzH/h+EUjFrVSPbbDamPIxDfJjOMl+E30
 XgsqFBk7KSPkhWb/Cq47c+JDFDochVDPHSGesUHRKZMj8lBYZBe+KcaZIwApoG/2R5Cr
 4ho4NG9pDGlzIRyWNfZQ8RrtGF2SibSs3o6yjOfRlW00vDIsm5yMoh2G8Mwz2DZuTRjy
 J2hg04Zxje41kWwF+SslG53g7FGj+lxB35Qas/POhSMZwAow48+IFKPcrmbr9V9qfkl1
 +AWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740081573; x=1740686373;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=oeJcMIAbp8o4m3M70VwUV4DIIKMqCUnhiCr2rj7tx1Y=;
 b=Cj8V6WGsGoIVohZPOglME7J7J35R0TuyUyJTZg/aS88DwrwF7hmQt9JUKUejUzvQ69
 CTRzGnqB8+DHkWAOrclku8boj35tQLrL/5bYCwJy8cD851Y3n6Wtr2R9T4ojpkrKbYpu
 OKEqibBgOCl21m6XO8+Tb0CjsH3oheIlnK1ShfRiRXcMUVeZcPaAecTLLDmFcWKkwIOi
 83ZOglEfTu2E5mejEYYT0NY41fCROGT37UJYhoU9YOhvzFqEJb2ZTKq7ESykUCvw306C
 5HdNkpt7kRMw2FS3dcW2ShcNuI2i3mGkE7sDOXAQREmOsMg1ZWWT8ZZ/hN808qUnDz3N
 +/iQ==
X-Gm-Message-State: AOJu0YxoFA+jsm+I81LctcEl/UJc9w9Fap+ryKWEiYd3vaoEQ71osmpK
 Cv0npOdvomj/RjZ6qG5WFV23i88bYdcMVguoK0YLn22pR0IuSATL
X-Gm-Gg: ASbGncuHpoezGTgsidYDRp+TZ58m4umprI75zlSVj2JDmyLsKFj50W3eu0cRC+6c7f0
 8XpprXL79jLcUhkE0CfoPmAtzqD90DBWYiThTT33jYYnhUMLasEjqa+KM1i+FB1tQRcmVn3qsTF
 q9qKtHEOeN12hrziikKbTU629ggN61LGC26XXQAj9QigmeVOELl/e8wVqPVgzAJs5VO1GvMwxvi
 tbZo7JA1Y3Q8xQEKGSkhARonMrMHXMgKqgo1QIK/hZrjni7UGeKYT+fZoRLnjGyq5wxURhnOfvU
 fRQOiBsPaaBXxD0HRJl/J1e4+rqvug==
X-Google-Smtp-Source: AGHT+IEdlu4hu8iLNPeSk9Uw6TvJ4qZDOUbMOsp8SA7xWb4DlU0hfl8Lf36iZQAp1ETBGH5Y8lZqxQ==
X-Received: by 2002:a05:6402:3583:b0:5e0:9ffa:1348 with SMTP id
 4fb4d7f45d1cf-5e0b70cb619mr171810a12.2.1740081573178; 
 Thu, 20 Feb 2025 11:59:33 -0800 (PST)
Received: from krug (87-196-76-63.net.novis.pt. [87.196.76.63])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5dece286861sm12345498a12.67.2025.02.20.11.59.31
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Feb 2025 11:59:31 -0800 (PST)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#76423: Major-mode provided LSP server for Eglot
In-Reply-To: <jwvcyfd7jzw.fsf@HIDDEN>
References: <jwvcyfd7jzw.fsf@HIDDEN>
Date: Thu, 20 Feb 2025 19:59:44 +0000
Message-ID: <87r03sfkun.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76423
Cc: Kevin Brubeck Unhammer <unhammer@HIDDEN>, 76423 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

Hi Stefan,

> The patch below would let this major modes do it with a simple:
>
>       (setq-local eglot-server-programs
>                   `(bicep-ts-mode . ("dotnet"
>       ,(bicep-langserver-path))))

You mean eglot-server-program, singular (that's what your patch proposes)

Anyway, your patch is more or less what I had in mind altough:

* The name should probably be something less confusable with
  e-s-programs, like eglot-suggested-servers or eglot-preferred-servers
  (note that it can still be "servers!" unless we purposedly cap that
  ability, which we maybe should).

* It's a bit silly to repeat the major-mode symbol in it.  So the
  setting in the major-mode function should be something like

    (setq eglot-suggested-servers '("dotnet" ,(bicep-langserver-path)))

As to the precedence logic which you all discussed in the following
emails, I think it is indeed a problem.  But I don't see a problem in
prioritizing eglot-suggested-servers.

* The user can always nullify it with a

   (add-hook 'foo-mode-hook
     (lambda () (setq eglot-suggested-server nil)))

  I don't see this as a hindrance and I don't want to add much extra
  logic to Eglot to manage this for users afraid of add-hook.  The Eglot
  manual already uses these add-hook snippets and as long as people know
  to copy-paste.  If people want to the use-package macro magic to keep
  themselves ignorant of how Emacs works, I think that's a mistake, but
  this shouldn't stop them.

* Nevertheless it should be possible to add some logic to eglot.el to
  discover if the e-s-programs variable has been modified.

* It's important to note that this effort by itself won't bring many
  advantages until major-modes can somehow know during their normal
  working that eglot-suggested-servers hasn't been touched and that a
  particularly friendly server has effectively been started (either by
  M-x eglot or by the major mode itself, with appropriate care).  Then,
  foo-mode will be able to provide specific `M-x foo-thingamabob`
  commands that make use of an LSP connection, much like python.el or
  ruby-mode.el provide commands to send a region to the interpreter,
  etc.

* I'm against adding eglot-server-user-programs or somesuch as someone
  is proposing.  I only want to add a new variable to be settable by the
  major mode.  And ideally it should come with examples of major-mode
  patches with such added functionality for the "friendly server", else
  what is the point of having the major mode even set it?

Jo=C3=A3o

PS: something that I didn't mention in my recent reply to a patch about
this in the mailing list by Philip Kaludercic (posted to emacs-devel I
think) is that none of these efforts shall break eglot.el from being
compiled and loaded in older Emacsen (his patch did that).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76423; Package emacs. Full text available.

Message received at 76423 <at> debbugs.gnu.org:


Received: (at 76423) by debbugs.gnu.org; 20 Feb 2025 10:55:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 20 05:55:19 2025
Received: from localhost ([127.0.0.1]:60948 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tl4D8-00073y-Dv
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 05:55:18 -0500
Received: from fforwardl-b2-smtp.messagingengine.com ([202.12.124.193]:45047)
 by debbugs.gnu.org with esmtps
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2)
 (envelope-from <unhammer@HIDDEN>) id 1tl4D5-0006y4-Cu
 for 76423 <at> debbugs.gnu.org; Thu, 20 Feb 2025 05:55:16 -0500
Received: from phl-compute-09.internal (phl-compute-09.phl.internal
 [10.202.2.49])
 by mailfforwardl.stl.internal (Postfix) with ESMTP id AD40322C064F;
 Thu, 20 Feb 2025 05:55:08 -0500 (EST)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-09.internal (MEProxy); Thu, 20 Feb 2025 05:55:08 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
 1740048908; x=1740135308; bh=bQAtBiySYrNZL9ttucgnw5YbyKlVd8SNssA
 duLx1REY=; b=WqMkdy+Nioy8QhHi96AbtmXkmSFSR2R+SG+CkU3jKkzy28tFeVa
 M4BKozP4SV6tj7s5OLl2r1bFzC9B6tcipqaXxhdbVeCx0UTulPDr9FTSyi1Wscli
 jdaftpXTGzUveHGZtvEquB8V96owpLuXnO1mk5rmQ0bQKkmYyr//3vZDYDwgMF+7
 IAEQ4PgOLlgixBUTQVdkztMN7BctV1WL23U8+aM0X5QtKXfhoHE3Gu+78jMHgnPj
 J4Cw1NpcM4jpXolANzexWrWXUSfOQEOCsz1iXfH7fphaclk1mPdLmrgIrYwx3l95
 ZlKf/7J2kCKpuwQaq4q954veVNr55c5Li0g==
X-ME-Sender: <xms:Cwq3Z2AhpGW5roP75WABflJVHYEvY8TMmC7ngXMsxyRIDJ23-pAuCg>
 <xme:Cwq3ZwiSVAlfWNuZ5fFDgPwPLLT9hKvxdkIaPQsg0GgK1oboDqWUA73gCmMJe979z
 u8t0dTYiO_rFg3R>
X-ME-Received: <xmr:Cwq3Z5m19XrvLYHsLh_rD1Ks4zxlqHFDv2Gg-vmW0ptkLxCFYPFVFNyCzA_IewE>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeiieeliecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhffkfgfgggtsehttdertddtredt
 necuhfhrohhmpefmvghvihhnuceurhhusggvtghkucgfnhhhrghmmhgvrhcuoehunhhhrg
 hmmhgvrhesfhhsfhgvrdhorhhgqeenucggtffrrghtthgvrhhnpeegvdffvdekffekteel
 jeeutdeltedtvdejleevtdethefggffhfedtvdffieettdenucevlhhushhtvghrufhiii
 gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehunhhhrghmmhgvrhesfhhsfhgvrdho
 rhhgpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope
 hjohgrohhtrghvohhrrgesghhmrghilhdrtghomhdprhgtphhtthhopeejieegvdefsegu
 vggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruh
 hmohhnthhrvggrlhdrtggrpdhrtghpthhtohepfhgvlhhitghirghnrdhnvghmvghthhes
 ghhmrghilhdrtghomh
X-ME-Proxy: <xmx:Cwq3Z0w0tXdhdeoiwk6KP6DIe-vvbOuaIvjBeL_sfOPd2P7HhDKaXQ>
 <xmx:Cwq3Z7RQdx_Pl9q-coOrGLgWAy9cy_Z1GQ9JtD0epKxQ5BF-yX-e5w>
 <xmx:Cwq3Z_awJZdPoFe5sP4GYTGa5M9l2QD9umPagYR3UiEwAvppZ20jLQ>
 <xmx:Cwq3Z0TubiH5Ho24eWQ3g1qmACR2v9uQ41q47OsPQI1S61-Mr5twfg>
 <xmx:Cwq3Z9BXrY0cu8i-xXo3xUu138umtO66uB98FA0NtWGQ5p-NESsatQ>
 <xmx:DAq3Z6Ge3OFalraN963LnLztnFmZWSx8UCAgjym7sVFa1XenIJji0upt2-Th>
Feedback-ID: i26a44175:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 20 Feb 2025 05:55:06 -0500 (EST)
From: Kevin Brubeck Unhammer <unhammer@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#76423: Major-mode provided LSP server for Eglot
In-Reply-To: <875xl4udg7.fsf@HIDDEN> (Felician Nemeth's message of
 "Thu, 20 Feb 2025 11:18:16 +0100")
References: <jwvcyfd7jzw.fsf@HIDDEN>
 <87wmdl4n6u.fsf@HIDDEN>
 <jwv34g97fa8.fsf-monnier+emacs@HIDDEN>
 <875xl4udg7.fsf@HIDDEN>
Date: Thu, 20 Feb 2025 11:55:05 +0100
Message-ID: <87v7t4evhy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 76423
Cc: 76423 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

>>> Wouldn't the patch make harder for the users to customize Eglot to use
>>> their preferred LSP server instead of the server suggested by the major
>>> mode?
>>
>> Could be, tho it depends.
>
> To me it seems both the current and the proposed approaches are too
> complex for newbies, but quite straightforward to write with a little
> bit of elisp knowledge.  So maybe it is enough to add some simple
> examples to the documentation.
>
> Or we could have two variables defining server-programs:
> eglot-user-server-programs and eglot-server-programs (alternatively
> eglot-server-programs and eglot-default-server-programs.  Where the
> former is only set by the users and it takes precedence over the latter
> if there is a match in it.  But it is possible that I'm once again
> overthinking this.

I would prefer that solution over users having to understand and/or
copy-paste lambdas, eval-after-loads and setq-locals.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76423; Package emacs. Full text available.

Message received at 76423 <at> debbugs.gnu.org:


Received: (at 76423) by debbugs.gnu.org; 20 Feb 2025 10:18:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 20 05:18:26 2025
Received: from localhost ([127.0.0.1]:60588 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tl3dS-00038I-Fc
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 05:18:26 -0500
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:42492)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <felician.nemeth@HIDDEN>)
 id 1tl3dQ-00037m-O7
 for 76423 <at> debbugs.gnu.org; Thu, 20 Feb 2025 05:18:25 -0500
Received: by mail-wm1-x32f.google.com with SMTP id
 5b1f17b1804b1-4399ee18a57so4392235e9.1
 for <76423 <at> debbugs.gnu.org>; Thu, 20 Feb 2025 02:18:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740046699; x=1740651499; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=ieBboMO0SaS5Q0s/3ubaOEy/gkS/hYJEIZToi312f5Y=;
 b=QtR3nddfVY91dKkXbEWdkS0JPAwuFKhoFKu/8ByUT5iRt3SOdB6VOZgIoLRgl60sx3
 P/N2HrOPFLaEMSdlhgaw+FjtdSVdWhYOwfpT3KKVxzqWXqOQLipq/68Z2JqIpKBQRbKR
 oFjGFtnfyvp693zltvu6topPvJSNzUlB5gaPoMaXqZcVVxv9qiZiYSARFbP5VlfVrxC0
 Z1jDYgB2mBa/aE3mAfb+XGRtioYzN5vJLEHzN9eZG/ktqsGzvuP3+YpwqqiQClhGf87K
 4wJkRKieUmBaoxMR7vr6/xlbHVUQkld1fBasQPrjtLObJoC7c7KXl46FNzdhu0PDkDom
 2/qQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740046699; x=1740651499;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=ieBboMO0SaS5Q0s/3ubaOEy/gkS/hYJEIZToi312f5Y=;
 b=jzco8qLf31lLwQpM8TKfqHwzSzno+jGXfIVWYcto5yj0MamHZLNJ4ytS89MPYi6Y3C
 9k/p0cXpY8Yi81Idpqm3pDw42moBVJurlDFiOUR2/4xnw6OeoQnyia+GX1jrLQCUNPi9
 1pPCXNlUGeVTBFOs5MPN2dMkm6uQ9eBUbgNcZ5zp2D+fuZ7IIMKjcJkhx0GkCCawhjYH
 TRi71wz9NRAzjv3j+8i59NwTAl/353lRSVw6YXBk/Oln4qyapCGxOI97HQLXsZjKyT41
 t+gio+cqb8TF/QZLDGRHLvqOD3JkbTrnDHd95M4QOz9uIBatTQ6+W/Xga+LH3GfZ/P8a
 6xww==
X-Gm-Message-State: AOJu0Yw97ImAQP7ODxQf9D/me5lJlGiTRL5jSH/+mwJY9RaapSQhPNJn
 VJxrq9VKY1MFm3GZqpdgqnFy1RL/2UtO3iy+HFXFiZAZNNpxD8Yu
X-Gm-Gg: ASbGncuEkPmqNeJtRpc2fvJK4cfV39sfYwaMySIYe+To/qwoeOX2+IyONIwgXbcH3OF
 vf05JgUxZneg7Np8WDChd5SQpQ7lSdQCTrNpjaD4wM+yXxhg0kS0edxTXyMfXJ4QeTMPZpSxRdK
 IkH67E+ph2Fq2CVFsTgbCrWhNcdYKen+fGd1q69OeiVHnukYVyEDGcVoud0W3NNlcI+XxaEENlJ
 dxJPiZCNPWzuy6y+JXKmcEec8gKEWedbD6pP5wED/s8O2Zf3pGxXYsCzl6tCx2sAY0wBp50ZENy
 Ru9v0TEPiuXMPyqFw0za3jGUHTsf5A==
X-Google-Smtp-Source: AGHT+IE1PznVOwhJ3u+haDdNzZQiOZYzv7nU4NRqBqof55kqwhWRntg8sFe3xSRDuMP2ZSQDlFJNog==
X-Received: by 2002:a05:600c:4784:b0:439:8605:6d7c with SMTP id
 5b1f17b1804b1-439a2864c3cmr22018475e9.0.1740046698302; 
 Thu, 20 Feb 2025 02:18:18 -0800 (PST)
Received: from ulti.gmail.com ([2001:738:2001:407f:d329:3c92:fe6f:14c3])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-4398a64febasm97411145e9.1.2025.02.20.02.18.17
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Feb 2025 02:18:17 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#76423: Major-mode provided LSP server for Eglot
References: <jwvcyfd7jzw.fsf@HIDDEN>
 <87wmdl4n6u.fsf@HIDDEN>
 <jwv34g97fa8.fsf-monnier+emacs@HIDDEN>
Date: Thu, 20 Feb 2025 11:18:16 +0100
In-Reply-To: <jwv34g97fa8.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Wed, 19 Feb 2025 17:22:29 -0500")
Message-ID: <875xl4udg7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEWOdXElERN7LDLZs6/l
 0dDQq6TepMcqAAACW0lEQVQ4jWWSzY7bMAyEaSm6mypylxjkroTRvUW8d9lavf+r7NDOZotWQHzg
 lyGHP0Sn5ed9qKrLWWIWos9/QJWIeCSywPNTd/AE0LtwFj7A+3WT5PwfeBrQKcsBnkfwVcNySWQr
 3i34XN6gRNgis/v4uwSKHCD9lPitB0Aq9BHfHX4cgsI7cJJfLdZg/4bbCzoRmkD9MsagQSBDedZi
 CgNxkVSJmSOStTBUBKkywEnEoZzbwWj+ACiVJkF6pOpak2PMCqkMYDpaw+gatLR8atMOrB3JGzmm
 3rSQo+tkxU+UAbhQSgtslULhsXKk6+IyQ1QTzeQB0MzjlpkCEUCeUdviWrwBcxVqpZjP+v0MYPA0
 aq2rvIEZe4GRM0v+9QIB03rsABVSk5y+Mz3LSzExtJLlCCO6dV1uzDQFTBad+gO0TqqL9XE8x4ek
 +orvYiMJgzC8e+r6TqaPaK6QyqVNvoHtsRrooQ6tTi4vgaSkd8wIikodB3B0iIk58avsDdYNajpS
 bSKJ+mQnipGszB6zW4lGgsOkKHE2RWVcBpwhaIv3BYIAu3WsnC7YYKLRchp6w8fRGZIWiZuFsVai
 7gbcUcJEhiDZ3K1+uzZvBlfaEO8oH4MLu6/hrKVM7QpQcIXJFuC1XjfbfKRxNslk94l9cYcEihV2
 HWyNDQAXaLsvnrSyp7HaQhrAn13V6/XW11nh0XINBOEAV+tHK4EvAGNGvEwc0eZw8Vyr56imYEsV
 sOW9jxm/yb9AH1ufqGMviIK7A0Tc/723oM3tJ4HTOu9gDr3ftbdkxfdjsUv5AqWKwyfCYo5WAAAA
 AElFTkSuQmCC
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76423
Cc: Kevin Brubeck Unhammer <unhammer@HIDDEN>, 76423 <at> debbugs.gnu.org,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> Wouldn't the patch make harder for the users to customize Eglot to use
>> their preferred LSP server instead of the server suggested by the major
>> mode?
>
> Could be, tho it depends.

To me it seems both the current and the proposed approaches are too
complex for newbies, but quite straightforward to write with a little
bit of elisp knowledge.  So maybe it is enough to add some simple
examples to the documentation.

Or we could have two variables defining server-programs:
eglot-user-server-programs and eglot-server-programs (alternatively
eglot-server-programs and eglot-default-server-programs.  Where the
former is only set by the users and it takes precedence over the latter
if there is a match in it.  But it is possible that I'm once again
overthinking this.

Felici=E1n




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76423; Package emacs. Full text available.

Message received at 76423 <at> debbugs.gnu.org:


Received: (at 76423) by debbugs.gnu.org; 19 Feb 2025 22:22:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 19 17:22:44 2025
Received: from localhost ([127.0.0.1]:53932 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tksSp-0004eM-ME
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2025 17:22:44 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48107)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tksSk-0004dJ-8n
 for 76423 <at> debbugs.gnu.org; Wed, 19 Feb 2025 17:22:40 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 26E8244290A;
 Wed, 19 Feb 2025 17:22:31 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1740003750;
 bh=XloWYEc4B534V+4qgxKaqkXEmm7zO5X0gOoRx46Z2+c=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=O6y9Oo9K97EfqG7rOlswD9oYQvtAy9Axsk+Ox7xxqEzlCxfp5njCbVnAuLBdp2ziI
 rv3KAN54pPjEQXhJjk9CDajrh5FJMj1GX3nFstwd5prg8x1HXoaraS6nEqv24s71gZ
 eh4w4jfU6CFEqstBmGBqr9Vkk8+PgqGWXuq3P/Dlat5XZmUkrCjBItlQSVp0CAvtpj
 9eQ9WFqQ5SCqyM7jMV0jeHG/kC/1opk7QziEbNBoTRV2V6aYMVotanYo/uc2qkTojZ
 2aBG6cOeeNaFwf0orazuklaxaw/eMa8slpEUur8vjKO4GYcQb2Nltwzh8jZ3Hj4Bgx
 1ccPYl2uJBSfw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 02709442906;
 Wed, 19 Feb 2025 17:22:30 -0500 (EST)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E5BA61200BA;
 Wed, 19 Feb 2025 17:22:29 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#76423: Major-mode provided LSP server for Eglot
In-Reply-To: <87wmdl4n6u.fsf@HIDDEN> (Felician Nemeth's message of
 "Wed, 19 Feb 2025 22:52:25 +0100")
Message-ID: <jwv34g97fa8.fsf-monnier+emacs@HIDDEN>
References: <jwvcyfd7jzw.fsf@HIDDEN>
 <87wmdl4n6u.fsf@HIDDEN>
Date: Wed, 19 Feb 2025 17:22:29 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.213 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76423
Cc: Kevin Brubeck Unhammer <unhammer@HIDDEN>, 76423 <at> debbugs.gnu.org,
 =?windows-1252?B?Sm/jbyBU4XZvcmE=?= <joaotavora@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> Eglot should make it easier for major modes to suggest which LSP
>> server to use.
>
>> The patch below would let this major modes do it with a simple:
>>
>>       (setq-local eglot-server-programs
>>                   `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path))))
>
> Wouldn't the patch make harder for the users to customize Eglot to use
> their preferred LSP server instead of the server suggested by the major
> mode?

Could be, tho it depends.
AFAIK they can't use Customize to do that because packages (like
`bicep-ts-mode.el`) modify the variable outside of Customize's control,
so currently they have to do something like:

    (add-to-list 'eglot-server-programs '(bicep-ts-mode . MYSERVER))

which may need to be adjusted to

    (with-eval-after-load 'eglot
      (add-to-list 'eglot-server-programs '(bicep-ts-mode . MYSERVER)))

or

    (with-eval-after-load 'bicep-ts-mode
      (add-to-list 'eglot-server-programs '(bicep-ts-mode . MYSERVER)))

With the variable I suggest I guess they'd have to do

    (add-hook 'bicep-ts-mode-hook
      (lambda () (setq-local eglot-server-program '(bicep-ts-mode . MYSERVER))))

I know some people find `add-hook` and `lambda` more scary than
`eval-after-load` and `add-to-list`, so I guess it would count as
"harder", yes.

Maybe we should offer an actual `defcustom` variable for user overrides,
if we care enough.  Personally, I prefer to work on making the
`add-hook+lambda` approach more accessible, because it's just very
flexible and powerful, so it's much more generally useful.
One such effort is to use `use-package` or `setup`.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76423; Package emacs. Full text available.

Message received at 76423 <at> debbugs.gnu.org:


Received: (at 76423) by debbugs.gnu.org; 19 Feb 2025 21:52:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 19 16:52:39 2025
Received: from localhost ([127.0.0.1]:53610 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tkrzj-0001E8-2f
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2025 16:52:39 -0500
Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:61619)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <felician.nemeth@HIDDEN>)
 id 1tkrzc-0001CW-S1
 for 76423 <at> debbugs.gnu.org; Wed, 19 Feb 2025 16:52:34 -0500
Received: by mail-ej1-x633.google.com with SMTP id
 a640c23a62f3a-abb8045c3f3so38775966b.2
 for <76423 <at> debbugs.gnu.org>; Wed, 19 Feb 2025 13:52:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740001947; x=1740606747; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=G5IJPmFHOK47IvwcsEMxENqs/1xYuNXcibBjxC+ZjTE=;
 b=bM/5I8UYjIAl8QudEepvmxBYhF4bT8TqOJw8V4wgqoPxGBM/cxHx83tHO1MKFi934W
 wdL/63EYFZTS7V/5eP+gJl6zMwKoqZhIdzTACg797kSAoTZa2lfqBsnSdgPv6jkeemzM
 4LkNKFE2e5LwkKcddUwCSbvy2gYsB5FkA4QugFpYXMX4AI1sQrFQyA3n5oQ0dYmtNAir
 f9LBzB7285RovE/hFBw3SLqqNxpJU5T1dVmvi8TkcHR0sQH2bqUY+o/9X8K2lVb56zg6
 IvHGMlidRn2pgTs4SZ7LYnWF96Mxg7vh4STAKg1kl59lukpW3lhVD9Bv5M7U85g/oNy+
 /HaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740001947; x=1740606747;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=G5IJPmFHOK47IvwcsEMxENqs/1xYuNXcibBjxC+ZjTE=;
 b=Xw70Lhkj4UubtxnxGbnolhxk9+LwDzYhZW05Hj1tOXwH4J4dF4gvf5ByqbUpoEUTpH
 Crijw05R+zulW5GHRUd5yv3eGJXNB2/lifZvVhH84QF1ioxtYlLkNaFxHgpUuQiG/Wgh
 p0wLKRssCBi3+AXF4SRHkXZGg9aUSeeds4UGBE3bItTLUIDUHTipKArOxV8Ocr8ZKlQY
 fX5XCqe6gLUcSnCPCb0lZ4mwbQv47kGcImGt/JbJ99kXugGFWMHgoAARCAT2+Bi7XiSs
 ocOHR8QH0OhPYS3+UWZUAKAt+HnBxysNUB9rLqsdVd2+DdXxftq+0sOb+kSCUYpIrX+e
 CiDA==
X-Gm-Message-State: AOJu0Yx0j5yLnW5DPS1+5FvRhdZgwCGlIQM1F296+uYpM9s6gDUTDSTi
 GNiFdkClrNFxzclFzNS2IKwNy6F61Th2AMFS1AjQ1EJ9qbjFkmpp
X-Gm-Gg: ASbGncspKLih/nCAdqV/SQjvabxVDr2CfQW+O+C5OFIXCAFe/73qn92SIDwcE+2YJCd
 rfndM7txreXJ/hydmeZeqai6E4X4maqcp62odbEfylS+yxadkQSxqHET3dO8MmGNNW8mA8cj09y
 UN3aQLdmzcKTkU6lH6TFdFD8dklmrSTIc+tcl3e95GBHFGKdOJJTs7TC4b5zFAjCh9Q/QybIVae
 zMyeGFjqfGFJJSrWBVc5AB4XGXnTckEwe1rP36p1KAJo1nYZ1GApwis4QX6MOoNz5HJHLzsnNFZ
 UyGYRHKRDnhaM9RSJXZ8iOfymuUqs1NyeoZoJe2fj1yB1Au44HO6yD8yy2X9uZnXOoWK5XIn
X-Google-Smtp-Source: AGHT+IGQ2Jx0Oaiiie+LxngvkfqYs7Em51gOZxcHuaBMZHMKNVzACAC+qBTWJB0+H2YHRhF8fsrXEQ==
X-Received: by 2002:a17:907:6ea9:b0:abb:b294:6a2d with SMTP id
 a640c23a62f3a-abbcd0b9393mr487948166b.53.1740001946527; 
 Wed, 19 Feb 2025 13:52:26 -0800 (PST)
Received: from betli.gmail.com (catv-213-222-160-137.catv.fixed.one.hu.
 [213.222.160.137]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-abbac3242dcsm528066366b.107.2025.02.19.13.52.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 19 Feb 2025 13:52:26 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#76423: Major-mode provided LSP server for Eglot
References: <jwvcyfd7jzw.fsf@HIDDEN>
Date: Wed, 19 Feb 2025 22:52:25 +0100
In-Reply-To: <jwvcyfd7jzw.fsf@HIDDEN> (Stefan Monnier via's message
 of "Wed, 19 Feb 2025 15:33:07 -0500")
Message-ID: <87wmdl4n6u.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76423
Cc: Kevin Brubeck Unhammer <unhammer@HIDDEN>, 76423 <at> debbugs.gnu.org,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Eglot should make it easier for major modes to suggest which LSP
> server to use.

> The patch below would let this major modes do it with a simple:
>
>       (setq-local eglot-server-programs
>                   `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path))))

Wouldn't the patch make harder for the users to customize Eglot to use
their preferred LSP server instead of the server suggested by the major
mode?

Thanks,
Felici=E1n

>
> - Stefan
>
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index bd28174e7da..3aff922be1d 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -235,6 +235,10 @@ eglot-alternatives
>                        when probe return (cons probe args)
>                        finally (funcall err)))))))
>=20=20
> +(defvar-local eglot-server-program nil
> +  "Description of the server to use.
> +Follows the same syntax as any element of `eglot-server-programs', ")
> +
>  (defvar eglot-server-programs
>    ;; FIXME: Maybe this info should be distributed into the major modes
>    ;; themselves where they could set a buffer-local `eglot-server-progra=
m'
> @@ -354,7 +358,7 @@ eglot-server-programs
>=20=20
>  * In the most common case, a symbol such as `c-mode';
>=20=20
> -* A list (MAJOR-MODE-SYMBOL :LANGUAGE-ID ID) where
> +* A list (MAJOR-MODE-SYMBOL :language-id ID) where
>    MAJOR-MODE-SYMBOL is the aforementioned symbol and ID is a
>    string identifying the language to the server;
>=20=20
> @@ -1331,7 +1335,9 @@ eglot--lookup-mode
>                                          (replace-regexp-in-string
>                                           "\\(?:-ts\\)?-mode$" ""
>                                           (symbol-name sym))))))
> -   for (modes . contact) in eglot-server-programs
> +   for (modes . contact) in (if (null eglot-server-program)
> +                                eglot-server-programs
> +                              (cons eglot-server-program eglot-server-pr=
ograms))
>     for llists =3D (mapcar #'eglot--ensure-list
>                          (if (or (symbolp modes) (keywordp (cadr modes)))
>                              (list modes) modes))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76423; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Feb 2025 20:33:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 19 15:33:32 2025
Received: from localhost ([127.0.0.1]:52698 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tkql9-0000JM-P0
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2025 15:33:32 -0500
Received: from lists.gnu.org ([2001:470:142::17]:51280)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tkql7-0000IT-09
 for submit <at> debbugs.gnu.org; Wed, 19 Feb 2025 15:33:29 -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 <monnier@HIDDEN>)
 id 1tkql1-0008Uo-IF
 for bug-gnu-emacs@HIDDEN; Wed, 19 Feb 2025 15:33:23 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <monnier@HIDDEN>)
 id 1tkqkz-0004A1-LQ
 for bug-gnu-emacs@HIDDEN; Wed, 19 Feb 2025 15:33:23 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 240074428CF
 for <bug-gnu-emacs@HIDDEN>; Wed, 19 Feb 2025 15:33:19 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1739997197;
 bh=ZJSqmm56wUUic/2fvwbav46Wn6iQHGGEeW8f21Pnvi8=;
 h=From:To:Subject:Date:From;
 b=oHQltZxpQ46EHRX38lMqnl9wjHNPHjWl3fKHoKkCn5vPPhF2ihgRXkVCqFi1HNKyD
 4HSzGPty38UpJduAPzq1A0KEzkcx7iLKKUjQx1fu1Y+qgBncoZVdCI4X16JA/zz0K7
 SsrYaZ6y3KA/dT9iE2gdmUjzjrlfVO2yzbEo88dAhpp6SrfX5ReV6aYF28Kk1q/TnD
 Ad6+hb28belyAahzPRnlPisSjzw/g0A//nRKYLlUyVIM+TCmslAN2efOmge3FW1Ts4
 qlFc3lT0SD3fmef9OJh6FW8tMK3teSwKlSZyu8nzl3RhecBNtsxWCxCXFLD47N1VAn
 UCxi+lOjF0zHg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B7A024428CD
 for <bug-gnu-emacs@HIDDEN>; Wed, 19 Feb 2025 15:33:17 -0500 (EST)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A5CE012005D
 for <bug-gnu-emacs@HIDDEN>; Wed, 19 Feb 2025 15:33:17 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Major-mode provided LSP server for Eglot
X-Debbugs-Cc: monnier@HIDDEN,
 =?iso-8859-1?Q?Jo=E3o_T=E1vora?= <joaotavora@HIDDEN>,
 Kevin Brubeck Unhammer <unhammer@HIDDEN>
Date: Wed, 19 Feb 2025 15:33:07 -0500
Message-ID: <jwvcyfd7jzw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.534 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
 KAM_STOCKGEN              1.5 Email Contains Generic Pump & Dump Stock Tip
X-SPAM-LEVEL: 
Received-SPF: pass client-ip=132.204.25.50;
 envelope-from=monnier@HIDDEN; helo=mailscanner.iro.umontreal.ca
X-Spam_score_int: -42
X-Spam_score: -4.3
X-Spam_bar: ----
X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Tags: patch

Tags: patch

Eglot should make it easier for major modes to suggest which LSP
server to use.
Currently major modes end up doing funny dances like:

    branch: externals/bicep-ts-mode
    commit 8192a400fae45cdde32526f96bb7ed5158d98008
    Author: Kevin Brubeck Unhammer <unhammer@HIDDEN>
    Commit: Kevin Brubeck Unhammer <unhammer@HIDDEN>
    
        Wait with altering eglot-server-programs until eglot loaded
    ---
     bicep-ts-mode.el | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/bicep-ts-mode.el b/bicep-ts-mode.el
    index 204629b4c6..f047bccae0 100644
    --- a/bicep-ts-mode.el
    +++ b/bicep-ts-mode.el
    @@ -205,11 +205,11 @@ Return nil if there is no name or if NODE is not a defun node."
                                            . bicep-ts-mode))))
     
     ;;;###autoload
    -(and (boundp 'eglot-server-programs)
    -     (file-exists-p (bicep-langserver-path))
    -     (progn
    -       (add-to-list 'eglot-server-programs
    -                    `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path))))))
    +(eval-after-load 'eglot
    +  '(and (file-exists-p (bicep-langserver-path))
    +        (progn
    +          (add-to-list 'eglot-server-programs
    +                       `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path)))))))
     
     (provide 'bicep-ts-mode)

The patch below would let this major modes do it with a simple:

      (setq-local eglot-server-programs
                  `(bicep-ts-mode . ("dotnet" ,(bicep-langserver-path))))


- Stefan



--=-=-=
Content-Type: text/patch
Content-Disposition: attachment; filename=eglot-server.patch

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index bd28174e7da..3aff922be1d 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -235,6 +235,10 @@ eglot-alternatives
                       when probe return (cons probe args)
                       finally (funcall err)))))))
 
+(defvar-local eglot-server-program nil
+  "Description of the server to use.
+Follows the same syntax as any element of `eglot-server-programs', ")
+
 (defvar eglot-server-programs
   ;; FIXME: Maybe this info should be distributed into the major modes
   ;; themselves where they could set a buffer-local `eglot-server-program'
@@ -354,7 +358,7 @@ eglot-server-programs
 
 * In the most common case, a symbol such as `c-mode';
 
-* A list (MAJOR-MODE-SYMBOL :LANGUAGE-ID ID) where
+* A list (MAJOR-MODE-SYMBOL :language-id ID) where
   MAJOR-MODE-SYMBOL is the aforementioned symbol and ID is a
   string identifying the language to the server;
 
@@ -1331,7 +1335,9 @@ eglot--lookup-mode
                                         (replace-regexp-in-string
                                          "\\(?:-ts\\)?-mode$" ""
                                          (symbol-name sym))))))
-   for (modes . contact) in eglot-server-programs
+   for (modes . contact) in (if (null eglot-server-program)
+                                eglot-server-programs
+                              (cons eglot-server-program eglot-server-programs))
    for llists = (mapcar #'eglot--ensure-list
                         (if (or (symbolp modes) (keywordp (cadr modes)))
                             (list modes) modes))

--=-=-=--





Acknowledgement sent to Stefan Monnier <monnier@HIDDEN>:
New bug report received and forwarded. Copy sent to monnier@HIDDEN, joaotavora@HIDDEN, unhammer@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to monnier@HIDDEN, joaotavora@HIDDEN, unhammer@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#76423; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 20 Feb 2025 20:00:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.