emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Dmitri Minaev" <minaev@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: in-buffer settings for priorities
Date: Wed, 16 May 2007 16:47:26 +0500	[thread overview]
Message-ID: <b6c377310705160447y61558066t5d48d02382b3fa0e@mail.gmail.com> (raw)
In-Reply-To: <b6c377310705160243l136b09a1q2c9ab72d00a5d5ea@mail.gmail.com>

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

Sorry, there was a wrapped line in the diff. See

-- 
With best regards,
Dmitri Minaev

Russian history blog: http://minaev.blogspot.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.diff --]
[-- Type: text/x-patch; name="org.diff", Size: 5086 bytes --]

--- ../org-4.74/org.el	2007-05-13 12:25:40.000000000 +0500
+++ org.el	2007-05-16 13:20:17.000000000 +0500
@@ -1527,9 +1527,8 @@
   :tag "Org Priorities"
   :group 'org-todo)
 
-(defcustom org-default-priority ?B
-  "The default priority of TODO items.
-This is the priority an item get if no explicit priority is given."
+(defcustom org-highest-priority ?A
+  "The highest priority of TODO items.  A character like ?A, ?B etc."
   :group 'org-priorities
   :type 'character)
 
@@ -1538,6 +1537,12 @@
   :group 'org-priorities
   :type 'character)
 
+(defcustom org-default-priority org-lowest-priority
+  "The default priority of TODO items.
+This is the priority an item get if no explicit priority is given."
+  :group 'org-priorities
+  :type 'character)
+
 (defgroup org-time nil
   "Options concerning time stamps and deadlines in Org-mode."
   :tag "Org Time"
@@ -3346,9 +3351,9 @@
     (org-set-local 'org-todo-sets nil)
     (let ((re (org-make-options-regexp
 	       '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
-		 "STARTUP" "ARCHIVE" "TAGS" "LINK")))
+		 "STARTUP" "ARCHIVE" "TAGS" "LINK" "PRIORITY_HIGH" "PRIORITY_LOW" "PRIORITY_DEFAULT")))
 	  (splitre "[ \t]+")
-	  kwds key value cat arch tags links hw dws tail sep kws1)
+	  kwds key value cat arch tags links hw dws tail sep kws1 prio-high prio-low prio-def)
       (save-excursion
 	(save-restriction
 	  (widen)
@@ -3371,6 +3376,12 @@
 		(push (cons (match-string 1 value)
 			    (org-trim (match-string 2 value)))
 		      links)))
+	     ((equal key "PRIORITY_HIGH")
+	      (setq prio-high value))
+	     ((equal key "PRIORITY_LOW")
+	      (setq prio-low value))
+	     ((equal key "PRIORITY_DEFAULT")
+	      (setq prio-def value))
 	     ((equal key "STARTUP")
 	      (let ((opts (org-split-string value splitre))
 		    l var val)
@@ -3390,6 +3401,9 @@
 				      '(face t fontified t) arch)))
 	    )))
       (and cat (org-set-local 'org-category cat))
+      (and prio-high (org-set-local 'org-highest-priority (aref prio-high 0)))
+      (and prio-low (org-set-local 'org-lowest-priority (aref prio-low 0)))
+      (and prio-def (org-set-local 'org-default-priority (aref prio-def 0)))
       (and arch (org-set-local 'org-archive-location arch))
       (and links (setq org-link-abbrev-alist-local (nreverse links)))
       ;; Process the TODO keywords
@@ -4150,7 +4164,7 @@
 	   (list (concat "^\\*+[ \t]*" org-not-done-regexp)
 		 '(1 'org-todo t))
 	   ;; Priorities
-	   (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t))
+	   (list (concat "\\[#[A-Z0-9]\\]") '(0 'org-special-keyword t))
 	   ;; Special keywords
 	   (list org-repeat-re  '(0 'org-special-keyword t))
 	   (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
@@ -11983,7 +11997,7 @@
 
 ;;;; Priorities
 
-(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z]\\)\\] ?\\)"
+(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]\\)\\] ?\\)"
   "Regular expression matching the priority indicator.")
 
 (defvar org-remove-priority-next-time nil)
@@ -12012,18 +12026,18 @@
 	(setq current org-default-priority))
       (cond
        ((eq action 'set)
-	(message "Priority A-%c, SPC to remove: " org-lowest-priority)
+	(message "Priority %c-%c, SPC to remove: " org-highest-priority org-lowest-priority)
 	(setq new (read-char-exclusive))
 	(cond ((equal new ?\ ) (setq remove t))
-	      ((or (< (upcase new) ?A) (> (upcase new) org-lowest-priority))
+	      ((or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority))
 	       (error "Priority must be between `%c' and `%c'"
-		      ?A org-lowest-priority))))
+		      org-highest-priority org-lowest-priority))))
        ((eq action 'up)
 	(setq new (1- current)))
        ((eq action 'down)
 	(setq new (1+ current)))
        (t (error "Invalid action")))
-      (setq new (min (max ?A (upcase new)) org-lowest-priority))
+      (setq new (min (max org-highest-priority (upcase new)) org-lowest-priority))
       (setq news (format "%c" new))
       (if have
 	  (if remove
@@ -14219,7 +14233,7 @@
 	(setq tmp (calendar-date-string tmp)))
       (setq props (plist-put props 'date tmp)))
     (when (setq tmp (plist-get props 'txt))
-      (when (string-match "\\[#\\([A-Z]\\)\\] ?" tmp)
+      (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp)
 	(plist-put props 'priority-letter (match-string 1 tmp))
 	(setq tmp (replace-match "" t t tmp)))
       (when (and (setq re (plist-get props 'org-todo-regexp))
@@ -19499,7 +19513,7 @@
 				 (substring hd (match-end 1))))
 	      (setq pri org-default-priority))
 	    (setq pri (floor (1+ (* 8. (/ (float (- org-lowest-priority pri))
-					  (- org-lowest-priority ?A))))))
+					  (- org-lowest-priority org-highest-priority))))))
 
 	    (princ (format "BEGIN:VTODO
 %s
@@ -20509,7 +20523,7 @@
 	(push (org-point-in-group p 4 :tags) clist))
       (goto-char p)
       (skip-chars-backward "^[\n\r \t") (or (eobp) (backward-char 1))
-      (if (looking-at "\\[#[A-Z]\\]")
+      (if (looking-at "\\[#[A-Z0-9]\\]")
 	  (push (org-point-in-group p 0 :priority) clist)))
 
      ((org-at-item-p)

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

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2007-05-16 11:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16  9:43 in-buffer settings for priorities Dmitri Minaev
2007-05-16 11:47 ` Dmitri Minaev [this message]
2007-05-20 15:45 ` Carsten Dominik
2007-05-21 13:11   ` Dmitri Minaev
2007-05-21 14:35     ` Carsten Dominik
2007-05-22  8:07       ` Dmitri Minaev
2007-05-29 15:27         ` Carsten Dominik
2007-05-22  4:57     ` Carsten Dominik

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=b6c377310705160447y61558066t5d48d02382b3fa0e@mail.gmail.com \
    --to=minaev@gmail.com \
    --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).