reddit / emacs

Will we be ever seeing multithreading in emacs?

Several-Theory2433 · 2022-06-02 19:52
centuryx476 · 2022-06-02 19:54
Short answer: No Long answer: Maybe
amizya · 2022-06-02 20:23
No. The only hope is through forked projects from emacs. emacs-ng and lem are one of them, so keep an eye there
Alan_Shutko · 2022-06-02 20:53
[Primitives for threading are already there](https://www.gnu.org/software/emacs/manual/html_node/elisp/Threads.html). However, changing the core code and package to leverage those primitives is another matter. I think that the prospects look good but it might be 5-10 years.
chrinto · 2022-06-02 21:07
Give it a few decades, sure. Is it probable in the next 5 years? No
HM0880 · 2022-06-02 21:27
What features would multithreading enable? (Genuine question; not a troll.)
xombul · 2022-06-02 23:59
Doing something long like fetching emails / feeds while doing something else. Or not blocking emacs when tramp fail to connects. Not blocking workflow in general…
timmymayes · 2022-06-03 00:39
I just setup Mu4e yesterday and I think you just answered whyI couldn't do stuff in my 2nd buffer while mail was being checked.... doh.
vaxdar · 2022-06-03 01:09
Wasn't there another thread on this 5 minutes ago?
chocolait · 2022-06-03 03:18
There is always remacs
ndamee · 2022-06-03 04:45
These are I/O operations and emacs supports non blocking I/O, so it's up these packages to utilize it. Tramp and co. should be fixed which could be done with current Emacs too.
publicvoit · 2022-06-03 07:09
I'm hoping for garbage collecting in background if this is possible since I think that most of the time, I'm waiting for that although I've set the threshold(s) to large numbers.
xombul · 2022-06-03 07:26
Alright good to know, but why gnus, tramp are still not fixed ? I’m sure the blocking problem is not bothering only me ?!
ndamee · 2022-06-03 07:41
These are big/old packages which need time and effort to fix, and I guess there are no volunteers willing to put in the work.
-xylon · 2022-06-03 09:52
Emacs already has 50 years, do we need to wait for it to turn a century old?
TheFrenchPoulp · 2022-06-03 11:32
> although I've set the threshold(s) to large numbers. Could be why you're having issues in the first place, depending on how *large* you meant
nv-elisp · 2022-06-03 15:53
Multi-threading is hard...
nv-elisp · 2022-06-03 15:55
If you're in a rush, you could start working on it.
nv-elisp · 2022-06-03 15:56
Just have to wait for "always" to happen.
defaultxr · 2022-06-03 17:11
This. Larger numbers = garbage is collected less often, but more is collected at once when it is collected, meaning (typically) longer pauses. Smaller numbers = garbage is collected more often, but less is collected at once, meaning (typically) shorter pauses. I've seen [gcmh](https://github.com/emacsmirror/gcmh) recommended as a library that configures the garbage collector for you. Not sure if it is truly a "one size fits all" solution though.
TheFrenchPoulp · 2022-06-03 18:37
I have just that personally because the default threshold is *really* low (setq-default ... gc-cons-threshold (* 8 1024 1024) ; We're not using Game Boys anymore read-process-output-max (* 1024 1024) ; Increase read size for data chunks ...) Edit: added read-process increase
nnreddit-user · 2022-06-03 18:51
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49065 I get that from your pov, a recalcitrant volunteer is the same as no volunteer. GP can try Commercial Emacs if he's interested in a non-blocking, cooperatively threaded gnus.
ndamee · 2022-06-03 20:26
It would have been more worthwile to break down the submission into a series of smaller patches to get it into emacs core than forking emacs. The codes will diverge and the fork will not be synchronized/maintained after a while, because it is too much work to resolve conflicts with the main branch. At least that's what usually happens.
krageon · 2022-06-03 21:17
You can use the fork and work on porting the fixes back upstream in small bits
HM0880 · 2022-06-03 22:28
Upvote for the code comment.
ndamee · 2022-06-04 04:47
It should be done by the fork author. It's his code after all and it's also in his interest to get the code into emacs to share the maintenance work with core developers.
krageon · 2022-06-04 07:06
I don't see why that needs to be the case, the commercial emacs repository is gpl licensed.
ndamee · 2022-06-04 07:18
Because the emacs maintainers have a lot to do anyways, so they won't browse the code there, trying to take the useful parts. It has to be done by the submitter to break the patch into smaller chunks and submit those as patches for acceptance, answering questions by the maintainers, make modifications if necessary, etc.
krageon · 2022-06-04 07:29
I said "you". If you are "the emacs maintainers" and you don't want to do it, that's fine. Doesn't change the fact that this patchset doesn't need it's author to fix it. The author made some fixes, cool - clearly they don't want to deal with cutting them up. Either someone else does it or it won't happen :)
publicvoit · 2022-06-04 22:11
My current garbage collecting hacks are visible on https://github.com/novoid/dot-emacs/actions#garbage-collection-magic-hack I don't have the issue that garbage collecting takes place rarely and take long. It takes place frequently and lasts for 5-15 seconds AFAIR.