all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#66922: 29.1; No redisplay of buffer, even after using `force-window-update'
@ 2023-11-03 18:07 dalanicolai
  2023-11-03 18:50 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: dalanicolai @ 2023-11-03 18:07 UTC (permalink / raw)
  To: 66922

[-- Attachment #1: Type: text/plain, Size: 5847 bytes --]

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))

[-- Attachment #2: Type: text/html, Size: 6833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-11-04 11:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-03 18:07 bug#66922: 29.1; No redisplay of buffer, even after using `force-window-update' dalanicolai
2023-11-03 18:50 ` Eli Zaretskii
2023-11-03 23:23   ` dalanicolai
2023-11-03 23:24     ` dalanicolai
2023-11-04  7:13     ` Eli Zaretskii
2023-11-04 11:07       ` dalanicolai
2023-11-04 11:17         ` Eli Zaretskii

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.