[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32537: 26.1.50; Tramp: Cursor jumps when typing during asynchronous
bug#32537: 26.1.50; Tramp: Cursor jumps when typing during asynchronous find-file
Sat, 01 Sep 2018 17:24:49 -0700
Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux)
Eli Zaretskii <address@hidden> writes:
> OK, but this sounds strange to me, since AFAICT Tramp switches to its
> own buffer when it sends a script to the remote and waits for it to
> return the results (which is most probably when the main thread gets
> control and lets you type).
> Michael, how come Tramp moves point in the *scratch* buffer in this
Here's what I think the sequence of events was, in that last trace:
When tramp-sh-handle-file-attributes is called in Thread 10, its current
buffer is *scratch*. Point in *scratch* is 256.
tramp-sh-handle-file-attributes enters its save-excursion form which
saves a marker pointing to 256 in *scratch* in the special binding stack
of Thread 10.
tramp-sh-handle-file-attributes then calls functions which switch to
Tramp's buffer, and which yield execution while waiting for the remote.
The main thread gains the global lock and handles 3 characters of
keyboard input, which all run self-insert-command in the main thread's
current buffer, *scratch*. Point is now 259 but the marker in Thread
10's stack is still at 256.
The main thread yields in between keystrokes and Thread 10 resumes when
the response is received from the remote. When its execution reaches
the end of the save-excursion form, save_excursion_restore sets the
current buffer and its point from the marker, to *scratch* and 256.