Re: Asynchronous org-agenda-redo

2019-12-23 Thread Adam Porter
Ihor Radchenko writes: > If you accidentally move the point in the buffer being processed by > agenda, the results may be unpredictable (org-agenda-get-* functions > move across the buffer with re-search-forward). I'm afraid that's the basic problem with threading in Emacs: shared state. I

Re: Asynchronous org-agenda-redo

2019-12-21 Thread Ihor Radchenko
> That's a very elegant way to add the threading! Thanks for kind words. > The performance penalty > is noticeable, but the tradeoff could be worth it in some cases, like a > background agenda refresh on a timer, or after a "remote" edit. I can > imagine an org-agenda-refresh-async command that

Re: Asynchronous org-agenda-redo

2019-12-16 Thread Adam Porter
Ihor Radchenko writes: >> So, of course, you can call custom functions in queries, even your >> own skip functions (with `not', of course), but in most cases, they >> can be covered with built-in predicates. > > Unfortunately, it does not seem to be the case for me. My main agenda > view needs

Re: Asynchronous org-agenda-redo

2019-12-15 Thread Ihor Radchenko
> So, of course, you can call custom > functions in queries, even your own skip functions (with `not', of > course), but in most cases, they can be covered with built-in > predicates. Unfortunately, it does not seem to be the case for me. My main agenda view needs to take into account multiple

Re: Asynchronous org-babel-tangle (was Re: Asynchronous org-agenda-redo)

2019-12-15 Thread Ihor Radchenko
Thanks for the feedback. > - For me, the tangle works if I only load the org library in the > sub-process, so I disabled the loading of my config. I guess this depends > heavily and what other configuration one has loaded, but I think for > tangling, not much else is needed :) Note that your

Re: Asynchronous org-babel-tangle (was Re: Asynchronous org-agenda-redo)

2019-12-15 Thread Ihor Radchenko
Thanks for the feedback. > - For me, the tangle works if I only load the org library in the > sub-process, so I disabled the loading of my config. I guess this depends > heavily and what other configuration one has loaded, but I think for > tangling, not much else is needed :) Note that your

Asynchronous org-babel-tangle (was Re: Asynchronous org-agenda-redo)

2019-12-15 Thread Diego Zamboni
Hi Ihor, On Thu, Dec 12, 2019 at 4:00 PM Ihor Radchenko wrote: > See the relevant code from my config below. Let me know if you have any > questions or suggestions. > Thank you, this was extremely helpful. I am now using a modified version of your code (see below) with the following

Re: Asynchronous org-agenda-redo

2019-12-13 Thread Adam Porter
Ihor Radchenko writes: >>> Asynchronous code is not faster; it's generally slower because of >>> yielding and synchronization. > >> Anyway, I will try to throw yields into agenda code just to check how >> bad the performance can degrade. > > With the following code, org-agenda-redo runs for 21

Re: Asynchronous org-agenda-redo

2019-12-13 Thread Adam Porter
Ihor Radchenko writes: >> org-ql doesn't use skip functions, just queries. > > Skip functions are essentially used-defined queries as soon as the > queries are tested against every headline. Skip functions aren't necessary with org-ql, because the query itself can have arbitrary Lisp code. So,

Re: Asynchronous org-agenda-redo

2019-12-13 Thread Ihor Radchenko
>> Asynchronous code is not faster; it's generally slower because of >> yielding and synchronization. > Anyway, I will try to throw yields into agenda code just to check how > bad the performance can degrade. With the following code, org-agenda-redo runs for 21 second on my system, while

Re: Asynchronous org-agenda-redo

2019-12-13 Thread Ihor Radchenko
> Org Agenda code does not wait for keyboard input; it's busy building the > agenda. This is the case with most code in Emacs: it's not written to > be asynchronous, and it doesn't return to the main thread until done. > So you can sprinkle yields here and there and maybe be able to move > point

Re: Asynchronous org-agenda-redo

2019-12-12 Thread Adam Porter
Ihor Radchenko writes: >> Be sure to read the Emacs Lisp manual regarding threads. They are >> cooperative, so functions called as threads must yield back to the main >> thread for Emacs to do anything else before the function returns. > > I tried to read the manual, but I clearly misunderstand

Re: Asynchronous org-agenda-redo

2019-12-12 Thread Ihor Radchenko
> Be sure to read the Emacs Lisp manual regarding threads. They are > cooperative, so functions called as threads must yield back to the main > thread for Emacs to do anything else before the function returns. I tried to read the manual, but I clearly misunderstand something. The manual says: >

Re: Asynchronous org-agenda-redo

2019-12-12 Thread Ihor Radchenko
Hi Diego, > I cannot answer your question, but I am curious about using async together > with tangling, since for some of my buffers, tangling takes some time and > freezes Emacs in the process. Do you have some examples of this that you > could share? See the relevant code from my config below.

Re: Asynchronous org-agenda-redo

2019-12-12 Thread Diego Zamboni
Hi Ihor, I cannot answer your question, but I am curious about using async together with tangling, since for some of my buffers, tangling takes some time and freezes Emacs in the process. Do you have some examples of this that you could share? Thanks, --Diego On Thu, Dec 12, 2019 at 9:21 AM

Re: Asynchronous org-agenda-redo

2019-12-12 Thread Adam Porter
Be sure to read the Emacs Lisp manual regarding threads. They are cooperative, so functions called as threads must yield back to the main thread for Emacs to do anything else before the function returns. If you're feeling adventurous, you could experiment with adding yields in relevant agenda

Asynchronous org-agenda-redo

2019-12-12 Thread Ihor Radchenko
I am thinking if it is possible to implement org-agenda-redo asynchronously. Rebuilding agenda should normally not affect any buffer except agenda buffer. So, it should be sufficient to block any agenda modifying commands in the agenda buffer, redo the agenda buffer in separate thread, and