GNU bug report logs -
#76186
31.0.50; (recenter 0) sometimes does not recenter as expected
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
To reproduce this issue, please start Emacs with:
$ emacs -Q
Then paste the forms below in the *scratch* buffer and evaluate them
with M-x eval-buffer RET.
The function `sometimes-not-recentering' (defined below) illustrates the
issue I want to show: Sometimes (recenter 0) works as expected, and
makes (window-start) the same as (point-max). But in some cases, the
recentering does not work as expected. In such a case, the function
throws an exception.
You can invoke the function as often as you want, using for example:
M-x sometimes-not-recentering RET
and then invoke the function over and over with:
C-x z z z z z z z z ....
until, at one point, we see in the minibuffer:
apply: Wrong type argument: stringp, not-recentered
in that case, do C-h e to see additional information in the *Messages*
buffer. For example, after the most recent tries I performed, I got:
window-start unexpectedly not at point-max (671 != 793) in run 3
This means that the recentering worked twice as expected, and then did
not work as expected in the third run. In some runs I performed with
earlier Emacs versions, recentering worked as expected 200 times and
more in a row, and then did not work as expected after that. After C-x z
z z ..., simply keep "z" pressed until the exception occurs.
The forms follow below. I would greatly appreciate your help with this.
Please let me know any time if you have any questions about this issue.
Thank you and all the best,
Markus
(defvar recentering-test-run 0)
(defun sometimes-not-recentering ()
(interactive)
(setq recentering-test-run (1+ recentering-test-run))
(let ((buf (get-buffer-create "sample")))
(switch-to-buffer buf)
(erase-buffer)
(save-excursion
(dotimes (i 100)
(insert (format "line %d\n" i))))
(let ((frame (make-frame `((parent-frame . ,(selected-frame))
(left . 200)
(top . 200)
(width . (text-pixels . 100))
(height . (text-pixels . 100)))))
(buf (get-buffer-create "buffer-in-frame")))
(with-selected-frame frame
(switch-to-buffer buf)
(erase-buffer)
(insert "Hello!"))
(redisplay)
(delete-frame frame)
(goto-char (point-max))
(insert "\n\n")
(recenter 0)
(redisplay)
(unless (= (window-start) (point-max))
(message "window-start unexpectedly not at point-max (%d != %d) in run %d"
(window-start) (point-max) recentering-test-run)
(setq recentering-test-run 0)
(error 'not-recentered t)))))
In GNU Emacs 31.0.50 (build 1, x86_64-apple-darwin18.2.0, X toolkit,
cairo version 1.17.6, Xaw scroll bars) of 2025-01-22 built on
mac-mini
Repository revision: 34166dcf9cbd961d4f53ce9029e179a21a12c001
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Mac OS X 10.14.2
Configured using:
'configure --with-x-toolkit=lucid --without-ns
CFLAGS=-I/opt/local/include/ LDFLAGS=-L/opt/local/lib
--with-xpm=ifavailable'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBXML2 MODULES NOTIFY KQUEUE PDUMPER PNG RSVG SQLITE3 THREADS
TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 LUCID
ZLIB
This bug report was last modified 89 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.