emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] extend doc strings of priority defcustoms
Date: Mon, 30 May 2011 23:10:13 +0200	[thread overview]
Message-ID: <BANLkTimDKBD-tyoASHxmfUu80bFUPyj9EQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimJ4CXAwXZoQyiFpB_+nGzzwyE1Cw@mail.gmail.com>

In the meantime I understand better what happens. I rewrote the doc
strings and added an error message to avoid the wrong error "No
priority cookie found in line" for the case of org-default-priority
out of range. My previous patch is to be replaced by this one:

* org.el (org-default-priority): Document dependency on
org-priority-start-cycle-with-default.
(org-priority-start-cycle-with-default): Document dependency on
org-default-priority.
(org-priority): Error added for case of org-default-priority out of
range.
---
 lisp/org.el |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 498c606..241fa11 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2488,14 +2488,20 @@ Must have a larger ASCII number than
`org-highest-priority'."

 (defcustom org-default-priority ?B
   "The default priority of TODO items.
-This is the priority an item get if no explicit priority is given."
+This is the priority an item gets if no explicit priority is given.
+When starting to cycle on an empty priority the first step in the cycle
+depends on `org-priority-start-cycle-with-default'.  The resulting first
+step priority must not exceed the range from `org-highest-priority' to
+`org-lowest-priority' which means that `org-default-priority' has to be
+in this range exclusive or inclusive the range boundaries."
   :group 'org-priorities
   :type 'character)

 (defcustom org-priority-start-cycle-with-default t
   "Non-nil means start with default priority when starting to cycle.
 When this is nil, the first step in the cycle will be (depending on the
-command used) one higher or lower that the default priority."
+command used) one higher or lower than the default priority.
+See also `org-default-priority'."
   :group 'org-priorities
   :type 'boolean)

@@ -12306,12 +12312,18 @@ ACTION can be `set', `up', `down', or a character."
 	(if (and (not have) (eq last-command this-command))
 	    (setq new org-lowest-priority)
 	  (setq new (if (and org-priority-start-cycle-with-default (not have))
-			org-default-priority (1- current)))))
+			org-default-priority (1- current)))
+	  (when (< (upcase new) org-highest-priority)
+	    (error
+	     "See `org-default-priority' for range limit exceeded here"))))
        ((eq action 'down)
 	(if (and (not have) (eq last-command this-command))
 	    (setq new org-highest-priority)
 	  (setq new (if (and org-priority-start-cycle-with-default (not have))
-			org-default-priority (1+ current)))))
+			org-default-priority (1+ current)))
+	  (when (> (upcase new) org-lowest-priority)
+	    (error
+	     "See `org-default-priority' for range limit exceeded here"))))
        (t (error "Invalid action")))
       (if (or (< (upcase new) org-highest-priority)
 	      (> (upcase new) org-lowest-priority))
-- 
1.7.4.2

  reply	other threads:[~2011-05-30 21:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 18:23 [PATCH] extend doc strings of priority defcustoms Michael Brand
2011-05-30 21:10 ` Michael Brand [this message]
2011-05-31 17:52   ` Michael Brand

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=BANLkTimDKBD-tyoASHxmfUu80bFUPyj9EQ@mail.gmail.com \
    --to=michael.ch.brand@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).