[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: save-excursion and multi-thread?
From: |
Qiantan Hong |
Subject: |
Re: save-excursion and multi-thread? |
Date: |
Sun, 26 Sep 2021 19:42:25 +0000 |
> On Sep 26, 2021, at 12:29 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Qiantan Hong <qhong@mit.edu>
>> CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> Date: Sun, 26 Sep 2021 19:21:38 +0000
>>
>>>> I see. Can I fake that with indirect-buffer?
>>>
>>> For moving point, I think you can. But if you change the text, you
>>> will see the changes in the other threads as well.
>> That’s intended.
>> I simply want point to behave like a proper global variable
>
> But point is not a variable. It's a property of a buffer, and all you
> have is a (read-only) accessor to that property.
>
>> and save-excursion to behave like a proper let-binding.
>
> You can always use save-excursion in the other thread, no?
Doesn’t looks like it’s protected
(progn
(make-thread
(lambda ()
(save-excursion
(sleep-for 5)
(print (point)))))
(make-thread
(lambda ()
(save-excursion
(sleep-for 3)
(goto-char (point-min))
(sleep-for 3)))))
This prints 1 instead of the point before the first save-excursion enters.
Moreover, the other thread can be the main UI thread,
I don’t know how I can protect it (assuming that save-excursion does protect,
although it actually doesn’t).
>> Does that convince you?
>
> Convince me to do what? redesign and reimplement Lisp threads in
> Emacs with very different design goals?
Not doing anything, let’s figure out what’s correct first.
Whether to do the correct thing comes after that.
I also don’t think a redesign is necessary, we just need to
restore point state during thread switching, but I haven’t look at detail yet.
- save-excursion and multi-thread?, Qiantan Hong, 2021/09/26
- Re: save-excursion and multi-thread?, Eli Zaretskii, 2021/09/26
- Re: save-excursion and multi-thread?, Qiantan Hong, 2021/09/26
- Re: save-excursion and multi-thread?, Qiantan Hong, 2021/09/26
- Re: save-excursion and multi-thread?, Eli Zaretskii, 2021/09/26
- Re: save-excursion and multi-thread?, Qiantan Hong, 2021/09/26
- Re: save-excursion and multi-thread?, Eli Zaretskii, 2021/09/26
- Re: save-excursion and multi-thread?,
Qiantan Hong <=
- Re: save-excursion and multi-thread?, Qiantan Hong, 2021/09/26
- Re: save-excursion and multi-thread?, Eli Zaretskii, 2021/09/27
- Re: save-excursion and multi-thread?, Richard Stallman, 2021/09/28
- Re: save-excursion and multi-thread?, dick, 2021/09/28
- Re: save-excursion and multi-thread?, Qiantan Hong, 2021/09/28
- Re: save-excursion and multi-thread?, Eli Zaretskii, 2021/09/29
- Re: save-excursion and multi-thread?, Eli Zaretskii, 2021/09/27
- Re: save-excursion and multi-thread?, Qiantan Hong, 2021/09/27
- Re: save-excursion and multi-thread?, Eli Zaretskii, 2021/09/27
- Re: save-excursion and multi-thread?, Qiantan Hong, 2021/09/27