Rename `org-x-priority' functions and variables to `org-priority-x'

* lisp/org.el (org-priority-enable-commands)
(org-priority-start-cycle-with-default)
(org-set-regexps-and-options, org-sort-entries, org-priority)
(org-get-priority, org-entry-properties)
(org-property-get-allowed-values, org-shiftup, org-shiftdown):
Rename `org-[x]-priority' functions and variables to
`org-priority-[x]'.

* lisp/org-pcomplete.el (org-priority-default)
(org-priority-highest)
(pcomplete/org-mode/file-option/priorities): Ditto.

* lisp/org-mouse.el (org-mouse-get-priority)
(org-mouse-priority-list): Ditto.

* lisp/org-agenda.el (org-agenda-fontify-priorities)
(org-agenda-format-item, org-agenda-priority): Ditto.

* lisp/ox-icalendar.el (org-icalendar--vtodo): Ditto.

* doc/org-manual.org (Priorities, Summary of In-Buffer Settings): Ditto.

* testing/lisp/test-org.el (test-org/set-regexps-and-options)
(test-org/entry-properties): Ditto.
This commit is contained in:
Bastien 2020-01-30 14:56:38 +01:00
parent 7b1077def7
commit 1de5e80adf
7 changed files with 70 additions and 70 deletions

View File

@ -4360,12 +4360,12 @@ TODO items.
Timestamps]]). See also [[*Packages that conflict with Org mode]], for
a discussion of the interaction with shift-selection.
#+vindex: org-highest-priority
#+vindex: org-lowest-priority
#+vindex: org-default-priority
#+vindex: org-priority-highest
#+vindex: org-priority-lowest
#+vindex: org-priority-default
You can change the range of allowed priorities by setting the
variables ~org-highest-priority~, ~org-lowest-priority~, and
~org-default-priority~. For an individual buffer, you may set these
variables ~org-priority-highest~, ~org-priority-lowest~, and
~org-priority-default~. For an individual buffer, you may set these
values (highest, lowest, default) like this (please make sure that the
highest priority is earlier in the alphabet than the lowest priority):
@ -18736,9 +18736,9 @@ changes.
- =#+PRIORITIES: highest lowest default= ::
#+cindex: @samp{PRIORITIES}, keyword
#+vindex: org-highest-priority
#+vindex: org-lowest-priority
#+vindex: org-default-priority
#+vindex: org-priority-highest
#+vindex: org-priority-lowest
#+vindex: org-priority-default
This line sets the limits and the default for the priorities. All
three must be either letters A--Z or numbers 0--9. The highest
priority must have a lower ASCII number than the lowest priority.

View File

