Fix default value in `org-sparse-tree-default-date-type'

* lisp/org.el (org-sparse-tree-default-date-type): Use new default
  value instead of the undocumented previous one.  Fix docstring, too.
(org-sparse-tree): Apply change to previous variable.
(org-re-timestamp): Apply change to previous variable.  Refactor code.
This commit is contained in:
Nicolas Goaziou 2014-12-21 23:12:59 +01:00
parent 6f5bd30f0b
commit eae19b1284
1 changed files with 18 additions and 15 deletions

View File

@ -4707,24 +4707,25 @@ collapsed state."
:group 'org-sparse-trees :group 'org-sparse-trees
:type 'boolean) :type 'boolean)
(defcustom org-sparse-tree-default-date-type 'scheduled-or-deadline (defcustom org-sparse-tree-default-date-type nil
"The default date type when building a sparse tree. "The default date type when building a sparse tree.
When this is nil, a date is a scheduled or a deadline timestamp. When this is nil, a date is a scheduled or a deadline timestamp.
Otherwise, these types are allowed: Otherwise, these types are allowed:
all: all timestamps all: all timestamps
active: only active timestamps (<...>) active: only active timestamps (<...>)
inactive: only inactive timestamps (<...) inactive: only inactive timestamps ([...])
scheduled: only scheduled timestamps scheduled: only scheduled timestamps
deadline: only deadline timestamps" deadline: only deadline timestamps"
:type '(choice (const :tag "Scheduled or deadline" scheduled-or-deadline) :type '(choice (const :tag "Scheduled or deadline" nil)
(const :tag "All timestamps" all) (const :tag "All timestamps" all)
(const :tag "Only active timestamps" active) (const :tag "Only active timestamps" active)
(const :tag "Only inactive timestamps" inactive) (const :tag "Only inactive timestamps" inactive)
(const :tag "Only scheduled timestamps" scheduled) (const :tag "Only scheduled timestamps" scheduled)
(const :tag "Only deadline timestamps" deadline) (const :tag "Only deadline timestamps" deadline)
(const :tag "Only closed timestamps" closed)) (const :tag "Only closed timestamps" closed))
:version "24.3" :version "25.1"
:package-version '(Org . "8.3")
:group 'org-sparse-trees) :group 'org-sparse-trees)
(defun org-cycle-hide-archived-subtrees (state) (defun org-cycle-hide-archived-subtrees (state)
@ -13809,7 +13810,6 @@ D Show deadlines and scheduled items between a date range."
(deadline "only deadline") (deadline "only deadline")
(active "only active timestamps") (active "only active timestamps")
(inactive "only inactive timestamps") (inactive "only inactive timestamps")
(scheduled-or-deadline "scheduled/deadline")
(closed "with a closed time-stamp") (closed "with a closed time-stamp")
(otherwise "scheduled/deadline"))) (otherwise "scheduled/deadline")))
(let ((answer (read-char-exclusive))) (let ((answer (read-char-exclusive)))
@ -13817,8 +13817,8 @@ D Show deadlines and scheduled items between a date range."
(?c (?c
(org-sparse-tree (org-sparse-tree
arg arg
(cadr (memq type '(scheduled-or-deadline all scheduled deadline active (cadr
inactive closed))))) (memq type '(nil all scheduled deadline active inactive closed)))))
(?d (call-interactively 'org-check-deadlines)) (?d (call-interactively 'org-check-deadlines))
(?b (call-interactively 'org-check-before-date)) (?b (call-interactively 'org-check-before-date))
(?a (call-interactively 'org-check-after-date)) (?a (call-interactively 'org-check-after-date))
@ -17253,14 +17253,17 @@ Allowed values for TYPE are:
When TYPE is nil, fall back on returning a regexp that matches When TYPE is nil, fall back on returning a regexp that matches
both scheduled and deadline timestamps." both scheduled and deadline timestamps."
(cond ((eq type 'all) "\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\(?: +[^]+0-9> \n -]+\\)?\\(?: +[0-9]\\{1,2\\}:[0-9]\\{2\\}\\)?\\)") (case type
((eq type 'active) org-ts-regexp) (all org-ts-regexp-both)
((eq type 'inactive) "\\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^ \n>]*?\\)\\]") (active org-ts-regexp)
((eq type 'scheduled) (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")) (inactive org-ts-regexp-inactive)
((eq type 'deadline) (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")) (schedule org-scheduled-time-regexp)
((eq type 'closed) (concat org-closed-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^ \n>]*?\\)\\]")) (deadline org-deadline-time-regexp)
((eq type 'scheduled-or-deadline) (closed org-closed-time-regexp)
(concat "\\<\\(?:" org-deadline-string "\\|" org-scheduled-string "\\) *<\\([^>]+\\)>")))) (otherwise
(concat "\\<"
(regexp-opt (list org-deadline-string org-scheduled-string))
" *<\\([^>]+\\)>"))))
(defun org-check-before-date (date) (defun org-check-before-date (date)
"Check if there are deadlines or scheduled entries before DATE." "Check if there are deadlines or scheduled entries before DATE."