From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.bugs Subject: bug#66922: 29.1; No redisplay of buffer, even after using `force-window-update' Date: Fri, 3 Nov 2023 19:07:47 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000613a940609436208" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11767"; mail-complaints-to="usenet@ciao.gmane.io" To: 66922@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 03 19:08:46 2023 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 1qyyb8-0002r1-9o for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Nov 2023 19:08:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyyaw-00075L-Jo; Fri, 03 Nov 2023 14:08:34 -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 1qyyap-00074v-5b for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 14:08:28 -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 1qyyao-0002YL-Tz for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 14:08:26 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyybO-0004ZG-6X for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 14:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Nov 2023 18:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66922 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169903493117535 (code B ref -1); Fri, 03 Nov 2023 18:09:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Nov 2023 18:08:51 +0000 Original-Received: from localhost ([127.0.0.1]:59722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyybC-0004Yl-9h for submit@debbugs.gnu.org; Fri, 03 Nov 2023 14:08:51 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:47326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyybA-0004YV-ER for submit@debbugs.gnu.org; Fri, 03 Nov 2023 14:08:49 -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 1qyyaT-000710-3Y for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 14:08:05 -0400 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyyaQ-0002Pv-96 for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 14:08:04 -0400 Original-Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40806e4106dso14883855e9.1 for ; Fri, 03 Nov 2023 11:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699034878; x=1699639678; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=KgO3Mvpj0KRSGZXQAUx+RN81LhpuqTHw5Ixl+M7Blxc=; b=V8L1qVOx9qwJXykqnfGPdKvj+5Ijb8zQogf/T0a4zNuz8CYbTYSNvl2iVB6NdjIigm HeyXskD4YVe7KTJvMUAMZpa4Tm1ptHaDt+//VS4oz+eDuTOQlI5u1JYy+40ETZmUj19f wAn3BjJwoNuCZ/2IuMRsVjisiT3WLCGPBRjcE3NazJZZ8o41udqRK5ztxphsy5mBHrGV C5Jj5BB8ur2zBMNQy4fQ0MkTQn3UWp0KlFxsVYRKdsWZsRZY+iHxyXoQDuAs/zQQKDC+ TlCNUm63KqUl3Hi//lUFMzOQ7NwIjdi7nj4A2N/GhcV4Y6c93j0rtS8H839dLyPGhtbj znjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699034878; x=1699639678; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KgO3Mvpj0KRSGZXQAUx+RN81LhpuqTHw5Ixl+M7Blxc=; b=K9EDNpFtPr/vqMhSp9KqUe4Bznc5GgTxSOKEVfUHqZno9W3ToXnmZ+G1bd974F58CB E7zEuQU+vONIonrfvP3PyBiCQanj1h5rS892kXRjExpX+ILQkfwqVdKUxjPJplX9oQLA rSrBjLPXqzV6m0P4vvfna+ayCKiv/N/AnrgTtaG9JfyLcijaXaHXFekVlEVK1wpHfGgt KM45n9zS2PT/XTxs6nT3qRz7u8JTiTsrKn1Or230ZdfES18G183+VunxQsZj+++cMVY7 RCAfgr0lrRHC9+q1PIE6SNuo/hAymhuOBWv/hvMJAe4Zq8MAFEXPGKKRK8arp6b9sOAP uMJA== X-Gm-Message-State: AOJu0Yx0NyPUDJslmKlPx0QmtNZe/ZFMFNjSpctuR3H/56w43+gZ+2K6 0YTB2fUYxOUxO5pTseyWL3BlzbeejwmBBEYLmONZb33ZWhk= X-Google-Smtp-Source: AGHT+IHZ0oPXsqStY17vYSTcA2dNS54ya4wtoKhl8oDeYNOjF7Kn0PLd/N2VSLLrJtBtc2Pj/J6EbQFTjKpuCKs8IPQ= X-Received: by 2002:a05:600c:458f:b0:401:c8b9:4b86 with SMTP id r15-20020a05600c458f00b00401c8b94b86mr4139133wmo.9.1699034878260; Fri, 03 Nov 2023 11:07:58 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=dalanicolai@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:273719 Archived-At: --000000000000613a940609436208 Content-Type: text/plain; charset="UTF-8" I was trying to debug my 'image roll' package, that provides a 'virtual scroll' for displaying documents (i.e. books), when I encountered the following 'bug'. To reproduce it from emacs -Q, just evaluate the following code and press `C-c e`; note that relevant debugging output will be printed to the terminal: ``` (defun example () (interactive) ;; we make sure the warning buffer is already displayed, so that no ;; redisplay should occur on subsequent `lwarn' calls (lwarn 'test :error "Here we only display the error buffer") ;; now we pop to an `example' buffer in a new window and create a ;; bunch of `page placeholders' (starting with a 'red' placeholder) (pop-to-buffer "example") (dotimes (i 20) (let ((o (make-overlay (point) (progn (insert " ") (point))))) (insert "\n") (overlay-put o 'face (list :background (if (= (% i 2) 0) "red" "blue"))) (overlay-put o 'display `(space . (:width (600) :height (800)))))) ;; now we jump to some 'blue' placeholder (at buffer position 11), ;; currently offscreen, after which we try to update the ;; window-start position by redisplaying the buffer. To make sure ;; that the buffer will get 'redisplayed, we force it by calling the ;; `force-window-update' passing the `current buffer' as its ;; argument. Subsequently, we force trigger the `redisplay' by ;; calling `redisplay' while passing a non-nil `force' argument ;; Finally, we print the location of point and the location of ;; `window-start' to the terminal. Even though the `window-start' ;; position should have been updated by redisplaying the buffer ;; after calling `goto-char', it has not; it is still at 1 instead ;; of 11 (goto-char 11) (print (format "Start: %s" (current-buffer)) #'external-debugging-output) (force-window-update (current-buffer)) (print (redisplay t) #'external-debugging-output) (print (format "Point is %d" (point)) #'external-debugging-output) (lwarn 'test :error "This warning messes up the redisplay") (print (redisplay t) #'external-debugging-output) (print (format "Buffer is: %s, window start is: %d:" (buffer-name) (window-start)) #'external-debugging-output)) (global-set-key (kbd "C-c e") 'example) ``` The explanation and instructions are in the comments within the function. Additionally, I would like to mention that the 'bug' is due to the (second) call to `lwarn'. Without the call to `lwarn' a simple 'unforced redisplay' would have been enough to update the window-start. We could also comment out the first `lwarn', in that case the second `lwarn' triggers a redisplay, and the window-start gets updated. However, I would expect window-start to get updated by the `force-window-restart' and subsequently (force) triggering the redisplay. In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-08-09 built on 2a02-a45d-af56-1-666c-72af-583a-b92d.fixed6.kpn.net Repository revision: 31cef9a4eac01fff5ff4fcb89d7e2b7815e93bad Repository branch: HEAD System Description: Fedora Linux 38 (Workstation Edition) Configured using: 'configure --with-tree-sitter --with-modules --with-cairo --with-native-compilation --with-json --with-pgtk' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo gtk pgtk multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 78059 6306) (symbols 48 7107 0) (strings 32 19405 1985) (string-bytes 1 600357) (vectors 16 16172) (vector-slots 8 329170 15654) (floats 8 28 46) (intervals 56 344 0) (buffers 984 12)) --000000000000613a940609436208 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I was trying to debug my 'image roll' package, tha= t provides a 'virtual
scroll' for displaying documents (i.e. boo= ks), when I encountered the
following 'bug'. To reproduce it fro= m emacs -Q, just evaluate the
following code and press `C-c e`; note tha= t relevant debugging output
will be printed to the terminal:

