From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Donovan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70193: Acknowledgement (eglot: RFE: recenter buffer upon showDocument request) Date: Sat, 13 Apr 2024 12:36:41 -0400 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> Reply-To: Alan Donovan Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17422"; mail-complaints-to="usenet@ciao.gmane.io" Cc: martin rudalics , Eli Zaretskii , 70193@debbugs.gnu.org To: Felician Nemeth Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 13 18:38:25 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 1rvgOW-0004Hm-W4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Apr 2024 18:38:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvgO2-0008Rl-Qq; Sat, 13 Apr 2024 12:37:54 -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 1rvgO0-0008RF-D3 for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2024 12:37:52 -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 1rvgO0-0000j1-3q for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2024 12:37:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rvgOA-0006PA-DS for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2024 12:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Donovan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Apr 2024 16:38:02 +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.171302623924245 (code B ref 70193); Sat, 13 Apr 2024 16:38:02 +0000 Original-Received: (at 70193) by debbugs.gnu.org; 13 Apr 2024 16:37:19 +0000 Original-Received: from localhost ([127.0.0.1]:33708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvgNR-0006Ia-Ce for submit@debbugs.gnu.org; Sat, 13 Apr 2024 12:37:18 -0400 Original-Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]:36303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvgNM-0006Gf-3L for 70193@debbugs.gnu.org; Sat, 13 Apr 2024 12:37:16 -0400 Original-Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-36b0a277e4dso106145ab.1 for <70193@debbugs.gnu.org>; Sat, 13 Apr 2024 09:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713026215; x=1713631015; darn=debbugs.gnu.org; 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=81ZfsIQ/1NOQS1yghFgeU+Kh3hxAmz9mPrqAXM9oDsk=; b=jVal2ASu1qdAUhem5ygGTHKgqxc7+xPqHwhRUJ1QOCdZYCN/lDn+ds3cK/s2yOb7SY tW5R3kUe8hD9Hl+Z7NjMJEmrliwbCfm31I77tLVBuvfcePT7/3qZ93Jm4xXl/Mf/6Wdc VPrlJqr7SbEFM2VakAWNfzQAvrFlkHuG5eb65YvikVWk1X5mF3hHDVxqj0L5HdeO/d15 6Y16v0w0ug1ex5kvmxRvf6ploxecpp384q7o1iBCy/ZJlTCwQyQeZ7q4xS5ujNxub3cJ Kx2f7TA3dnOftXxxMcos0JYQEXHJcSONruIEZIvSRbNpXVkTlOOs4Zj1QDBNmshgthmk Ziow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713026215; x=1713631015; 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=81ZfsIQ/1NOQS1yghFgeU+Kh3hxAmz9mPrqAXM9oDsk=; b=PmeaoSGlYxAH6NpqMg3XMfFzhZxveT3ryrmkTr4xvEOSIL8qv2/w9IoCHcIu94+z+w dxKCcQnE2yy6EMZ7rmXzm31UBFtCT9pKpyGOsMHf5FUdEBP4TE9PwjyrEQC9TbhS3pu5 NqgLpjYLBdA4zSt9I22tojHPtV/77LIPkYyMN6Vef8EJqrMo8gZkbbWmzeVpIM+nu11j 8QIs4B7NiP7Df4WDiz5Evmf45VQhI/R3UQGTNm5vtQArsopcGrtCAHCdCgQRjUB0NvSe Dg67iYhLUBGM+M9OIR1bBoviSifjbKRFQB8X8BBVEcdeWzmlJV6U2EG6sOWNAdp3h/Zc 6Lzw== X-Forwarded-Encrypted: i=1; AJvYcCXkORIIbuL2h+sJ4aTNGu8Di2Y4bmqyrl/fu0sNHnUQTg1AE5FVK+bHm3M+1p4yPNwSHiWfF+w64ojpsAjzh6Ks7ZsR34w= X-Gm-Message-State: AOJu0YxzZ++r4JuFIlk6xUwuhIld8VRnGcflV4JUkASgb9qmFDYE3MZq MGU5yQsiuGqK85gTQH7dDBLfWuPJc2fFpu0djGMDZN4ewSw/4HD6n02/qOdsytZtShnAaPjH+Rv DG44KcXKyzUenRt0K8dqJjJCr/0/XLKOsbQT6 X-Google-Smtp-Source: AGHT+IGSxHFuB7BoQAmy2stLYmG28bI8kwNol/ToFu8yc2VAn3Qr5Clc2zID7KisR6tz2TmSWbwC5moNRFyuSNViNkE= X-Received: by 2002:a05:6e02:e4f:b0:36a:f36:7275 with SMTP id l15-20020a056e020e4f00b0036a0f367275mr114748ilk.25.1713026215495; Sat, 13 Apr 2024 09:36:55 -0700 (PDT) In-Reply-To: <8734rpmxup.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:283224 Archived-At: > Alan, can you check whether your use-case is better served with `reposit= ion-window' than with `recenter'? However, the LSP specification does not = guarantee that the target of showDocument is a source file, so Eglot needs = window-recenter-region for completeness. Also I don't know if reposition-wi= ndow supports every programming language or "go" in particular. Thanks, I wasn't aware of `reposition-window', but it looks like exactly what I want. I just tried it, and found that it positions the point at the top of the frame, but is sufficiently aware of the syntax of the language that if the point is in a declaration (as in my case) then it uses the start of the preceding doc comment, if any. It is clearly superior to recenter for my needs, and I would be quite happy to use it instead. On Sat, 13 Apr 2024 at 05:10, Felician Nemeth w= rote: > > Eli Zaretskii writes: > > >> Cc: Alan Donovan , 70193@debbugs.gnu.org > >> Date: Sun, 7 Apr 2024 09:30:02 +0200 > >> From: martin rudalics via "Bug reports for GNU Emacs, > >> the Swiss army knife of text editors" > >> > >> > But when I debug window-recenter-region-start-position, the height = is > >> > set to 0. The patch below seems to fix the problem. > >> [...] > >> > + (body-pixel-width (window-body-width window t)) > >> > + (body-pixel-height (window-body-height window t)) > >> > >> You're right. I meanwhile fixed the code to calculate how many lines = to > >> step backwards by using 'window-text-pixel-size' there too. So now th= is > >> should work with text scaling and varying line heights too. > >> > >> If you want to test it with 'recenter-region', then a rough estimate i= s > >> that the number of lines shown after the first "L:" should be equal to > >> or one less than the number of lines shown after the third "L:" in eac= h > >> message issued. > > > > I'm unsure how to proceed with this bug report. Should it be closed, > > or is there anything left to be done here, and if the latter, then > > what has to be done to resolve the issues? > > Sorry, I meant to write back earlier. I've done some limited test for > varying line heights as well, the patch seems to work well. The > question, I think, is whether this is generally useful enough to have a > polished window-recenter-region to be part of Emacs, or should it just > be added to Eglot. > > In the original report, showDocument requested to show a source code > file, where I think `reposition-window' would be more useful. Alan, can > you check whether your use-case is better served with > `reposition-window' than with `recenter'? However, the LSP > specification does not guarantee that the target of showDocument is a > source file, so Eglot needs window-recenter-region for completeness. > Also I don't know if reposition-window supports every programing > language or "go" in particular.