GNU bug report logs - #53952
27.1; insert-image sometimes unexpectedly truncates images

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Markus Triska <triska@HIDDEN>; dated Sat, 12 Feb 2022 10:13:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 53952 <at> debbugs.gnu.org:


Received: (at 53952) by debbugs.gnu.org; 12 Feb 2022 12:31:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 12 07:31:42 2022
Received: from localhost ([127.0.0.1]:33688 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nIrYq-0004ZL-9X
	for submit <at> debbugs.gnu.org; Sat, 12 Feb 2022 07:31:42 -0500
Received: from eggs.gnu.org ([209.51.188.92]:36402)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1nIrYp-0004UF-7c
 for 53952 <at> debbugs.gnu.org; Sat, 12 Feb 2022 07:31:31 -0500
Received: from [2001:470:142:3::e] (port=38578 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nIrYj-0001cr-Il; Sat, 12 Feb 2022 07:31:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=i3r4JnuzI4ltR7FZ/NObaXE38xw5ZyLipGcH0aTOy4Q=; b=gm59vgNCvBztTDLRXEkf
 1ZVDw2q4/EM2/Tk+5vL4brDm5jJMTH8mQYIvn0DHuphigacVVyHaP+j/5cEilFZdl5/nTUkVttMzk
 O6gi6GxkV1kgULGrI4oh/dHRetkNKAHPuMLYiE/TZreViYgTm9QfuKQdMVBgAyaAemhCMuUS/kjch
 Cq0X0wrTBg0mf0WWwlyYMy8MkgyjBtw5RV5Pe79sqovddSsOyok4RqNKc7924oMorgg0Q5TCyldtS
 8NscxK6RugzS/1w+MteUz99TNq4R8qQQLtdnwqqxs/dfo0C0l5BS8c0G50qEqo36zZog1g0vuDqrm
 qcYi8IKK2AErxw==;
Received: from [87.69.77.57] (port=4125 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nIrYj-0005HQ-3I; Sat, 12 Feb 2022 07:31:25 -0500
Date: Sat, 12 Feb 2022 14:31:19 +0200
Message-Id: <838rugs1uw.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Markus Triska <triska@HIDDEN>
In-Reply-To: <m2r188fl62.fsf@HIDDEN> (message from Markus Triska on Sat, 
 12 Feb 2022 11:12:37 +0100)
Subject: Re: bug#53952: 27.1;
 insert-image sometimes unexpectedly truncates images
References: <m2r188fl62.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 53952
Cc: 53952 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53952; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Feb 2022 10:13:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 12 05:13:00 2022
Received: from localhost ([127.0.0.1]:33548 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nIpOm-0007pS-2l
	for submit <at> debbugs.gnu.org; Sat, 12 Feb 2022 05:13:00 -0500
Received: from lists.gnu.org ([209.51.188.17]:44884)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <triska@HIDDEN>) id 1nIpOj-0007pK-OA
 for submit <at> debbugs.gnu.org; Sat, 12 Feb 2022 05:12:58 -0500
Received: from eggs.gnu.org ([209.51.188.92]:47958)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <triska@HIDDEN>)
 id 1nIpOj-0006Wt-5F
 for bug-gnu-emacs@HIDDEN; Sat, 12 Feb 2022 05:12:57 -0500
Received: from [78.47.144.35] (port=43524 helo=metalevel.at)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <triska@HIDDEN>) id 1nIpOV-0002pN-BM
 for bug-gnu-emacs@HIDDEN; Sat, 12 Feb 2022 05:12:56 -0500
Received: from mt-mbpro.localdomain (localhost [127.0.0.1])
 by metalevel.at (Postfix) with ESMTP id D3B5F9C74D
 for <bug-gnu-emacs@HIDDEN>; Sat, 12 Feb 2022 11:12:38 +0100 (CET)
Received: by mt-mbpro.localdomain (Postfix, from userid 501)
 id 8E33214EA571; Sat, 12 Feb 2022 11:12:37 +0100 (CET)
From: Markus Triska <triska@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.1; insert-image sometimes unexpectedly truncates images
Date: Sat, 12 Feb 2022 11:12:37 +0100
Message-ID: <m2r188fl62.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Host-Lookup-Failed: Reverse DNS lookup failed for 78.47.144.35 (failed)
Received-SPF: none client-ip=78.47.144.35; envelope-from=triska@HIDDEN;
 helo=metalevel.at
X-Spam_score_int: -10
X-Spam_score: -1.1
X-Spam_bar: -
X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793,
 SPF_HELO_NONE=0.001, SPF_NONE=0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

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 =E2=80=98nil=E2=80=99 or omitted the whole image is insert=
ed."

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 scrol=
l 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=3D/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=3Dlucid
 --without-xaw3d --without-imagemagick --with-xpm --with-jpeg
 --with-tiff --with-gif --with-png --with-lcms2 --without-rsvg
 --with-xft 'CFLAGS=3D-pipe -Os -arch x86_64'
 CPPFLAGS=3D-I/opt/local/include 'LDFLAGS=3D-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





Acknowledgement sent to Markus Triska <triska@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#53952; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 12 Feb 2022 12:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.