unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* help understanding overlay behaviour with images
@ 2023-08-16 10:45 David Bremner
  2023-08-16 14:37 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: David Bremner @ 2023-08-16 10:45 UTC (permalink / raw)
  To: emacs-devel


I'm not sure if this is a bug or if I misunderstand something.  In the
following code sample I expect the image to be hidden, but it isn't,
unless I also hide the previous character, i.e. pass 10 as the first
argument to make-overlay. In both Emacs 28.2 and 29.1 (tested on
Debian), it gets some weird in between state where the point skips over
the image when running left-char or right-char, but the image stays visible.
  
  (let ((buf (get-buffer-create "image-buffer"))
        (img (find-image '((:type xpm :file "attach.xpm"))))
        (overlay nil))
    (switch-to-buffer buf)
    (insert "0123456789")
    (insert-image img "x")
    (insert "0123456789")
    (insert "\n")
    (setq overlay (make-overlay 11 12))
    (overlay-put overlay 'invisible t)
    (message "props=%s" (overlay-properties overlay)))

P.S. I'm not subscribed to emacs-devel, so please CC me any answers.



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

* Re: help understanding overlay behaviour with images
  2023-08-16 10:45 help understanding overlay behaviour with images David Bremner
@ 2023-08-16 14:37 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-08-16 14:37 UTC (permalink / raw)
  To: David Bremner; +Cc: emacs-devel

> From: David Bremner <david@tethera.net>
> Date: Wed, 16 Aug 2023 07:45:12 -0300
> 
> I'm not sure if this is a bug or if I misunderstand something.  In the
> following code sample I expect the image to be hidden, but it isn't,
> unless I also hide the previous character, i.e. pass 10 as the first
> argument to make-overlay. In both Emacs 28.2 and 29.1 (tested on
> Debian), it gets some weird in between state where the point skips over
> the image when running left-char or right-char, but the image stays visible.
>   
>   (let ((buf (get-buffer-create "image-buffer"))
>         (img (find-image '((:type xpm :file "attach.xpm"))))
>         (overlay nil))
>     (switch-to-buffer buf)
>     (insert "0123456789")
>     (insert-image img "x")
>     (insert "0123456789")
>     (insert "\n")
>     (setq overlay (make-overlay 11 12))
>     (overlay-put overlay 'invisible t)
>     (message "props=%s" (overlay-properties overlay)))

This is expected: a 'display' property (which is how Emacs implements
display of images in a buffer) causes Emacs to ignore the text
"covered" by the property, in this case the character "x" on which you
placed the overlay with the invisible property.  So Emacs doesn't see
the overlay on "x", and doesn't act upon the invisible property of
that overlay.

IOW, you have here two display features, each of which needs to skip
the same buffer positions, so the first one wins.



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

end of thread, other threads:[~2023-08-16 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 10:45 help understanding overlay behaviour with images David Bremner
2023-08-16 14:37 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).