GNU bug report logs - #32978
26.1; newline-and-indent duplicates displayed image

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>; Keywords: notabug; dated Sun, 7 Oct 2018 21:20:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 32978) by debbugs.gnu.org; 15 Oct 2018 02:34:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 14 22:34:05 2018
Received: from localhost ([127.0.0.1]:49692 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gBshp-0002HI-N3
	for submit <at> debbugs.gnu.org; Sun, 14 Oct 2018 22:34:05 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51456)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1gBsho-0002GP-MS
 for 32978 <at> debbugs.gnu.org; Sun, 14 Oct 2018 22:34:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1gBshg-0000By-G6
 for 32978 <at> debbugs.gnu.org; Sun, 14 Oct 2018 22:33:59 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60326)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1gBshX-00007M-8X; Sun, 14 Oct 2018 22:33:47 -0400
Received: from [176.228.60.248] (port=2626 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1gBshW-0003PT-SW; Sun, 14 Oct 2018 22:33:47 -0400
Date: Mon, 15 Oct 2018 05:33:56 +0300
Message-Id: <83bm7wszu3.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Markus Triska <triska@HIDDEN>
In-reply-to: <87lg70mfcd.fsf@HIDDEN> (message from Markus Triska on Sun, 
 14 Oct 2018 22:40:50 +0200)
Subject: Re: bug#32978: 26.1; newline-and-indent duplicates displayed image
References: <87k1mtcvcf.fsf@HIDDEN> <83tvlotwz9.fsf@HIDDEN>
 <87lg70mfcd.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 32978
Cc: 32978 <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: -6.0 (------)

tags 32978 notabug
thanks

> From: Markus Triska <triska@HIDDEN>
> Cc: 32978 <at> debbugs.gnu.org
> Date: Sun, 14 Oct 2018 22:40:50 +0200
> 
> > Not sure why you expected that.  Perhaps you thought that forward-char
> > will move to after the image?
> 
> Yes indeed! Since a single forward-char moves over the image when used
> interactively, I got the impression that the image is only a single
> character. From your code example, I see that this is not the case!

No, it's not.  You can see in image-file.el that what
insert-image-file does is insert the entire image file into the
buffer, and then put a 'display' property over all those bytes.  So
the image spans many characters in this case.

> I think a very good solution would be to document the return value of
> insert-image-file, i.e., to add to its description a statement such as:
> 
>     Returns list of absolute file name and number of characters
>     inserted.
> 
> What do you think?

I was thinking the same; will do.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32978; Package emacs. Full text available.
Added tag(s) notabug. Request was from Eli Zaretskii <eliz@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 32978) by debbugs.gnu.org; 14 Oct 2018 20:40:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 14 16:40:54 2018
Received: from localhost ([127.0.0.1]:49615 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gBnC2-0001oU-9S
	for submit <at> debbugs.gnu.org; Sun, 14 Oct 2018 16:40:54 -0400
Received: from metalevel.at ([78.46.218.83]:56488)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <triska@HIDDEN>) id 1gBnC0-0001oL-4B
 for 32978 <at> debbugs.gnu.org; Sun, 14 Oct 2018 16:40:52 -0400
Received: by metalevel.at (Postfix, from userid 1000)
 id 3D241A0462; Sun, 14 Oct 2018 22:40:50 +0200 (CEST)
From: Markus Triska <triska@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#32978: 26.1; newline-and-indent duplicates displayed image
References: <87k1mtcvcf.fsf@HIDDEN> <83tvlotwz9.fsf@HIDDEN>
Date: Sun, 14 Oct 2018 22:40:50 +0200
In-Reply-To: <83tvlotwz9.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 14 Oct
 2018 17:38:02 +0300")
Message-ID: <87lg70mfcd.fsf@HIDDEN>
User-Agent: Emacs/24.5
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32978
Cc: 32978 <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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> In this case, I expect test.png to be displayed only in line 1.
>
> Not sure why you expected that.  Perhaps you thought that forward-char
> will move to after the image?

Yes indeed! Since a single forward-char moves over the image when used
interactively, I got the impression that the image is only a single
character. From your code example, I see that this is not the case!

I think a very good solution would be to document the return value of
insert-image-file, i.e., to add to its description a statement such as:

    Returns list of absolute file name and number of characters
    inserted.

What do you think? Thank you very much for looking into this!

All the best,
Markus




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

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


