From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#70193: [PATCH] Re: bug#70193: Acknowledgement (eglot: RFE: recenter buffer upon showDocument request) Date: Tue, 23 Apr 2024 10:27:37 +0100 Message-ID: References: <1658f0ac-472f-4039-bf83-7abc31d77803@gmx.at> <878r1rgblr.fsf@betli.tmit.bme.hu> <4cdce8b3-66ea-4f16-b9ef-036466650eef@gmx.at> <867ch1r8g3.fsf@gnu.org> <8734rpmxup.fsf@betli.tmit.bme.hu> <87sezkcpua.fsf_-_@betli.tmit.bme.hu> <877cgobk24.fsf@betli.tmit.bme.hu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e9433f0616c02a7b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33778"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "Philip K." , martin rudalics , Eli Zaretskii , Alan Donovan , 70193@debbugs.gnu.org To: Felician Nemeth Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 23 11:29:10 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 1rzCSc-0008ZG-7F for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Apr 2024 11:29:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzCSI-0006V8-1Z; Tue, 23 Apr 2024 05:28:50 -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 1rzCSF-0006Uu-BI for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2024 05:28:47 -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 1rzCSF-0008U7-34 for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2024 05:28:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rzCSV-0005cj-Fw for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2024 05:29:03 -0400 X-Loop: help-debbugs@gnu.org 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: Tue, 23 Apr 2024 09:29:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70193 X-GNU-PR-Package: emacs Original-Received: via spool by 70193-submit@debbugs.gnu.org id=B70193.171386449721189 (code B ref 70193); Tue, 23 Apr 2024 09:29:03 +0000 Original-Received: (at 70193) by debbugs.gnu.org; 23 Apr 2024 09:28:17 +0000 Original-Received: from localhost ([127.0.0.1]:51024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzCRk-0005Ve-9J for submit@debbugs.gnu.org; Tue, 23 Apr 2024 05:28:16 -0400 Original-Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]:44442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzCRh-0005U9-TA for 70193@debbugs.gnu.org; Tue, 23 Apr 2024 05:28:15 -0400 Original-Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-51ab4ee9df8so5412108e87.1 for <70193@debbugs.gnu.org>; Tue, 23 Apr 2024 02:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713864470; x=1714469270; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lzJDEb2NRPXbMOHtJqJskrsnM+D0lFV8Lw0/x1oTzoQ=; b=kYAjRQxGuyYXpdYxZr2FkrQVOfl/czeupRO8ENo7iOooDQbZitBcKBASuJvs85ppMI Ai1cvfuPKTEvu4JmTMcTM2Z4gfHGdQc/gPAfWeei6sYPLLfw/On8kaMQqYlhGwTNUaxS JH1FAfilf6/58C34WRp32dzAgoc3nv+P9/CnNcwPw2nYvFgiLQpPDB3vaVArmRNWWV/P pXkI1xGzQZvkileCHDrK5di9RGWMZh93i8WB9myq0h6zYIvqW4SWnVNBqOpmibPZkS5+ Thorm1ngEgwJfHhTWFNz++3zhxqn5EyFfKFAxIs5vM7Ac1RzV1tWu6zQmet2JrwVwS3R cQfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713864470; x=1714469270; 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=lzJDEb2NRPXbMOHtJqJskrsnM+D0lFV8Lw0/x1oTzoQ=; b=qGPhifY24mr8pvcXi3c3hKi0TfPVPGNZ/C1NavBLap8pekwNgW9FZpRU8ilPY6Z9RH T+Ygyd+I74YTnCvS/ssBs+dme8RDF7vKADol9ajPKPztF4C5l4vwodAULhQXkGfn3SlO KeWChaRDH2Wx5WbYJsVF6zgaYfNo4bG0clLJRBzR5br+1b5G8uIcGunRt7kXrSauCFhU YHfjaSAFLL+t5Db/p6siHgSggbNV+XOOzR5hLBqis4P8UkYlnnx08ku1q0OaDRh4rcPl TpbKRpKUwjRZ7ak79b8uJiTJ/QvD+zbtlrqxE2B3CwLPeV9F7/3Lysnw0/X/WxzgflzM I7gA== X-Forwarded-Encrypted: i=1; AJvYcCWibJKdLGhLt+2b4XiUI2d6kqpgjVvvM7xH4QM9wUN5LLgejTDK6EiAkAv/WClNC7kyTTlvUkJIh9hEC0WeMrUMeXT0S6A= X-Gm-Message-State: AOJu0Ywf1Dqzip6Ud83ayDxuA7mj1k7bBBW1aTy7wv3U6zFFCUamLFZJ mryf53cKoxbjabrHQOljmiJgFiY2bZkBovMJFqUsWBtal3rTeA+S0kGflz/cq98izedBcgtYpp+ 4CGle7UypvN+/e8v2wG2t5r2Kbwg= X-Google-Smtp-Source: AGHT+IF+OtAE8OPtzwGbICBXqRcEj7Z1vmZyzhxKcEUNq92NWhC3Dq/J3c3agRK0lpZGeuvwEUp531suldL04qbzrA0= X-Received: by 2002:a05:6512:118e:b0:51b:4e3:1fa9 with SMTP id g14-20020a056512118e00b0051b04e31fa9mr5522751lfr.12.1713864469719; Tue, 23 Apr 2024 02:27:49 -0700 (PDT) In-Reply-To: <877cgobk24.fsf@betli.tmit.bme.hu> 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:283876 Archived-At: --000000000000e9433f0616c02a7b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 23, 2024 at 8:43=E2=80=AFAM Felician Nemeth wrote: > Jo=C3=A3o T=C3=A1vora writes: > > > I'm sure the patch is correct but 50+ lines of window-management code > > in eglot.el? > > I agree it can go elsewhere. > window.el seem like a good place. > > Just for that one user? > > I don't think that should matter. > What I meant is that if it goes into eglot.el it will be "just for that one [Eglot] user" . If it goes somewhere else, it's for more users. > There's nothing LSP-specific in the new function > > `eglot--window-recenter-region`, it's pure window management code. > > > > The derived-mode-p specifically bit also looks very much out > > of place in Eglot. What is it accomplishing, and why is this > > prog-mode exception not in the preceding function itself > > (maybe as an optional toggle) > > reposition-window relies on `beginning-of-defun' and `end-of-defun', but > it is potentially better than window-recenter-region, because if the > selection of showDocument is inside a function, then it tries to show > the preceding comments as well. > I see, more or less. So it's a further refinement specific to window-recenter-region specific to prog-mode buffers. Can it operate independently or does it have to come necessarily after a call to window-recenter-region? Regardless of the answer, I think it would be best placed in prog-mode.el or whereabouts. > > In fact, there's nothing intrinsically LSP-specific about having > > clients request Emacs shows the user a given part of a file. > > I can't believe this obscure LSP interface is its only client. > > Is it really? > > Maybe textDocument/publishDiagnostics is somewhat similar. Flymake > shows the region of the diagnostic messages with as little care as Eglot > currently shows the selection of showDocument. > Eh. Guilty as charged. So another user, showing Flymake diagnostics (not necessarily from LSP publishDiagnostics, mind you). > > * compat.el (I think Phil has already made Eglot use compat.el recently= ) > > * there's the strategy of using (or creating) another GNU ELPA :core > package > > (like external-completion.el and many other ones) > > * there' the strategy of 'fboundp' where this nice-to-have "excellent > > recentering" feature would only appear to Eglot users running it on > > a recent Emacs. > > I think the third option is good enough in this case. > It's a nice one. I think compat.el is not in Eglot just yet anyway. Jo=C3=A3o --000000000000e9433f0616c02a7b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Apr 23, 2024 at 8:43=E2=80=AFAM Felician Nemeth <<= a href=3D"mailto:felician.nemeth@gmail.com">felician.nemeth@gmail.com&g= t; wrote:
Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com> writes:
> I'm sure the patch is correct but 50+ lines of window-management c= ode
> in eglot.el?

