unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gemini Lasswell <gazally@runbox.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Michael Albinus <michael.albinus@gmx.de>, 32537@debbugs.gnu.org
Subject: bug#32537: 26.1.50; Tramp: Cursor jumps when typing during asynchronous find-file
Date: Sat, 01 Sep 2018 17:24:49 -0700	[thread overview]
Message-ID: <87lg8kvj8u.fsf@runbox.com> (raw)
In-Reply-To: <83wos51gsn.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 01 Sep 2018 16:35:52 +0300")

Eli Zaretskii <eliz@gnu.org> 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
> scenario?

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.








  parent reply	other threads:[~2018-09-02  0:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-26 17:39 bug#32537: 26.1.50; Tramp: Cursor jumps when typing during asynchronous find-file Gemini Lasswell
2018-08-26 18:32 ` Eli Zaretskii
2018-08-28 19:48   ` Gemini Lasswell
2018-08-29 14:49     ` Eli Zaretskii
2018-08-29 17:55       ` Gemini Lasswell
2018-08-29 18:14         ` Eli Zaretskii
2018-08-30 18:49           ` Gemini Lasswell
2018-08-31  6:40             ` Eli Zaretskii
2018-08-31 16:52               ` Gemini Lasswell
2018-09-01 13:35                 ` Eli Zaretskii
2018-09-01 15:27                   ` Michael Albinus
2018-09-02  0:24                   ` Gemini Lasswell [this message]
2018-09-02  2:35                     ` Eli Zaretskii
2018-09-02  8:33                       ` Michael Albinus
2018-09-02 16:09                         ` Gemini Lasswell
2018-09-02 17:40                           ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lg8kvj8u.fsf@runbox.com \
    --to=gazally@runbox.com \
    --cc=32537@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).