bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47240: Images Treated as Whitespace and Removed from Buffer


From: Spaulding, Jeff
Subject: bug#47240: Images Treated as Whitespace and Removed from Buffer
Date: Sun, 4 Apr 2021 00:37:37 +0000

Assuming that images being treated as whitespace is the intended behavior 
(which I think is odd, but I can accept), I feel that a documentation change 
would be sufficient.

I was surprised by the fact that images were treated as whitespace.  It doesn't 
seem intuitive that an image would be treated the same as an invisible piece of 
text.

Documenting this would prevent others from having to go through the confusion I 
did, however.

-----Original Message-----
From: Stefan Kangas [mailto:stefan@marxist.se] 
Sent: Saturday, April 3, 2021 7:30 PM
To: Lars Ingebrigtsen
Cc: Spaulding, Jeff; 47240@debbugs.gnu.org
Subject: Re: bug#47240: Images Treated as Whitespace and Removed from Buffer

Lars Ingebrigtsen <larsi@gnus.org> writes:

> "Spaulding, Jeff" <jeff.spaulding@englobal.com> writes:
>
>> Press M-: to bring up an Eval: prompt in the minibuffer.  Enter the 
>> following elisp code:
>>
>> (insert-image (create-image "test.png"))
>>
>> The image will appear in the buffer.
>>
>> Press Enter.  The image will disappear.
>>
>> The image seems to always be deleted if the enter key is pressed 
>> (bound to the newline function), but not when C-j is pressed (bound 
>> to the electric-newline-and-maybe-indent function).  The image will 
>> not be deleted if there is any text following it on the line.  This 
>> suggests the image is being treated as trailing whitespace, as 
>> trailing whitespace is treated in the same way.
>
> I think this is working basically as designed.  By default, images are 
> whitespace and handled as such, but if you don't want that, you have 
> to say
>
> (insert-image (create-image "test.png") "*")
>
> or something like that.
>
> So I'm not sure whether there's anything to fix here.  Does anybody 
> else have an opinion here?

I agree that it seems to works as documented.

Perhaps the docstring of `insert-image' could make this caveat more clear 
though?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]