Subject: 29.3.50; Shift up/down in buffer with images on M-x other-window with some fonts

From: Ramon Diaz-Uriarte <[email-masked]>
Date: Wed, 27 Mar 2024 21:25:34 +0100

With some fonts, changing focus (M-x other-window) from a buffer with images, makes the content in the buffer with images to shift up and down.

I am seeing this in Debian, with both the GTK and Lucid builds, under X11.

The code below reproduces the problem. This problem has been identified while debugging a change on focus issue with pdf-tools (https://github.com/vedang/pdf-tools/pull/224#issuecomment-2014151358 and ff.)

How to reproduce

- Copy the images to /tmp  (or place there three reasonably sized images, named image1.png, image2.png, image3.png)

- emacs -Q

- eval the following code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Place images in /tmp
(progn
  (defun pin-vscroll-down (win)
    (set-window-vscroll win 200 t))
  ;; Any of the following leads to the bug
  (set-frame-font "JuliaMono" nil t)
  ;; (set-frame-font "DM Mono" nil t)
  ;; (set-frame-font "Intel One Mono" nil t)
  (let* ((height (/ (* 2 (frame-pixel-height)) 15))
         (image1 (create-image "/tmp/image1.png" nil nil :height height))
         (image2 (create-image "/tmp/image2.png" nil nil :height height))
         (image3 (create-image "/tmp/image3.png" nil nil :height height)))
    (with-current-buffer (get-buffer-create "*image-scroll-test*")
      (insert " \n \n \n \n \n \n")
      (put-image image1 1)
      (put-image image2 5)
      (put-image image3 9)
      ;; With larger image sizes (goto-char 3)
      ;; also triggers the problem.
      (goto-char 11)
      (add-hook 'pre-redisplay-functions #'pin-vscroll-down nil t))
    (split-window-right)
    (other-window 1)
    (switch-to-buffer "*image-scroll-test*")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

- M-x other-window

- Notice how the images on the buffer on the right move up and down.

In GNU Emacs 29.3.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.18.0) of 2024-03-26 built on Phelsuma
Repository revision: 38faacf353fb4c8efb027019a4619a386edfe62c
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --disable-silent-rules --with-native-compilation=aot
 --with-json --with-xwidgets --without-xaw3d --with-x-toolkit=gtk3
 --with-xinput2 --with-tree-sitter
 --prefix=/home/ramon/Sources/emacs29-bin 'CFLAGS=-g -O2 -mtune=native
 -march=native' 'CC=ccache gcc''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  dogears-mode: t
  global-jinx-mode: t
  jinx-mode: t
  company-quickhelp-mode: t
  company-quickhelp-local-mode: t
  hideshowvis-minor-mode: t
  rainbow-delimiters-mode: t
  outli-mode: t
  outline-minor-mode: t
  symbol-overlay-mode: t
  display-fill-column-indicator-mode: t
  hl-line-mode: t
  display-line-numbers-mode: t
  company-tng-mode: t
  global-company-mode: t
  company-mode: t
  pixel-scroll-precision-mode: t
  which-function-mode: t
  recentf-mode: t
  vertico-indexed-mode: t
  vertico-prescient-mode: t
  prescient-persist-mode: t
  vertico-multiform-mode: t
  vertico-mode: t
  marginalia-mode: t
  helm-ff-icon-mode: t
  shell-dirtrack-mode: t
  helm-autoresize-mode: 1
  async-bytecomp-package-mode: t
  pulsar-global-mode: t
  pulsar-mode: t
  global-hl-todo-mode: t
  hl-todo-mode: t
  global-aggressive-indent-mode: t
  aggressive-indent-mode: t
  shackle-mode: t
  winner-mode: t
  global-anzu-mode: t
  anzu-mode: t
  savehist-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  electric-pair-mode: t
  which-key-mode: t
  minibuffer-depth-indicate-mode: t
  global-auto-revert-mode: t
  override-global-mode: t
  gcmh-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-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
  hs-minor-mode: t

Load-path shadows:
/home/ramon/.emacs.d/elpa/ef-themes-1.5.1/theme-loaddefs hides /home/ramon/.emacs.d/elpa/modus-themes-20240303.1023/theme-loaddefs
/home/ramon/.emacs.d/elpa/emacsql-sqlite-builtin-20240119.2314/emacsql-sqlite-builtin hides /home/ramon/.emacs.d/elpa/emacsql-20240124.1601/emacsql-sqlite-builtin
/home/ramon/.emacs.d/elpa/transient-20240226.2332/transient hides /home/ramon/Sources/emacs29-bin/share/emacs/29.3.50/lisp/transient
/home/ramon/.emacs.d/elpa/ef-themes-1.5.1/theme-loaddefs hides /home/ramon/Sources/emacs29-bin/share/emacs/29.3.50/lisp/theme-loaddefs
/home/ramon/.emacs.d/elpa/eldoc-1.15.0/eldoc hides /home/ramon/Sources/emacs29-bin/share/emacs/29.3.50/lisp/emacs-lisp/eldoc

Features:
(shadow sort virtual-auto-fill visual-fill-column adaptive-wrap
writegood-mode mail-extr emacsbug message yank-media puny rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mule-util tramp-cmds dogears
project bookmark text-property-search add-log jinx company-quickhelp
pos-tip hideshowvis rainbow-delimiters hideshow outli org-faces org-keys
oc org-compat org-version org-macs noutline outline symbol-overlay
display-fill-column-indicator hl-line display-line-numbers
company-abbrev company-dabbrev-code company-dabbrev company-keywords
company-files company-semantic company-template company-yasnippet
company-capf company-tng company pcase pixel-scroll cua-base
rdu-miscell-funcs modus-operandi-theme modus-themes
rdu-emacs-fonts-funcs-0 pdf-macs nerd-icons nerd-icons-faces
nerd-icons-data nerd-icons-data-mdicon nerd-icons-data-flicon
nerd-icons-data-codicon nerd-icons-data-devicon nerd-icons-data-sucicon
nerd-icons-data-wicon nerd-icons-data-faicon nerd-icons-data-powerline
nerd-icons-data-octicon nerd-icons-data-pomicon nerd-icons-data-ipsicon
which-func imenu recentf tree-widget vertico-indexed vertico-prescient
prescient char-fold vertico-multiform vertico marginalia helm-mode
helm-misc helm-files image-dired image-dired-tags image-dired-external
image-dired-util xdg image-mode dired-hide-permissions dired
dired-loaddefs exif tramp tramp-loaddefs trampver tramp-integration
files-x tramp-compat shell pcomplete comint ansi-osc parse-time iso8601
time-date helm-buffers all-the-icons all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons
data-alltheicons helm-occur helm-tags helm-locate helm-grep helm-regexp
helm-utils helm-help helm-types helm helm-global-bindings helm-core
async-bytecomp helm-source helm-multi-match helm-lib async
flycheck-grammarly grammarly websocket bindat request mailheader
mail-utils s dom exec-path-from-shell flycheck ansi-color find-func
pulsar pulse color hl-todo aggressive-indent shackle trace winner anzu
advice thingatpt savehist yasnippet transient format-spec compat
elec-pair cus-edit pp wid-edit hydra ring lv which-key pdf-loader
edmacro kmacro use-package-bind-key mb-depth comp comp-cstr warnings
icons rx autorevert filenotify time cus-load cl bind-key easy-mmode gcmh
cl-extra help-mode use-package-ensure use-package-core finder-inf info
ace-jump-zap-autoloads ace-jump-mode-autoloads ace-link-autoloads
ace-window-autoloads aggressive-indent-autoloads all-the-icons-autoloads
anaphora-autoloads anki-editor-autoloads anzu-autoloads
atomic-chrome-autoloads avy-autoloads bicycle-autoloads
buffer-move-autoloads burly-autoloads capf-autosuggest-autoloads
casual-autoloads citar-embark-autoloads citar-autoloads
citeproc-autoloads company-auctex-autoloads auctex-autoloads tex-site
company-math-autoloads company-prescient-autoloads
company-quickhelp-autoloads company-reftex-autoloads
company-shell-autoloads company-stan-autoloads
default-text-scale-autoloads deferred-autoloads deft-autoloads
dogears-autoloads dumb-jump-autoloads dwim-shell-command-autoloads
easy-kill-autoloads ef-themes-autoloads eglot-jl-autoloads
eldoc-box-autoloads eldoc-stan-autoloads elisp-demos-autoloads
emacsql-sqlite-builtin-autoloads embark-consult-autoloads
embark-autoloads eshell-syntax-highlighting-autoloads
eshell-vterm-autoloads ess-autoloads exec-path-from-shell-autoloads
expand-region-autoloads flycheck-grammarly-autoloads
flycheck-stan-autoloads flycheck-autoloads
flyspell-correct-helm-autoloads flyspell-correct-autoloads
gcmh-autoloads git-timemachine-autoloads google-this-autoloads
grammarly-autoloads haskell-mode-autoloads helm-bibtex-autoloads
bibtex-completion-autoloads biblio-autoloads biblio-core-autoloads
helm-c-yasnippet-autoloads helm-company-autoloads company-autoloads
helm-descbinds-autoloads helm-mu-autoloads helm-easymenu
helm-swoop-autoloads helm-autoloads helm-core-autoloads
helpful-autoloads elisp-refs-autoloads hide-mode-line-autoloads
highlight-indent-guides-autoloads hl-todo-autoloads hydra-autoloads
iedit-autoloads imenu-anywhere-autoloads jinx-autoloads
julia-repl-autoloads julia-ts-mode-autoloads julia-mode-autoloads
jump-char-autoloads lsp-latex-autoloads consult-autoloads
lsp-ui-autoloads lsp-mode-autoloads eldoc-autoloads lv-autoloads
magit-autoloads git-commit-autoloads marginalia-autoloads
markdown-toc-autoloads math-symbol-lists-autoloads mixed-pitch-autoloads
modus-themes-autoloads multiple-cursors-autoloads nerd-icons-autoloads
orderless-autoloads org-attach-screenshot-autoloads
org-download-autoloads async-autoloads org-modern-autoloads
org-roam-ui-autoloads org-roam-autoloads magit-section-autoloads
emacsql-autoloads org-side-tree-autoloads org-sidebar-autoloads
org-ql-autoloads f-autoloads org-sticky-header-autoloads
org-super-agenda-autoloads ht-autoloads ov-autoloads parsebib-autoloads
pdf-tools-autoloads pdfgrep-autoloads peg-autoloads poly-R-autoloads
poly-markdown-autoloads markdown-mode-autoloads poly-noweb-autoloads
polymode-autoloads popup-autoloads pos-tip-autoloads posframe-autoloads
pulsar-autoloads puni-autoloads queue-autoloads
rainbow-delimiters-autoloads request-autoloads rg-autoloads
rotate-autoloads scratch-autoloads shackle-autoloads
side-hustle-autoloads simple-httpd-autoloads spinner-autoloads
sr-speedbar-autoloads stan-mode-autoloads stream-autoloads
string-inflection-autoloads symbol-overlay-autoloads tablist-autoloads
transient-autoloads transpose-frame-autoloads ts-autoloads s-autoloads
dash-autoloads vertico-prescient-autoloads vertico-autoloads
prescient-autoloads virtual-auto-fill-autoloads adaptive-wrap-autoloads
visual-fill-column-autoloads vterm-autoloads vundo-autoloads
websocket-autoloads wfnames-autoloads wgrep-ag-autoloads wgrep-autoloads
which-key-autoloads whole-line-or-region-autoloads with-editor-autoloads
compat-autoloads workgroups2-autoloads writegood-mode-autoloads
yasnippet-autoloads zmq-autoloads ztree-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-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 xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
xinput2 x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 484796 318366)
 (symbols 48 30627 9)
 (strings 32 135401 49483)
 (string-bytes 1 4269554)
 (vectors 16 51708)
 (vector-slots 8 1089854 540164)
 (floats 8 1329 1287)
 (intervals 56 825 472)
 (buffers 984 12))

-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-31
Facultad de Medicina 
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid
Spain

Phone: +34-91-497-2412

Email: [email-masked]
       [email-masked]
       [email-masked]

https://ligarto.org/rdiaz