Received: (at 32978) by debbugs.gnu.org; 14 Oct 2018 14:38:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 14 10:38:06 2018
Received: from localhost ([127.0.0.1]:49428 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gBhWw-00081B-5F
	for submit <at> debbugs.gnu.org; Sun, 14 Oct 2018 10:38:06 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42176)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1gBhWt-00080d-TV
 for 32978 <at> debbugs.gnu.org; Sun, 14 Oct 2018 10:38:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1gBhWl-0004Fw-I3
 for 32978 <at> debbugs.gnu.org; Sun, 14 Oct 2018 10:37:58 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48950)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1gBhWl-0004Fo-DW; Sun, 14 Oct 2018 10:37:55 -0400
Received: from [176.228.60.248] (port=1661 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1gBhWl-0003Vz-0T; Sun, 14 Oct 2018 10:37:55 -0400
Date: Sun, 14 Oct 2018 17:38:02 +0300
Message-Id: <83tvlotwz9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Markus Triska <triska@HIDDEN>
In-reply-to: <87k1mtcvcf.fsf@HIDDEN> (message from Markus Triska on Sun, 
 07 Oct 2018 23:14:56 +0200)
Subject: Re: bug#32978: 26.1; newline-and-indent duplicates displayed image
References: <87k1mtcvcf.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 32978
Cc: 32978 <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: -6.0 (------)

> From: Markus Triska <triska@HIDDEN>
> Date: Sun, 07 Oct 2018 23:14:56 +0200
> 
> 
>     $ emacs -Q --eval='(progn (insert-image-file "test.png")
>                               (forward-char)
>                               (newline-and-indent))'
> 
> As a result, test.png is displayed twice, both in line 1 and in line 2.
> 
> In this case, I expect test.png to be displayed only in line 1.

Not sure why you expected that.  Perhaps you thought that forward-char
will move to after the image?  But that is a feature of the command
loop, and happens only after a command finishes, and Emacs is back to
the command loop.  It doesn't happen in the middle of a Lisp program.
So what your program did is insert a newline character in the middle
of text covered by a 'display' text property, and then the behavior
you observe is expected, right?

If I modify your program as follows:

  (let ((inserted (cadr (insert-image-file "test.png"))))
    (goto-char (1+ inserted))
    (newline-and-indent))

then only one image is displayed, on line 1.

If what forward-char does in this case is not the reason for your
expectations, please tell more about your reasoning.




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

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


Received: (at submit) by debbugs.gnu.org; 7 Oct 2018 21:19:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 07 17:19:21 2018
Received: from localhost ([127.0.0.1]:39699 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g9GSO-000220-Tv
	for submit <at> debbugs.gnu.org; Sun, 07 Oct 2018 17:19:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50851)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <triska@HIDDEN>) id 1g9GSN-00021m-03
 for submit <at> debbugs.gnu.org; Sun, 07 Oct 2018 17:19:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <triska@HIDDEN>) id 1g9GSG-0001qe-JO
 for submit <at> debbugs.gnu.org; Sun, 07 Oct 2018 17:19:13 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:52529)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1g9GSF-0001qY-Hc
 for submit <at> debbugs.gnu.org; Sun, 07 Oct 2018 17:19:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60457)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <triska@HIDDEN>) id 1g9GSE-0002zb-Id
 for bug-gnu-emacs@HIDDEN; Sun, 07 Oct 2018 17:19:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <triska@HIDDEN>) id 1g9GSB-0001pC-Cl
 for bug-gnu-emacs@HIDDEN; Sun, 07 Oct 2018 17:19:10 -0400
Received: from metalevel.at ([78.46.218.83]:55656)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <triska@HIDDEN>) id 1g9GSB-0001nH-56
 for bug-gnu-emacs@HIDDEN; Sun, 07 Oct 2018 17:19:07 -0400
Received: from debian (localhost.localdomain [127.0.0.1])
 by metalevel.at (Postfix) with ESMTP id 4876DA03C4
 for <bug-gnu-emacs@HIDDEN>; Sun,  7 Oct 2018 23:19:04 +0200 (CEST)
Received: by debian (Postfix, from userid 1000)
 id 6FF1127747; Sun,  7 Oct 2018 23:14:56 +0200 (CEST)
From: Markus Triska <triska@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.1; newline-and-indent duplicates displayed image
Date: Sun, 07 Oct 2018 23:14:56 +0200
Message-ID: <87k1mtcvcf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
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: -6.0 (------)


Please download test.png from:

    https://www.metalevel.at/ei/test.png

and then invoke Emacs as follows:

    $ emacs -Q --eval='(progn (insert-image-file "test.png")
                              (forward-char)
                              (newline-and-indent))'

As a result, test.png is displayed twice, both in line 1 and in line 2.

In this case, I expect test.png to be displayed only in line 1.

In GNU Emacs 26.1 (build 1, i686-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2018-05-29 built on debian
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description:	Debian GNU/Linux 9.2 (stretch)





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#32978; 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: Mon, 15 Oct 2018 02:45:01 UTC

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