unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Donovan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 70193@debbugs.gnu.org
Subject: bug#70193: eglot: RFE: recenter buffer upon showDocument request
Date: Thu, 4 Apr 2024 09:17:13 -0400	[thread overview]
Message-ID: <CAPVWWDUeHsUpgUmXSBUcGtKxCpNBnaDf+f9-nXE-C2SsNMRsaw@mail.gmail.com> (raw)

In eglot 1.17, the LSP showDocument downcall opens the designated
file, moves the cursor to the designated position, and raises the
frame. One other thing it could do to make it easier to see where the
cursor is would be to recenter the buffer.

The patch below is a minimal fix; the discussion at
https://github.com/joaotavora/eglot/discussions/1382 suggests a couple
of possible refinements.

xtools$ git diff ~/.emacs.d/elpa/eglot-1.17/eglot.el{.bak,}
--- elpa/eglot-1.17/eglot.el.orig
+++ elpa/eglot-1.17/eglot.el
@@ -2460,6 +2460,7 @@ THINGS are either registrations or
unregisterations (sic)."
                ;; function, but `xref--goto-char' happens to have
                ;; exactly the semantics we want vis-a-vis widening.
                (xref--goto-char beg)
+              (recenter)
                (pulse-momentary-highlight-region beg end 'highlight)))))))
      (t (setq success :json-false)))
     `(:success ,success)))





             reply	other threads:[~2024-04-04 13:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 13:17 Alan Donovan via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
     [not found] ` <handler.70193.B.171223666917509.ack@debbugs.gnu.org>
2024-04-04 13:32   ` bug#70193: Acknowledgement (eglot: RFE: recenter buffer upon showDocument request) Alan Donovan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-04 14:43     ` Felician Nemeth
2024-04-05  9:07     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-05 13:53       ` Felician Nemeth
2024-04-07  7:30         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13  8:08           ` Eli Zaretskii
2024-04-13  9:10             ` Felician Nemeth
2024-04-13 16:36               ` Alan Donovan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17  9:15                 ` bug#70193: [PATCH] " Felician Nemeth
2024-04-17 12:13                   ` João Távora
2024-04-23  7:43                     ` Felician Nemeth
2024-04-23  9:27                       ` João Távora
2024-04-24 16:37                         ` Juri Linkov
2024-04-24 20:14                           ` João Távora
2024-04-27 10:25                     ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPVWWDUeHsUpgUmXSBUcGtKxCpNBnaDf+f9-nXE-C2SsNMRsaw@mail.gmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70193@debbugs.gnu.org \
    --cc=adonovan@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).