From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric J Haywiser Subject: RE: Behavior Change/Bug: Agenda sorting of deadline itemsv > 4.73 Date: Fri, 1 Feb 2008 11:57:14 -0500 (EST) Message-ID: References: <20080131103218.GB21734@atlantic.linksys.moosehall><8616E01A-5786-49E5-BA14-C5968EA2FE4A@science.uva.nl><20080131120310.GD21734@atlantic.linksys.moosehall><803AD9DF-C436-4733-B83D-90DBB16ADC21@science.uva.nl> <52D89C75FEE9444E8D9C016E3730098306CEB4@chsa1036.share.beluni.net> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKzCy-0001yx-Co for emacs-orgmode@gnu.org; Fri, 01 Feb 2008 11:57:44 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKzCx-0001wj-5S for emacs-orgmode@gnu.org; Fri, 01 Feb 2008 11:57:43 -0500 Received: from biscayne-one-station.mit.edu ([18.7.7.80]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JKzCw-0005Zq-PT for emacs-orgmode@gnu.org; Fri, 01 Feb 2008 11:57:42 -0500 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by biscayne-one-station.mit.edu (8.13.6/8.9.2) with ESMTP id m11GvLdA017812 for ; Fri, 1 Feb 2008 11:57:21 -0500 (EST) Received: from mass-toolpike.mit.edu (MASS-TOOLPIKE.MIT.EDU [18.7.18.72]) (authenticated bits=56) (User authenticated as ejh1@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id m11GvF55011631 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 1 Feb 2008 11:57:20 -0500 (EST) In-Reply-To: <52D89C75FEE9444E8D9C016E3730098306CEB4@chsa1036.share.beluni.net> 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: emacs-orgmode@gnu.org > Hm, the 4.67c behaviour seems a bit more sensible as it incorporates the > number of days that a deadline is delayed into the priority calculation. > Have a look at the function org-agenda-get-deadlines where the priority > of a deadline is calculated. Specifically the following code: > > : (setq s (match-string 1) > : pos (1- (match-beginning 1)) > : d2 (org-time-string-to-absolute (match-string 1) d1) > : diff (- d2 d1) > : wdays (org-get-wdays s) > : dfrac (/ (* 1.0 (- wdays diff)) wdays) > : upcomingp (and todayp (> diff 0))) > > and > > : 'priority (+ (if upcomingp (floor (* dfrac 10.)) 100) > : (org-get-priority txt)) > > You might be able to tweak this to get the desired behaviour. > > Hope that helps > Christian > Thank you. That pointer was very helpful. Without understanding all the details of the priority mechanism, I have this tweak which may introduce other issues. It maps deadlines in range [-deadline-warning-days -> +deadline-warning-days] to a priority [2*d-w-d -> 0]. The other priorities coming from org-get-priority are shifted 10x relative to 2*d-w-d regardless of d-w-d's value. This makes priorites coming from o-g-p have more weight than those calculated within o-a-g-d. I think this may have been the original idea with the (* 1000 and (+ 100 but I'm not really sure. diff org-5.19a.el org.el 14979d14978 < 14984,14985c14983,14984 < (* 1000 (- org-lowest-priority org-default-priority)) < (* 1000 (- org-lowest-priority --- > (* (expt 10 (+ (floor (log10 (* 2 org-deadline-warning-days))) 1)) (- org-lowest-priority org-default-priority)\ ) > (* (expt 10 (+ (floor (log10 (* 2 org-deadline-warning-days))) 1)) (- org-lowest-priority 21165c21164,21167 < upcomingp (and todayp (> diff 0))) --- > partialpriority (+ (- 0 diff) wdays) > upcomingp (and todayp (> diff 0)) > pastp (<= diff 0) > ) 21204,21205c21206 < 'priority (+ (if upcomingp (floor (* dfrac 10.)) 100) < (org-get-priority txt)) --- > 'priority (+ partialpriority (org-get-priority txt))