From: Eli Zaretskii <eliz@gnu.org>
To: Qiantan Hong <qhong@mit.edu>
Cc: emacs-devel@gnu.org
Subject: Re: save-excursion and multi-thread?
Date: Sun, 26 Sep 2021 21:18:25 +0300 [thread overview]
Message-ID: <8335prnqtq.fsf@gnu.org> (raw)
In-Reply-To: <5713E898-28B8-456C-992C-F0332FACA9FF@mit.edu> (message from Qiantan Hong on Sun, 26 Sep 2021 17:41:17 +0000)
> From: Qiantan Hong <qhong@mit.edu>
> Date: Sun, 26 Sep 2021 17:41:17 +0000
> Accept-Language: en-US
>
> I tried
> (make-thread
> (lambda ()
> (save-excursion (goto-char (point-min)) (sleep-for 1))))
> In *scratch*.
>
> It seems that after the thread yields (because of sleep-for)
> it doesn’t restore point position
It cannot, because the save-excursion form is still running. The call
to sleep-for doesn't end the save-excursion form immediately, it ends
it only after sleep-for returns
> and after 1 second cursor is reseted to the original position,
> discarding any of my movements during this 1 second.
By "my movements" you mean what you did in another thread?
> Is this how save-excursion supposed to work?
Yes.
> It’s inconsistent with the behavior of special variable + dynamic bindings,
> which works currently under multi-thread.
Inconsistent in what way?
> What’s the supposed way to have “thread-local” movements?
What do you mean by "thread-local" movements? Buffers are global, and
each buffer has only one point.
next prev parent reply other threads:[~2021-09-26 18:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-26 17:41 save-excursion and multi-thread? Qiantan Hong
2021-09-26 18:18 ` Eli Zaretskii [this message]
2021-09-26 18:28 ` Qiantan Hong
2021-09-26 18:53 ` Eli Zaretskii
2021-09-26 19:09 ` Qiantan Hong
2021-09-26 19:14 ` Eli Zaretskii
2021-09-26 19:13 ` Qiantan Hong
2021-09-26 19:16 ` Eli Zaretskii
2021-09-26 19:21 ` Qiantan Hong
2021-09-26 19:29 ` Eli Zaretskii
2021-09-26 19:42 ` Qiantan Hong
2021-09-26 19:45 ` Qiantan Hong
2021-09-27 4:36 ` Eli Zaretskii
2021-09-28 23:33 ` Richard Stallman
2021-09-29 1:41 ` dick
2021-09-29 2:59 ` Qiantan Hong
2021-10-01 22:32 ` Richard Stallman
2021-09-29 12:45 ` Eli Zaretskii
2021-10-01 22:35 ` Richard Stallman
2021-09-27 4:36 ` Eli Zaretskii
2021-09-27 5:00 ` Qiantan Hong
2021-09-27 5:54 ` Eli Zaretskii
2021-09-27 6:14 ` Qiantan Hong
2021-09-27 10:13 ` Eli Zaretskii
2021-09-26 18:21 ` Tassilo Horn
2021-09-26 19:02 ` Eli Zaretskii
2021-09-27 19:35 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8335prnqtq.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=qhong@mit.edu \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.