```<= br>(defun example ()
(interactive)

;; we make sure the warning= buffer is already displayed, so that no
;; redisplay should occur on s= ubsequent `lwarn' calls
(lwarn 'test :error "Here we only = display the error buffer")

;; now we pop to an `example' b= uffer in a new window and create a
;; bunch of `page placeholders' = (starting with a 'red' placeholder)
(pop-to-buffer "exampl= e")
(dotimes (i 20)
(let ((o (make-overlay
(point)<= br> (progn (insert " ")
(point)))))
(in= sert "\n")
(overlay-put o 'face (list :background (if (= =3D (% i 2) 0)
"red"
= "blue")))
(overlay-put o 'display `(space . = (:width (600) :height (800))))))

;; now we jump to some 'blue&#= 39; placeholder (at buffer position 11),
;; currently offscreen, after = which we try to update the
;; window-start position by redisplaying the= buffer. To make sure
;; that the buffer will get 'redisplayed, we = force it by calling the
;; `force-window-update' passing the `curre= nt buffer' as its
;; argument. Subsequently, we force trigger the `= redisplay' by
;; calling `redisplay' while passing a non-nil `f= orce' argument
;; Finally, we print the location of point and the l= ocation of
;; `window-start' to the terminal. Even though the `wind= ow-start'
;; position should have been updated by redisplaying the = buffer
;; after calling `goto-char', it has not; it is still at 1 i= nstead
;; of 11
(goto-char 11)

(print (format "Start: = %s" (current-buffer)) #'external-debugging-output)

(force-= window-update (current-buffer))
=C2=A0 (print (redisplay t) #'extern= al-debugging-output)

(print (format "Point is %d" (point)= ) #'external-debugging-output)

=C2=A0 (lwarn 'test :error &q= uot;This warning messes up the redisplay")
=C2=A0 (print (redisplay= t) #'external-debugging-output)
(print (format "Buffer is: %s= , window start is: %d:" (buffer-name) (window-start))
=C2=A0 =C2= =A0 =C2=A0 #'external-debugging-output))

(global-set-key (kbd &q= uot;C-c e") 'example)
```

The explanation and instructio= ns are in the comments within the
function. Additionally, I would like t= o mention that the 'bug' is due to
the (second) call to `lwarn&#= 39;. Without the call to `lwarn' a simple 'unforced
redisplay= 9; would have been enough to update the window-start.

We could also = comment out the first `lwarn', in that case the second
`lwarn' t= riggers a redisplay, and the window-start gets
updated. However, I would= expect window-start to get updated by the
`force-window-restart' an= d subsequently (force) triggering the
redisplay.



In GNU E= macs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
=C2=A0cai= ro version 1.17.8) of 2023-08-09 built on
=C2=A02a02-a45d-af56-1-666c-72af-5= 83a-b92d.fixed6.kpn.net
Repository revision: 31cef9a4eac01fff5ff4fcb= 89d7e2b7815e93bad
Repository branch: HEAD
System Description: Fedora = Linux 38 (Workstation Edition)

Configured using:
=C2=A0'confi= gure --with-tree-sitter --with-modules --with-cairo
=C2=A0--with-native-= compilation --with-json --with-pgtk'

Configured features:
ACL= CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LI= BSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG
RSV= G SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
XIM= GTK3 ZLIB

Important settings:
=C2=A0 value of $LANG: en_US.UTF-8=
=C2=A0 value of $XMODIFIERS: @im=3Dibus
=C2=A0 locale-coding-system:= utf-8-unix

Major mode: Lisp Interaction

Minor modes in effec= t:
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 eldoc= -mode: t
=C2=A0 show-paren-mode: t
=C2=A0 electric-indent-mode: t
= =C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mo= de: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t=
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 line-= number-mode: t
=C2=A0 indent-tabs-mode: t
=C2=A0 transient-mark-mode:= t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t
= =C2=A0 auto-compression-mode: t

Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message mailcap yank-medi= a puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derive= d epg rfc6068
epg-config gnus-util text-property-search time-date mm-dec= ode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailhead= er cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv= cl-extra
help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc204= 5
ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv<= br>eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
eli= sp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd
tool-bar = dnd fontset image regexp-opt fringe tabulated-list replace
newcomment te= xt-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow i= search easymenu timer select scroll-bar mouse jit-lock
font-lock syntax = font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic= indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tib= etan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek rom= anian slovak czech european ethiopic indian
cyrillic chinese composite e= moji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbr= ev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cu= s-face macroexp files window
text-properties overlay sha1 md5 base64 for= mat env code-pages mule
custom widget keymap hashtable-print-readable ba= ckquote threads dbusbind
inotify dynamic-setting system-font-setting fon= t-render-setting cairo
gtk pgtk multi-tty make-network-process native-co= mpile emacs)

Memory information:
((conses 16 78059 6306)
=C2= =A0(symbols 48 7107 0)
=C2=A0(strings 32 19405 1985)
=C2=A0(string-by= tes 1 600357)
=C2=A0(vectors 16 16172)
=C2=A0(vector-slots 8 329170 1= 5654)
=C2=A0(floats 8 28 46)
=C2=A0(intervals 56 344 0)
=C2=A0(buf= fers 984 12))
--000000000000613a940609436208--