all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#53952: 27.1; insert-image sometimes unexpectedly truncates images
@ 2022-02-12 10:12 Markus Triska
  2022-02-12 12:31 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Triska @ 2022-02-12 10:12 UTC (permalink / raw)
  To: 53952

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






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

* bug#53952: 27.1; insert-image sometimes unexpectedly truncates images
  2022-02-12 10:12 bug#53952: 27.1; insert-image sometimes unexpectedly truncates images Markus Triska
@ 2022-02-12 12:31 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2022-02-12 12:31 UTC (permalink / raw)
  To: Markus Triska; +Cc: 53952

> From: Markus Triska <triska@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.





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

end of thread, other threads:[~2022-02-12 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-12 10:12 bug#53952: 27.1; insert-image sometimes unexpectedly truncates images Markus Triska
2022-02-12 12:31 ` 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.