Subject: bug#77384: 31.0.50; Image slice is ignored on mode/header/tab line

From: David Ponce <[email-masked]>
Date: Sun, 30 Mar 2025 16:01:14 +0200

Hello,

While trying to horizontally scroll images on the header line, I
discovered that the display slice specification is ignored when an image
is displayed in the header (or mode or tab) line.  I wonder if this
might be a bug, or just an unsupported feature, since the manual says
nothing about this limitation (or I did not find it):

"‘(slice X Y WIDTH HEIGHT)’
      This specification together with ‘image’ specifies a “slice” (a
      partial area) of the image to display.  The elements Y and X
      specify the top left corner of the slice, within the image; WIDTH
      and HEIGHT specify the width and height of the slice.  Integers are
      numbers of pixels.  A floating-point number in the range 0.0-1.0
      stands for that fraction of the width or height of the entire
      image."

Following is a short recipe to eval in the *scratch-buffer*, that exhibits
the issue.  The expected sliced image is inserted in the current buffer,
but the whole image is displayed in the header line.

(let* ((img (find-image '((:file "splash.svg"))))
        (size (image-size img t))
        (h (frame-char-height))
        (y (- (cdr size) h h h))
        (txt (propertize " " 'display (list img `(slice 0 ,y 0.5 ,h)))))
   (insert txt "\n")
   (setq header-line-format txt))

Thanks!

In GNU Emacs 31.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
  3.24.43, cairo version 1.18.0) of 2025-03-30
Repository revision: 209b7e7444df5cb164679c0e55f46cba424ad13c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 40 (KDE Plasma)

Configured using:
  'configure --with-native-compilation=no'

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

Important settings:
   value of $LC_TIME: fr_FR.utf8
   value of $LANG: fr_FR.UTF-8
   locale-coding-system: utf-8-unix