all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felician Nemeth <felician.nemeth@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Alan Donovan <adonovan@google.com>, 70193@debbugs.gnu.org
Subject: bug#70193: Acknowledgement (eglot: RFE: recenter buffer upon showDocument request)
Date: Fri, 05 Apr 2024 15:53:04 +0200	[thread overview]
Message-ID: <878r1rgblr.fsf@betli.tmit.bme.hu> (raw)
In-Reply-To: <1658f0ac-472f-4039-bf83-7abc31d77803@gmx.at> (martin rudalics via's message of "Fri, 5 Apr 2024 11:07:58 +0200")

Hi Martin,

> The attached 'window-recenter-region-start-position' should address
> that.  I am not aware of whether we have a function on master to get the
> line height of a specific window as if a specific buffer were displayed
> in it so I used 'frame-char-height' for the window in question.  The
> rest of the function is straightforward but there might be off-by-one
> glitches.

I have a not so recent build:
Development version e4d1739a2917 on HEAD branch; build date 2024-03-16.

But when I debug window-recenter-region-start-position, the height is
set to 0.  The patch below seems to fix the problem.

Thanks,
Felicián

--- /tmp/recenter-region.el~    2024-04-05 15:35:24.043123595 +0200
+++ /tmp/recenter-region.el     2024-04-05 15:47:55.430121441 +0200
@@ -19,8 +19,9 @@
                      (region-end))
                 (with-current-buffer buffer
                   (point-max))))
-        (body-width (window-body-width window))
         (body-height (window-body-height window))
+        (body-pixel-width (window-body-width window t))
+        (body-pixel-height (window-body-height window t))
         old-buffer old-start old-point height start)
     (unless (eq (window-buffer window) buffer)
       (setq old-buffer (window-buffer window))
@@ -29,7 +30,7 @@
       (set-window-buffer window buffer))
     (setq height
          (/ (cdr (window-text-pixel-size
-                  window from to body-width body-height))
+                  window from to body-pixel-width body-pixel-height))
             (frame-char-height (window-frame window))))
     (save-excursion
       (goto-char from)





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

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 13:17 bug#70193: eglot: RFE: recenter buffer upon showDocument request Alan Donovan via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [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 [this message]
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

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

  git send-email \
    --in-reply-to=878r1rgblr.fsf@betli.tmit.bme.hu \
    --to=felician.nemeth@gmail.com \
    --cc=70193@debbugs.gnu.org \
    --cc=adonovan@google.com \
    --cc=rudalics@gmx.at \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.