Re: Hiding hidden image

2023-08-31 Thread David Bremner
David Bremner  writes:

> David Bremner  writes:
>
>> I also noticed that it does not happen for all png image parts, but the
>> pattern of what works and what does not is also unclear to me so far. I
>> observed that the following function
>>
>> (defun hideit ()
>>   (interactive)
>>   (overlay-put (car (last (overlays-at (point 'invisible t))
>
> I think I'm missing something about overlays. The following code
> does not work (i.e. hide the image) unless I extend the overlay to the
> left.
>
> (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 behaviour is the same in Emacs 28.2, unlike the problem Jon
> describes with notmuch-emacs.

If I understand the comment from Emacs developer Eli Zaretskii [1]
correctly, the way that notmuch has been hiding images for the last
decade or so was never really supposed to work.

I have started to investigate an alternative strategy of using the
"undisplayer" functions provided by gnus (see the end of
mm-inline-image). I got as far as (permanently) removing the image, but
not restoring it yet. I suspect this method will be more resource
intensive, but it should not matter much since toggling images is not
something that happens for multiple images at a time.


[1]: https://lists.gnu.org/archive/html/emacs-devel/2023-08/msg00593.html
___
notmuch mailing list -- [email protected]
To unsubscribe send an email to [email protected]


Re: Hiding hidden image

2023-08-14 Thread David Bremner
David Bremner  writes:

> I also noticed that it does not happen for all png image parts, but the
> pattern of what works and what does not is also unclear to me so far. I
> observed that the following function
>
> (defun hideit ()
>   (interactive)
>   (overlay-put (car (last (overlays-at (point 'invisible t))

I think I'm missing something about overlays. The following code
does not work (i.e. hide the image) unless I extend the overlay to the
left.

(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 behaviour is the same in Emacs 28.2, unlike the problem Jon
describes with notmuch-emacs.
___
notmuch mailing list -- [email protected]
To unsubscribe send an email to [email protected]


Re: Hiding hidden image

2023-08-13 Thread David Bremner
Jon Fineman  writes:

> This occurs using either:
>
> notmuch version 0.37 and emacs version 29.1 on Debian trixie/sid X11/XFCE
>
> or
>
> OpenBSD OpenBSD 7.3-current (GENERIC.MP) #1327 X11/awsomewm.
>
> I received an email with a hidden image/png. When I click on it, the
> image displays fine. However when I click on it again to hide it the
> email body text following it moves up as expected, but the picture
> doesn't hide (go away). So I am left with the image overlaying the
> email text. When I hide it the status of the attach line does change
> to (hidden).

Hi Jon;

Thanks for the report. I suspect this has to do with the new overlay
handling code in 29.1, but I haven't managed to isolate what exactly is
going on yet. I did verify that the problem does not occur with Emacs
28.2 on Debian testing. I


I also noticed that it does not happen for all png image parts, but the
pattern of what works and what does not is also unclear to me so far. I
observed that the following function

(defun hideit ()
  (interactive)
  (overlay-put (car (last (overlays-at (point 'invisible t))

exhibits the same behaviour as toggling the button: i.e. one works iff
the other does. The fact that the overlay in question is the last one is
a I think a notmuch specific hack.

I don't have much to suggest, but I guess a start would be to identify
some distinguishing characteristics for the messages where the part
visibility fails to toggle. The problem does seem to manifest in more
cases than not. 

d
___
notmuch mailing list -- [email protected]
To unsubscribe send an email to [email protected]