From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ihor Radchenko Subject: Re: Asynchronous org-agenda-redo Date: Mon, 16 Dec 2019 15:23:34 +0800 Message-ID: <878sncohs9.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> References: <87k172ot2m.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <87pngtsppt.fsf@alphapapa.net> <87o8wda6nv.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <87h824sos5.fsf@alphapapa.net> <87wob0fwsg.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <87d0crse6p.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:45313) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igkl8-0004Zd-0B for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 02:25:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igkl6-0000mx-Mu for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 02:25:37 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:45301) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igkl6-0000m4-G7 for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 02:25:36 -0500 Received: by mail-wr1-x42b.google.com with SMTP id j42so1689826wrj.12 for ; Sun, 15 Dec 2019 23:25:36 -0800 (PST) In-Reply-To: <87d0crse6p.fsf@alphapapa.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Adam Porter , emacs-orgmode@gnu.org > 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 properties, which cannot be handled within framework of built-in org-ql predicates (AFAIK): - =:SHOWFROMTIME:= (always inheriting) :: The purpose of this is to be able to assign specific projects for different days of week or, say, show the home items only in the evening of weekdays and not annoy me at work when I cannot do it any way. Hence, I can focus on the items I really need to do now in this agenda. Additionally, the time of the day after midnight is treated specially here. If =org-extend-today-until= is not 0 and the current time is before its value, the current time is still considered to be yesterday. - =:SHOWFROMDATE:= :: The purpose of this is to be able to postpone the scheduled tasks for future if I cannot do it. The property is formatted as an org date. This property is especially useful if there is something more pressing, so that there is a temptation to reschedule less pressing event to another day. If the more pressing task is done earlier than expected, the postponed tasks can be still find in normal agenda view (not in the [[id:ff70b03f-3876-4b2b-9aab-c3209bd31cb8][focused]] one). - =:SHOWDATES:= (always inheriting) :: It contains dairy =sexps= to set when the project should be shown. For example, I may want to work on Saturday once or twice, but the working items should not be shown on weekend normally. Hence, I can define it. Or some things can only be done on specific dates (say, going to some shop, which is open few days a week only) > org-entry-get is only called for the (property) predicate. It's the > correct way to get Org properties, because it handles special > properties, inheritance, etc. However, when possible, queries are > optimized to a whole-buffer regexp search that finds possible matches. > So, for example, a query like '(property "owner" "yantar") would be > optimized to a whole-buffer regexp search that would be very fast. See > function org-ql--query-preamble. Thanks for the info! I did not know about this optimisation in org-ql. org-entry-get consumes most of cpu time while building my agenda views. Though I don't think that there will be much difference for me since most of my property conditions in agenda involve inherited properties. Regards, Ihor Adam Porter writes: > 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, 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. > >> I can rewrite my skip functions into queries, but I don't expect much >> improvement since org-ql seems to use org-entry-get, which is the main >> performance bottleneck for my agenda generation. > > org-entry-get is only called for the (property) predicate. It's the > correct way to get Org properties, because it handles special > properties, inheritance, etc. However, when possible, queries are > optimized to a whole-buffer regexp search that finds possible matches. > So, for example, a query like '(property "owner" "yantar") would be > optimized to a whole-buffer regexp search that would be very fast. See > function org-ql--query-preamble. > > >