From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Loury Subject: Re: Is OrgMode really GTD compliant? Date: Tue, 29 Apr 2014 12:30:26 +0200 Message-ID: <877g68jum5.fsf@konixwork.incubateur.ens-lyon.fr> References: <87wqeaqp5t.fsf@berkeley.edu> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf5J9-0005ya-Oo for emacs-orgmode@gnu.org; Tue, 29 Apr 2014 06:30:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wf5J4-0007fO-V5 for emacs-orgmode@gnu.org; Tue, 29 Apr 2014 06:30:39 -0400 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]:41868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf5J4-0007fG-Lo for emacs-orgmode@gnu.org; Tue, 29 Apr 2014 06:30:34 -0400 Received: by mail-we0-f172.google.com with SMTP id u57so2797620wes.17 for ; Tue, 29 Apr 2014 03:30:33 -0700 (PDT) In-Reply-To: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt , Rene Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi, Alan Schmitt writes: > On 2014-04-28 19:18, Rene writes: > I have not defined an Energy property, but I recently played with date > properties (and a user defined sorting function). If it's helpful to > you, the code is there: > https://github.com/brabalan/org-review/blob/master/org-review.el#L156 I looked at the code and I don't get what means the part of the code getting the org-marker text property of a: --8<---------------cut here---------------start------------->8--- (get-text-property (point-min) 'org-marker a) --8<---------------cut here---------------end--------------->8--- In this part, the point-min returns the point-min of the current buffer (the agenda buffer in that case) while the function looks for the property into a. I tried launching this code into a custom agenda compare function and I get the error: --8<---------------cut here---------------start------------->8--- Args out of range: 1197, 1197 --8<---------------cut here---------------end--------------->8--- This makes sense since the agenda appears to be narrowed at that time so that (point-min) returns 1197 and the a string at this time is not 1197 characters long. Replacing (point-min) by 0 appears to work (I assumed the 0th character of the string has the wanted text property). My first guess of an energy cmp function is: --8<---------------cut here---------------start------------->8--- (defun org-energy-compare (a b) (let* ( (ma (or (get-text-property 0 'org-marker a) (get-text-property 0 'org-hd-marker a))) (mb (or (get-text-property 0 'org-marker b) (get-text-property 0 'org-hd-marker b))) (energy_a (org-entry-get ma "Energy")) (energy_b (org-entry-get mb "Energy")) ) (cond ((and (not energy_a) (not energy_b) ) nil ) ((and energy_a (not energy_b) ) 1 ) ((and (not energy_a) energy_b ) -1 ) ((> energy_a energy_b) 1 ) ((< energy_a energy_b) -1 ) (t nil ) ) ) ) --8<---------------cut here---------------end--------------->8--- Incidentally, I don't manage to have edebug triggered in a custom org agenda cmp function. I load the function with C-u C-M-x. the message "Edebug: org-energy-compare" appears as usual. When I launch the agenda I can see the function has been called since the entries are correctly sorted. But I was never given the input to debug it. Do you know why? -- Konubinix GPG Key : 7439106A Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTX39DAAoJEHXSPO10ORBqA34IAJsygFXp0UZ5raIYCHKAtSdG pNPuxGRuR/i81tJY2KlnyCDmk1ge3EUU5oRqs8NFHkt/l1MjLsFZZkVa10B90jDu bcKQNB1To/eVRv4gplMtZCHN6bBGYDPUIsGjlNAvNTf8x0mhkg7Oa6RaLmdtlDk9 ep29M57uv3hdilI+kJNPVakvX6jIg76NIA9jW8UykdqqO7KcC43EGox4zrHj4otW uRvBSYG2AFw3A3ydtm1KhLgA4xaW2+a0qJgf853/PgQGxZeTglDdENW3BW401Zgn Hy3sySQttFtZ53iQdbm4BJwDH+vIagqglH4mjWNjKwqqhZdfhrIHwC4KOAao+9c= =4xDP -----END PGP SIGNATURE----- --=-=-=--