From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: property searches and numerical values Date: Wed, 23 Apr 2008 08:54:07 +0200 Message-ID: <5C89AF80-B5FC-4B4F-B682-3140222B4664@science.uva.nl> References: <20080417121958.GA29729@stats.ox.ac.uk> Mime-Version: 1.0 (Apple Message framework v919.2) Content-Type: multipart/mixed; boundary="===============0213831752==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JoYsO-00057N-7m for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 02:54:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JoYsK-00057B-Bo for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 02:54:43 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JoYsK-000578-6D for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 02:54:40 -0400 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JoYsJ-00077A-Fx for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 02:54:39 -0400 Received: from imap.science.uva.nl ([146.50.4.51]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JoYru-0004UW-BU for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 02:54:14 -0400 In-Reply-To: <20080417121958.GA29729@stats.ox.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dan Davison Cc: emacs org-mode mailing list --===============0213831752== Content-Type: multipart/alternative; boundary=Apple-Mail-9-845697054 --Apple-Mail-9-845697054 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Hi Dan, general comparison operators for properties should have been implemented a long time ago, thanks for bring this up. This is now available in the GIT repository and will be part of the upcoming 6.02 release - thanks for raising this point. Unfortunately there are no good examples for true custom searches available. Some of this is described in the manual. Basically, you need to use a general search to pre-select some entries, for example a tags/property search with the criterion "LEVEL>=2" (this already uses the new operators, so in order to do this, make sure you have the latest devellopment version...). Then you need to write a function that will decide if the entry at point should really be included, and if not, where to continue the search. A short description of this with a small example can be found here: http://orgmode.org/manual/Special-agenda-views.html#Special-agenda-views HTH - Carsten On Apr 17, 2008, at 2:19 PM, Dan Davison wrote: > I'd like to ask about ways in which (sorted) sparse trees can be > produced based on numerical-valued properties. One thing I have in > mind is that it would seem natural to treat priority as a (1- > dimensional) numerical quantity, rather than as a categorical > variable as it seems to be currently. i.e. I'm attracted by the idea > of being able to generate a sparse tree containing all subtrees with > priority greater than 2.5, and to have headings in the sparse tree > sorted by priority. (Of course I'm not suggesting replacing the > current priority system; in the above by 'priority' I mean some user > defined numerical-valued property.) [ Am I right in thinking that > one also can't do this currently with timestamps? Not that that is > necessarily needed as the agenda view does a lovely job. ] > > So one version of my question would be > > q1. Would it be possible to implement binary comparison operators > >,<,>=,<= for use in tag and property searches? (If true numeric > comparisons are difficult, then alphanumeric would still be useful.) > > Sorry if this is available already. > > I also have a more general question, which may well arise from my > ignorance of what's available. I should admit at the outset that so > far I haven't attempted to do anything other than completely basic > customisations of org-mode. > > q2: It's my impression that the majority of current users aren't > scared of (e)lisp. (personally I am skill/knowledge-less but not > scared). Is there a 'template'/'model' function a user should look > at if they wanted to implement their own sparse-tree creation > function? I am thinking of a function that takes as arguments a > node's properties (and possibly also tags, priority, timestamps), > and computes a TRUE/FALSE value (err, t/nil?) that specifies whether > the subtree rooted at that point should be included in the search > results. I've seen the section in the manual 'using the property > API'; perhaps what I'm talking about is an extension to that API. If > all users had to do were provide a predicate function include- > subtree-in-sparse-tree, and org-mode deals with the tree traversal, > producing the formatted output, etc, then perhaps it wouldn't be > that hard for a user to implement something new like the > > operators? Perhaps. Having said all that, of course I do appreciate > the nice intuitive syntax for performing tag/property searches. I > was just wondering about a general way of making it easy for users > to extend the search functionality, and perhaps reduce the burden on > the main developer of responding to requests like my q1. > > Dan > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Apple-Mail-9-845697054 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi = Dan,

general comparison operators for properties = should have been implemented a long time ago, thanks for bring = this up.  This is now available in the GIT repository and will be = part of the upcoming 6.02 release - thanks for raising this = point.

Unfortunately there are no good examples = for true custom searches available.  Some of this is described = in the manual.  Basically, you need to use a general search to = pre-select some entries, for example a tags/property search with = the criterion "LEVEL>=3D2" (this already uses the new operators, so in = order to do this, make sure you have the latest devellopment = version...).  Then you need to write a function that will = decide if the entry at point should really be included, and if not, = where to continue the search.  A short description of this with a = small example can be found here:



HTH
- Carsten

On Apr 17, = 2008, at 2:19 PM, Dan Davison wrote:
I'd like = to ask about ways in which (sorted) sparse trees can be produced based = on numerical-valued properties. One thing I have in mind is that it = would seem natural to treat priority as a (1-dimensional) numerical = quantity, rather than as a categorical variable as it seems to be = currently. i.e. I'm attracted by the idea of being able to generate a = sparse tree containing all subtrees with priority greater than 2.5, and = to have headings in the sparse tree sorted by priority. (Of course I'm = not suggesting replacing the current priority system; in the above by = 'priority' I mean some user defined numerical-valued property.) [ Am I = right in thinking that one also can't do this currently with timestamps? = Not that that is necessarily needed as the agenda view does a lovely = job. ]

So one version of my question would be

q1. Would it = be possible to implement binary comparison operators >,<,>=3D,<=3D = for use in tag and property searches? (If true numeric comparisons are = difficult, then alphanumeric would still be useful.)

Sorry if = this is available already.

I also have a more general question, = which may well arise from my ignorance of what's available. I should = admit at the outset that so far I haven't attempted to do anything other = than completely basic customisations of org-mode.

q2:  It's = my impression that the majority of current users aren't scared of = (e)lisp. (personally I am skill/knowledge-less but not scared). Is there = a 'template'/'model' function a user should look at if they wanted to = implement their own sparse-tree creation function? I am thinking of a = function that takes as arguments a node's properties (and possibly also = tags, priority, timestamps), and computes a TRUE/FALSE value (err, = t/nil?) that specifies whether the subtree rooted at that point should = be included in the search results. I've seen the section in the manual = 'using the property API'; perhaps what I'm talking about is an extension = to that API. If all users had to do were provide a predicate function = include-subtree-in-sparse-tree, and org-mode deals with the tree = traversal, producing the formatted output, etc, then perhaps it wouldn't = be that hard for a user to implement something new like the > operators? = Perhaps. Having said all that, of course I do appreciate the nice = intuitive syntax for performing tag/property searches. I was just = wondering about a general way of making it easy for users to extend the = search functionality, and perhaps reduce the burden on the main = developer of responding to requests like my = q1.

Dan


_______________________________________________<= br>Emacs-orgmode mailing list
Remember: use `Reply All' to send = replies to the list.
Emacs-orgmode@gnu.org
http://lists.= gnu.org/mailman/listinfo/emacs-orgmode

= --Apple-Mail-9-845697054-- --===============0213831752== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0213831752==--