@ -1924,8 +1924,8 @@ However, settings in `org-priority-faces' will overrule these faces.
When this variable is the symbol `cookies', only fontify the
cookies, not the entire task.
This may also be an association list of priority faces, whose
keys are the character values of `org-highest-priority',
`org-default-priority', and `org-lowest-priority' (the default values
keys are the character values of `org-priority-highest',
`org-priority-default', and `org-priority-lowest' (the default values
are ?A, ?B, and ?C, respectively). The face may be a named face, a
color as a string, or a list like `(:background \"Red\")'.
If it is a color, the variable `org-faces-easy-properties'
@ -3959,10 +3959,10 @@ FILTER-ALIST is an alist of filters we need to apply when
(let (b e p ov h l)
(goto-char (point-min))
(while (re-search-forward org-priority-regexp nil t)
(setq h (or (get-char-property (point) 'org-highest-priority)
org-highest-priority)
l (or (get-char-property (point) 'org-lowest-priority)
org-lowest-priority)
(setq h (or (get-char-property (point) 'org-priority-highest)
org-priority-highest)
l (or (get-char-property (point) 'org-priority-lowest)
org-priority-lowest)
p (string-to-char (match-string 2))
b (match-beginning 1)
e (if (eq org-agenda-fontify-priorities 'cookies)
@ -6676,8 +6676,8 @@ Any match of REMOVE-RE will be removed from TXT."
(org-add-props rtn nil
'org-category category
'tags (mapcar 'org-downcase-keep-props tags)
'org-highest-priority org-highest-priority
'org-lowest-priority org-lowest-priority
'org-priority-highest org-priority-highest
'org-priority-lowest org-priority-lowest
'time-of-day time-of-day
'duration duration
'breadcrumbs breadcrumbs
@ -9336,7 +9336,7 @@ Called with a universal prefix arg, show the priority instead of setting it."
(interactive "P")
(if (equal force-direction '(4))
(org-show-priority)
(unless org-enable-priority-commands
(unless org-priority-enable-commands
(error "Priority commands are disabled"))
(org-agenda-check-no-diary)
(let* ((col (current-column))

View File

@ -386,7 +386,7 @@ DEFAULT is returned if no priority is given in the headline."
(save-excursion
(if (org-mouse-re-search-line org-mouse-priority-regexp)
(match-string 1)
(when default (char-to-string org-default-priority)))))
(when default (char-to-string org-priority-default)))))
(defun org-mouse-delete-timestamp ()
"Deletes the current timestamp as well as the preceding keyword.
@ -407,7 +407,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
(> (match-end 0) point))))))
(defun org-mouse-priority-list ()
(cl-loop for priority from ?A to org-lowest-priority
(cl-loop for priority from ?A to org-priority-lowest
collect (char-to-string priority)))
(defun org-mouse-todo-menu (state)

View File

@ -48,7 +48,7 @@
(declare-function org-tag-alist-to-string "org" (alist &optional skip-key))
(defvar org-current-tag-alist)
(defvar org-default-priority)
(defvar org-priority-default)
(defvar org-drawer-regexp)
(defvar org-element-affiliated-keywords)
(defvar org-entities)
@ -56,10 +56,10 @@
(defvar org-export-exclude-tags)
(defvar org-export-select-tags)
(defvar org-file-tags)
(defvar org-highest-priority)
(defvar org-priority-highest)
(defvar org-link-abbrev-alist)
(defvar org-link-abbrev-alist-local)
(defvar org-lowest-priority)
(defvar org-priority-lowest)
(defvar org-options-keywords)
(defvar org-outline-regexp)
(defvar org-property-re)
@ -252,9 +252,9 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/file-option/priorities ()
"Complete arguments for the #+PRIORITIES file option."
(pcomplete-here (list (format "%c %c %c"
org-highest-priority
org-lowest-priority
org-default-priority))))
org-priority-highest
org-priority-lowest
org-priority-default))))
(defun pcomplete/org-mode/file-option/select_tags ()
"Complete arguments for the #+SELECT_TAGS file option."

View File

@ -2556,32 +2556,32 @@ property to one or more of these keywords."
:tag "Org Priorities"
:group 'org-todo)
(defcustom org-enable-priority-commands t
(defcustom org-priority-enable-commands t
"Non-nil means priority commands are active.
When nil, these commands will be disabled, so that you never accidentally
set a priority."
:group 'org-priorities
:type 'boolean)
(defcustom org-highest-priority ?A
(defcustom org-priority-highest ?A
"The highest priority of TODO items. A character like ?A, ?B etc.
Must have a smaller ASCII number than `org-lowest-priority'."
Must have a smaller ASCII number than `org-priority-lowest'."
:group 'org-priorities
:type 'character)
(defcustom org-lowest-priority ?C
(defcustom org-priority-lowest ?C
"The lowest priority of TODO items. A character like ?A, ?B etc.
Must have a larger ASCII number than `org-highest-priority'."
Must have a larger ASCII number than `org-priority-highest'."
:group 'org-priorities
:type 'character)
(defcustom org-default-priority ?B
(defcustom org-priority-default ?B
"The default priority of TODO items.
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
step priority must not exceed the range from `org-priority-highest' to
`org-priority-lowest' which means that `org-priority-default' has to be
in this range exclusive or inclusive the range boundaries. Else the
first step refuses to set the default and the second will fall back
to (depending on the command used) the highest or lowest priority."
@ -2592,11 +2592,11 @@ to (depending on the command used) the highest or lowest priority."
"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 than the default priority.
See also `org-default-priority'."
See also `org-priority-default'."
:group 'org-priorities
:type 'boolean)
(defcustom org-get-priority-function nil
(defcustom org-priority-get-priority-function nil
"Function to extract the priority from a string.
The string is normally the headline. If this is nil Org computes the
priority from the priority cookie like [#A] in the headline. It returns
@ -4395,9 +4395,9 @@ related expressions."
;; Priorities.
(let ((priorities (cdr (assq 'priorities alist))))
(when priorities
(setq-local org-highest-priority (nth 0 priorities))
(setq-local org-lowest-priority (nth 1 priorities))
(setq-local org-default-priority (nth 2 priorities))))
(setq-local org-priority-highest (nth 0 priorities))
(setq-local org-priority-lowest (nth 1 priorities))
(setq-local org-priority-default (nth 2 priorities))))
;; Scripts.
(let ((scripts (assq 'scripts alist)))
(when scripts
@ -8171,7 +8171,7 @@ function is being called interactively."
((= dcst ?p)
(if (re-search-forward org-priority-regexp (point-at-eol) t)
(string-to-char (match-string 2))
org-default-priority))
org-priority-default))
((= dcst ?r)
(or (org-entry-get nil property) ""))
((= dcst ?o)
@ -11655,7 +11655,7 @@ or a character."
(warn "`org-priority' called with deprecated SHOW argument"))
(if (equal action '(4))
(org-show-priority)
(unless org-enable-priority-commands
(unless org-priority-enable-commands
(user-error "Priority commands are disabled"))
(setq action (or action 'set))
(let (current new news have remove)
@ -11672,44 +11672,44 @@ or a character."
(if (not (eq action 'set))
(setq new action)
(message "Priority %c-%c, SPC to remove: "
org-highest-priority org-lowest-priority)
org-priority-highest org-priority-lowest)
(save-match-data
(setq new (read-char-exclusive))))
(when (and (= (upcase org-highest-priority) org-highest-priority)
(= (upcase org-lowest-priority) org-lowest-priority))
(when (and (= (upcase org-priority-highest) org-priority-highest)
(= (upcase org-priority-lowest) org-priority-lowest))
(setq new (upcase new)))
(cond ((equal new ?\s) (setq remove t))
((or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority))
((or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest))
(user-error "Priority must be between `%c' and `%c'"
org-highest-priority org-lowest-priority))))
org-priority-highest org-priority-lowest))))
((eq action 'up)
(setq new (if have
(1- current) ; normal cycling
;; last priority was empty
(if (eq last-command this-command)
org-lowest-priority ; wrap around empty to lowest
org-priority-lowest ; wrap around empty to lowest
;; default
(if org-priority-start-cycle-with-default
org-default-priority
(1- org-default-priority))))))
org-priority-default
(1- org-priority-default))))))
((eq action 'down)
(setq new (if have
(1+ current) ; normal cycling
;; last priority was empty
(if (eq last-command this-command)
org-highest-priority ; wrap around empty to highest
org-priority-highest ; wrap around empty to highest
;; default
(if org-priority-start-cycle-with-default
org-default-priority
(1+ org-default-priority))))))
org-priority-default
(1+ org-priority-default))))))
(t (user-error "Invalid action")))
(when (or (< (upcase new) org-highest-priority)
(> (upcase new) org-lowest-priority))
(when (or (< (upcase new) org-priority-highest)
(> (upcase new) org-priority-lowest))
(if (and (memq action '(up down))
(not have) (not (eq last-command this-command)))
;; `new' is from default priority
(error
"The default can not be set, see `org-default-priority' why")
"The default can not be set, see `org-priority-default' why")
;; normal cycling: `new' is beyond highest/lowest priority
;; and is wrapped around to the empty priority
(setq remove t)))
@ -11749,11 +11749,11 @@ and by additional input from the age of a schedules or deadline entry."
(defun org-get-priority (s)
"Find priority cookie and return priority."
(save-match-data
(if (functionp org-get-priority-function)
(funcall org-get-priority-function s)
(if (functionp org-priority-get-priority-function)
(funcall org-priority-get-priority-function s)
(if (not (string-match org-priority-regexp s))
(* 1000 (- org-lowest-priority org-default-priority))
(* 1000 (- org-lowest-priority
(* 1000 (- org-priority-lowest org-priority-default))
(* 1000 (- org-priority-lowest
(string-to-char (match-string 2 s))))))))
;;;; Tags
@ -13159,7 +13159,7 @@ strings."
(push (cons "PRIORITY"
(if (looking-at org-priority-regexp)
(match-string-no-properties 2)
(char-to-string org-default-priority)))
(char-to-string org-priority-default)))
props)
(when specific (throw 'exit props)))
(when (or (not specific) (string= specific "FILE"))
@ -13923,8 +13923,8 @@ completion."
(setq vals (org-with-point-at pom
(append org-todo-keywords-1 '("")))))
((equal property "PRIORITY")
(let ((n org-lowest-priority))
(while (>= n org-highest-priority)
(let ((n org-priority-lowest))
(while (>= n org-priority-highest)
(push (char-to-string n) vals)
(setq n (1- n)))))
((equal property "CATEGORY"))
@ -17499,7 +17499,7 @@ individual commands for more information."
(call-interactively (if org-edit-timestamp-down-means-later
'org-timestamp-down 'org-timestamp-up)))
((and (not (eq org-support-shift-select 'always))
org-enable-priority-commands
org-priority-enable-commands
(org-at-heading-p))
(call-interactively 'org-priority-up))
((and (not org-support-shift-select) (org-at-item-p))
@ -17525,7 +17525,7 @@ individual commands for more information."
(call-interactively (if org-edit-timestamp-down-means-later
'org-timestamp-up 'org-timestamp-down)))
((and (not (eq org-support-shift-select 'always))
org-enable-priority-commands
org-priority-enable-commands
(org-at-heading-p))
(call-interactively 'org-priority-down))
((and (not org-support-shift-select) (org-at-item-p))

View File

@ -763,10 +763,10 @@ Return VTODO component as a string."
"SEQUENCE:1\n"
(format "PRIORITY:%d\n"
(let ((pri (or (org-element-property :priority entry)
org-default-priority)))
(floor (- 9 (* 8. (/ (float (- org-lowest-priority pri))
(- org-lowest-priority
org-highest-priority)))))))
org-priority-default)))
(floor (- 9 (* 8. (/ (float (- org-priority-lowest pri))
(- org-priority-lowest
org-priority-highest)))))))
(format "STATUS:%s\n"
(if (eq (org-element-property :todo-type entry) 'todo)
"NEEDS-ACTION"

View File

@ -2354,13 +2354,13 @@ SCHEDULED: <2014-03-04 tue.>"
'(?X ?Z ?Y)
(org-test-with-temp-text "#+PRIORITIES: X Z Y"
(org-mode-restart)
(list org-highest-priority org-lowest-priority org-default-priority))))
(list org-priority-highest org-priority-lowest org-priority-default))))
(should
(equal
'(?A ?C ?B)
(org-test-with-temp-text "#+PRIORITIES: X Z"
(org-mode-restart)
(list org-highest-priority org-lowest-priority org-default-priority))))
(list org-priority-highest org-priority-lowest org-priority-default))))
;; STARTUP keyword.
(should
(equal '(t t)
@ -5334,7 +5334,7 @@ Paragraph<point>"
(org-test-with-temp-text "* [#A] H"
(cdr (assoc "PRIORITY" (org-entry-properties))))))
(should
(equal (char-to-string org-default-priority)
(equal (char-to-string org-priority-default)
(org-test-with-temp-text "* H"
(cdr (assoc "PRIORITY" (org-entry-properties nil "PRIORITY"))))))
;; Get "FILE" property.