emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "I.S." <inquisitive.scientist@gmail.com>
To: David Maus <dmaus@ictsoc.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: proposal for enhanced org-get-priority function
Date: Wed, 27 Oct 2010 08:01:58 -0400	[thread overview]
Message-ID: <4CC814B6.3070603@gmail.com> (raw)
In-Reply-To: <87aam34cy0.wl%dmaus@ictsoc.de>

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

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.


[-- Attachment #2: org-get-priority.patch --]
[-- Type: text/plain, Size: 1465 bytes --]

emin@martinian.com's password: 
--- org.el	2010-10-27 07:47:50.702497227 -0400
+++ org.mine.el	2010-10-27 07:48:59.090619203 -0400
@@ -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 [#<letter>]-<number> or
+[#<letter>]+<number> are supported with +/-<number> 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)

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

  parent reply	other threads:[~2010-10-27 12:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20 17:14 proposal for enhanced org-get-priority function I.S.
2010-10-24 19:18 ` David Maus
2010-10-24 20:05   ` George Pearson
2010-10-27 12:01   ` I.S. [this message]
2010-10-29 11:45     ` I.S.
2010-10-29 11:53       ` I.S.
2010-11-15 10:25         ` Carsten Dominik
2010-11-15 12:07           ` Juan Pechiar
2010-11-15 12:15             ` Carsten Dominik
2010-11-15 18:05             ` I.S.
2010-11-16  0:30               ` Samuel Wales
2010-11-17  8:16               ` Carsten Dominik
2010-11-17 13:11                 ` I.S.
2010-11-17 19:21                 ` Matt Lundin
2010-11-16  1:11           ` Matt Lundin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CC814B6.3070603@gmail.com \
    --to=inquisitive.scientist@gmail.com \
    --cc=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).