Call file-readable-p only on non-remote files

Calling file-readable-p before reading a message file is fine
when the file is local, but when it's a remote file, doing so incurs
an extra network round trip.  It's not really necessary to do so
either: if the file is missing, we'll fail in the insert-file-contents
below anyway, so we're missing out only on a nicer warning message.
This commit is contained in:
Daniel Colascione
2025-02-22 14:54:24 -05:00
parent 9b741eb6f0
commit 7d03d5f32a

View File

@ -1432,7 +1432,8 @@ If SUBTHREAD is non-nil, only apply to subthread."
(mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode))
(let* ((msg (mu4e-message-at-point))
(path (mu4e-message-field msg :path))
(_exists (or (file-readable-p path)
(_exists (or (file-remote-p path)
(file-readable-p path)
(mu4e-warn "No message at %s" path)))
(docid (or (mu4e-message-field msg :docid)
(mu4e-warn "No message at point")))