GNU bug report logs -
#32978
26.1; newline-and-indent duplicates displayed image
Previous Next
Reported by: Markus Triska <triska <at> metalevel.at>
Date: Sun, 7 Oct 2018 21:20:02 UTC
Severity: normal
Tags: notabug
Found in version 26.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32978 in the body.
You can then email your comments to 32978 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32978
; Package
emacs
.
(Sun, 07 Oct 2018 21:20: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
.
(Sun, 07 Oct 2018 21:20:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32978
; Package
emacs
.
(Sun, 14 Oct 2018 14:39:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 32978 <at> debbugs.gnu.org (full text, mbox):
> From: Markus Triska <triska <at> metalevel.at>
> 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 <at> gnu.org
:
bug#32978
; Package
emacs
.
(Sun, 14 Oct 2018 20:41:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 32978 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> 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
Added tag(s) notabug.
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 15 Oct 2018 02:34:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#32978
; Package
emacs
.
(Mon, 15 Oct 2018 02:35:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 32978 <at> debbugs.gnu.org (full text, mbox):
tags 32978 notabug
thanks
> From: Markus Triska <triska <at> metalevel.at>
> 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 <at> gnu.org
:
bug#32978
; Package
emacs
.
(Fri, 19 Apr 2019 19:29:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 32978 <at> debbugs.gnu.org (full text, mbox):
close 32978
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
>> 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.
Done now.
037970f1af 2019-04-19T15:19:45-04:00 "Document insert-image-file's return value (Bug#32978)"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=037970f1af6c87767501ac6d46c50abe9d3f44e0
bug closed, send any further explanations to
32978 <at> debbugs.gnu.org and Markus Triska <triska <at> metalevel.at>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 19 Apr 2019 19:29:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 18 May 2019 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 337 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.