I agree it can go elsewhere.

window.el = seem like a good place.
=C2=A0
> Just for that one user?

I don't think that should matter.

<= span style=3D"font-family:Arial,Helvetica,sans-serif">What I meant is that = if it goes into eglot.el it will be "just for that one [Eglot]=C2=A0
user= " .=C2=A0 If it goes somewhere else, it's for more users.=C2=A0=C2= =A0

> There's nothing LSP-specific in the new function
> `eglot--window-recenter-region`,=C2=A0 it's pure window management= code.
>
> The derived-mode-p specifically bit also looks very much out
> of place in Eglot.=C2=A0 What is it accomplishing, and why is this
> prog-mode exception not in the preceding function itself
> (maybe as an optional toggle)

reposition-window relies on `beginning-of-defun' and `end-of-defun'= , but
it is potentially better than window-recenter-region, because if the
selection of showDocument is inside a function, then it tries to show
the preceding comments as well.

I see, = more or less.=C2=A0 So it's a further refinement specific to=C2=A0
window-recenter-region specific to prog-mode buffers.=C2=A0 Can it op= erate=C2=A0
independently=C2=A0 or does it have to come necessari= ly after a call to=C2=A0
window-recenter-region?=C2=A0 Regardless= of the answer, I think it=C2=A0
would be best placed in prog-mod= e.el=C2=A0or whereab= outs.
=C2=A0
> In fact, there's nothing intrinsically LSP-specific about having > clients request Emacs shows the user a given part of a file.
> I can't believe this obscure LSP interface is its only client.
> Is it really?

Maybe textDocument/publishDiagnostics is somewhat similar.=C2=A0 Flymake shows the region of the diagnostic messages with as little care as Eglot currently shows the selection of showDocument.

Eh.=C2=A0 Guilty as charged.=C2=A0 So another user, showing Flymake= diagnostics
(not necessarily from LSP publishDiagnostics, mind y= ou).
=C2=A0