From mboxrd@z Thu Jan 1 00:00:00 1970 From: "I.S." Subject: Re: proposal for enhanced org-get-priority function Date: Fri, 29 Oct 2010 07:53:37 -0400 Message-ID: <4CCAB5C1.1080002@gmail.com> References: <4CBF237F.1080602@gmail.com> <87aam34cy0.wl%dmaus@ictsoc.de> <4CC814B6.3070603@gmail.com> <4CCAB3D8.5010505@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080800040104090407050601" Return-path: Received: from [140.186.70.92] (port=50422 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBnWn-0000iG-Hz for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 07:53:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBnWk-000521-Ug for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 07:53:49 -0400 Received: from mail-qw0-f41.google.com ([209.85.216.41]:44586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBnWk-00051v-QZ for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 07:53:46 -0400 Received: by qwi2 with SMTP id 2so3028991qwi.0 for ; Fri, 29 Oct 2010 04:53:46 -0700 (PDT) In-Reply-To: <4CCAB3D8.5010505@gmail.com> 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: David Maus Cc: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------080800040104090407050601 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sorry, previous patch had some junk in it. Attached is the final version (really). Sorry again for the confusion, -I.S. On 10/29/2010 7:45 AM, I.S. wrote: > Sorry, I realized the previous patch did not contain updates to the > org-priority-regexp. An updated patch is attached. > > Sorry, > -I.S. > > > > On 10/27/2010 8:01 AM, I.S. wrote: >> On 10/24/2010 3:18 PM, David Maus wrote: >>> At Wed, 20 Oct 2010 13:14:39 -0400, >>> I.S. wrote: >>>> Dear Experts, >>>> >>>> I'd like to propose a replacement for the org-get-priority function >>>> which is backward compatible with the current version but allows the >>>> user to add a sub-priority such as [#A]-5 or [#B]+3: >>>> >>> Could you provide a patch against current master and send it to the >>> list as a text/plain attachment? This way the proposed modification >>> will end up in Org's patchtracker[1]. >>> >>> Best, >>> -- David >>> >>> [1] http://patchwork.newartisans.com/project/org-mode/ >>> -- >>> OpenPGP... 0x99ADB83B5A4478E6 >>> Jabber.... dmjena@jabber.org >>> Email..... dmaus@ictsoc.de >> >> I tried looing at patchwork but couldn't figure out what I was >> supposed to do. Please advise on usage instructions. >> >> Instead, I attached a manually generated patch against org.el in the >> development version from git. I created this patch via >> >> $ git clone git://repo.or.cz/org-mode.git >> $ emacs org-mode/lisp/org.el # to modify the file and write it to >> org.mine.el >> $ diff -rup org.el org.mine.el > org-get-priority.patch >> >> Please advise on proper procedure as I love org and would enjoy the >> chance to contribute in the future. >> >> Thanks, >> -I.S. >> --------------080800040104090407050601 Content-Type: text/plain; name="org-get-priority.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="org-get-priority.patch" --- org.el 2010-10-29 07:41:17.254401572 -0400 +++ org.mine.el 2010-10-29 07:49:11.814892725 -0400 @@ -12129,7 +12129,7 @@ from the `before-change-functions' in th ;;;; Priorities -(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]\\)\\] ?\\)" +(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]\\)\\]\\(-[0-9]+\\)? ?\\)" "Regular expression matching the priority indicator.") (defvar org-remove-priority-next-time nil) @@ -12211,13 +12211,27 @@ ACTION can be `set', `up', `down', or a (message "Priority of current item set to %s" news)))) (defun org-get-priority (s) - "Find priority cookie and return priority." - (save-match-data - (if (not (string-match org-priority-regexp s)) - (* 1000 (- org-lowest-priority org-default-priority)) - (* 1000 (- org-lowest-priority - (string-to-char (match-string 2 s))))))) + "Find priority cookie and return priority. +Priorities of the form [#]- or +[#]+ are supported with +/- being +optional and modifying the letter priority. The letter priority +is multiplied by 100000 and then the number priority is added +on. Thus a priority string of [#B]+5 is higher than [#B] which is +higher than [#B]-2 and all are lower than [#A]. +" + (save-match-data + (let* ((priority-match (string-match org-priority-regexp s)) + (priority-value (if priority-match + (* 100000 (- org-lowest-priority + (string-to-char (match-string 2 s)))) + (* 100000 (- org-lowest-priority +org-default-priority)))) + (sub-priority-match (match-string 3 s)) + (sub-priority-value (if sub-priority-match + (string-to-number sub-priority-match) 0))) + (+ priority-value sub-priority-value)))) + ;;;; Tags (defvar org-agenda-archives-mode) --------------080800040104090407050601 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --------------080800040104090407050601--