GNU bug report logs - #45256
Viewing images over network using TRAMP (errors and unexpected prompts)

Previous Next

Package: emacs;

Reported by: Mikhail P <mikpom <at> fastmail.com>

Date: Tue, 15 Dec 2020 15:44:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Juri Linkov <juri <at> linkov.net>
Cc: Mikhail P <mikpom <at> fastmail.com>, 45256 <at> debbugs.gnu.org
Subject: bug#45256: Viewing images over network using TRAMP (errors and unexpected prompts)
Date: Thu, 17 Dec 2020 09:44:01 +0100
Juri Linkov <juri <at> linkov.net> writes:

Hi Juri,

>> From my pov, image-fit-to-window must be hardened in order to avoid this
>> reentrant call. Maybe an internal lock at entry, which is honored by
>> every next call until the lock is removed.
>
> The simplest solution is just to increase the number of seconds
> in the user option 'image-auto-resize-on-window-resize'
> proportionally to network latency.

That's a global variable, right? So you would also delay resizing of
images located locally.

> Locking could be implemented as well.  How would be better to do this?
> Maybe by using a buffer-local variable?

Yes. Something like

--8<---------------cut here---------------start------------->8---
(defvar image-fit-to-window-lock nil
  "Lock for `image-fit-to-window' timer."

(defun image-fit-to-window (window)
  "..."
  (unless image-fit-to-window-lock
    (unwind-protect
	(progn
	  (setq-local image-fit-to-window-lock t)
	  ...)
      (setq image-fit-to-window-lock nil))))
--8<---------------cut here---------------end--------------->8---

There's also another thread. When image-fit-to-window is called from
Emacs the first time, there could also be a running Tramp operation,
which would be disturbed. See the recent discussion about "Tramp and
timers" in the emacs-devel ML. Tramp would detect this situation, and
fire the (new) error remote-file-error. This must also be handled, like

--8<---------------cut here---------------start------------->8---
(defun image-fit-to-window (window)
  "..."
  (ignore-error 'remote-file-error
    ...))
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.




This bug report was last modified 4 years and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.