djcb / mu

maildir indexer/searcher + emacs mail client + guile bindings
http://www.djcbsoftware.nl/code/mu
GNU General Public License v3.0
1.62k stars 391 forks source link

[mu4e bug] error "Specified window is not displaying the current buffer" #2747

Closed robstewart57 closed 3 months ago

robstewart57 commented 3 months ago

Describe the bug

mu4e version 687db1aed6dd516cb2806bdc501d225e0a6d0459 (21st August git commit).

In mu4e-header view, hit Enter on a message. Rather than showing the message, an error "Specified window is not displaying the current buffer" is shown. It happens for most, but not all, emails in mu4e-header view.

Using Emacs git HEAD (3d1d4f109ed4115256a08c74eeb704259d91c9f4), also from 21 August.

How to Reproduce

Here is the anonymised backtrace:

Debugger entered--Lisp error: (error "Specified window is not displaying the current buffer")
  shr-indent()
  shr-fill-line()
  shr-fill-lines(13724 15455)
  shr-insert-document((html ((xmlns:o . .))))
  mm-shr((#<buffer  *mm*-655965> ("text/html" (charset . "Windows-1252")) quoted-printable nil nil nil nil nil))
  mm-inline-text-html((#<buffer  *mm*-655965> ("text/html" (charset . "Windows-1252")) quoted-printable nil nil nil nil nil))
  mm-display-inline((#<buffer  *mm*-655965> ("text/html" (charset . "Windows-1252")) quoted-printable nil nil nil nil nil))
  mm-display-part((#<buffer  *mm*-655965> ("text/html" (charset . "Windows-1252")) quoted-printable nil nil nil nil nil))
  gnus-mime-display-alternative(((#<buffer  *mm*-410985> ("text/plain" (charset . "Windows-1252")) quoted-printable nil ("inline") nil nil nil) (#<buffer  *mm*-655965> ("text/html" (charset . "Windows-1252")) quoted-printable nil nil nil nil nil)) nil nil 1)
  gnus-mime-display-part((#("multipart/alternative" ...)))
  gnus-display-mime(nil)
  #f(compiled-function (&optional ihandles) #<bytecode -0xcb4ad9361861f2a>)()
  gnus-article-prepare-display()
  mu4e--view-render-buffer((:path ...))
  mu4e-view((:path ...))
  mu4e~headers-view-handler((:path ...))
djcb commented 3 months ago

This bug report is not as good as it could be:

robstewart57 commented 3 months ago

@djcb Hi,

I've sent you privately an anonymised version of a message that triggers this issue.

Yes, I can reproduce with emacs -Q with a minimal mu4e.

Note that HEAD was pulled for both mu and emacs (both built from source) today.

Rob

djcb commented 3 months ago

It's a bug/incompatibility in upstream emacs (it works fine with a slightly older one). Please use M-x report-emacs-bug to report it.

In the mean time, you can use

(setq mm-text-html-renderer 'gnus-w3m)

(make sure you have w3m).

robstewart57 commented 3 months ago

Done:

https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-08/msg00985.html

I'll keep track of this bug 72771, and report back here.

djcb commented 3 months ago

Thanks!

Seems that Gnus no longer allows for offscreen rendering, since commit a876c4d7a17. In particular, the change in shr-indent, with font-at raising that error.

Using the old definition, it still works:

(defun shr-indent ()
  (when (> shr-indentation 0)
    (if (not shr-use-fonts)
        (insert-char ?\s shr-indentation)
      (insert ?\s)
      (put-text-property (1- (point)) (point)
                         'display `(space :width (,shr-indentation))))))
jimporter commented 3 months ago

This is a bug in SHR (I've posted a patch to the mailing list); however, now's probably a good time to mention that SHR works better when rendering to a buffer that's already displayed in some window. See https://github.com/skeeto/elfeed/pull/521 for an example of what can go wrong. (Of course, it should be possible to render to a non-displayed buffer, but SHR won't be able to take the window size into account, so the results might look worse.)

jimporter commented 3 months ago

The SHR issue should now be fixed on the Emacs master branch. I think you can close this issue now (though the above caveats about SHR rendering in non-displayed buffers still applies).

djcb commented 3 months ago

Yes, can confirm, thank you for the quick fix!

Will think about the non-displayed case... Closing this ticket.