GNU bug report logs -
#53952
27.1; insert-image sometimes unexpectedly truncates images
Previous Next
To reply to this bug, email your comments to 53952 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#53952
; Package
emacs
.
(Sat, 12 Feb 2022 10:13:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Markus Triska <triska <at> metalevel.at>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 12 Feb 2022 10:13:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
To reproduce this issue, please start Emacs with:
$ emacs -Q
and insert the following forms in the *scratch* buffer:
(defun insert-bar (width)
(let* ((height 5)
(data (with-temp-buffer
(insert (format "P1\n%s %s\n" width height))
(dotimes (_ height)
(insert (make-string width ?1) "\n"))
(buffer-string))))
(insert-image `(image :type pbm :data ,data)) "t"))
(progn
(insert "\n")
(dotimes (_ 3)
(insert-bar (/ (window-pixel-width) 3))
(insert " ")))
Then evaluate the forms with M-x eval-buffer RET.
The code is meant to insert 3 bars of equal length, each 1/3 of the
window size in pixels.
Unexpectedly, the rightmost bar is much shorter than the other two bars.
I say "unexpectedly", because the documentation of insert-image (which
is used to insert the image by the forms above) states:
"If SLICE is ‘nil’ or omitted the whole image is inserted."
Yet, even though SLICE is omitted in the forms above, the whole image is
apparently not inserted, only a smaller slice is inserted.
If possible, I would like to insert the entire image no matter where it
appears in the buffer, even if scrolling is necessary to reveal
remaining parts. Is there a way to do this?
Thank you a lot!
Markus
In GNU Emacs 27.1 (build 1, x86_64-apple-darwin15.3.0, X toolkit, Xaw scroll bars)
of 2020-12-12 built on mt-macbook
Windowing system distributor 'The X.Org Foundation', version 11.0.11502000
System Description: Mac OS X 10.11.3
Configured using:
'configure --prefix=/opt/local --disable-silent-rules --without-ns
--without-dbus --without-gconf --without-libotf --without-m17n-flt
--with-gmp --with-gnutls --with-json --with-xml2 --with-modules
--infodir /opt/local/share/info/emacs --with-x-toolkit=lucid
--without-xaw3d --without-imagemagick --with-xpm --with-jpeg
--with-tiff --with-gif --with-png --with-lcms2 --without-rsvg
--with-xft 'CFLAGS=-pipe -Os -arch x86_64'
CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib
-Wl,-headerpad_max_install_names -lfreetype -lfontconfig -Wl,-no_pie
-arch x86_64''
Configured features:
XPM JPEG TIFF GIF PNG GSETTINGS GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2
FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM
MODULES THREADS JSON PDUMPER LCMS2 GMP
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#53952
; Package
emacs
.
(Sat, 12 Feb 2022 12:32:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 53952 <at> debbugs.gnu.org (full text, mbox):
> From: Markus Triska <triska <at> metalevel.at>
> Date: Sat, 12 Feb 2022 11:12:37 +0100
>
> (defun insert-bar (width)
> (let* ((height 5)
> (data (with-temp-buffer
> (insert (format "P1\n%s %s\n" width height))
> (dotimes (_ height)
> (insert (make-string width ?1) "\n"))
> (buffer-string))))
> (insert-image `(image :type pbm :data ,data)) "t"))
>
> (progn
> (insert "\n")
> (dotimes (_ 3)
> (insert-bar (/ (window-pixel-width) 3))
> (insert " ")))
>
> Then evaluate the forms with M-x eval-buffer RET.
>
> The code is meant to insert 3 bars of equal length, each 1/3 of the
> window size in pixels.
>
> Unexpectedly, the rightmost bar is much shorter than the other two bars.
Emacs doesn't support wrapping of images, it never did. The display
engine chops images at the right edge of the window.
> I say "unexpectedly", because the documentation of insert-image (which
> is used to insert the image by the forms above) states:
>
> "If SLICE is ‘nil’ or omitted the whole image is inserted."
I added a note there about the forced truncation of images.
> If possible, I would like to insert the entire image no matter where it
> appears in the buffer, even if scrolling is necessary to reveal
> remaining parts. Is there a way to do this?
No, not with how we display images at this time.
This bug report was last modified 3 years and 123 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.