Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2014-04-21 09:22:54 +02:00
commit 881459c6bc
1 changed files with 38 additions and 43 deletions

View File

@ -13609,49 +13609,44 @@ a Show deadlines and scheduled items after a date.
d Show deadlines due within `org-deadline-warning-days'. d Show deadlines due within `org-deadline-warning-days'.
D Show deadlines and scheduled items between a date range." D Show deadlines and scheduled items between a date range."
(interactive "P") (interactive "P")
(let (ans kwd value ts-type)
(setq type (or type org-sparse-tree-default-date-type)) (setq type (or type org-sparse-tree-default-date-type))
(setq org-ts-type type) (setq org-ts-type type)
(message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [D]ates range\n [c]ycle through date types: %s" (message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty
(cond ((eq type 'all) "all timestamps") [d]eadlines [b]efore-date [a]fter-date [D]ates range
((eq type 'scheduled) "only scheduled") [c]ycle through date types: %s"
((eq type 'deadline) "only deadline") (case type
((eq type 'active) "only active timestamps") (all "all timestamps")
((eq type 'inactive) "only inactive timestamps") (scheduled "only scheduled")
((eq type 'scheduled-or-deadline) "scheduled/deadline") (deadline "only deadline")
((eq type 'closed) "with a closed time-stamp") (active "only active timestamps")
(t "scheduled/deadline"))) (inactive "only inactive timestamps")
(setq ans (read-char-exclusive)) (scheduled-or-deadline "scheduled/deadline")
(cond (closed "with a closed time-stamp")
((equal ans ?c) (otherwise "scheduled/deadline")))
(let ((answer (read-char-exclusive)))
(case answer
(?c
(org-sparse-tree (org-sparse-tree
arg (cadr (member type '(scheduled-or-deadline arg
all scheduled deadline active inactive closed))))) (cadr (memq type '(scheduled-or-deadline all scheduled deadline active
((equal ans ?d) inactive closed)))))
(call-interactively 'org-check-deadlines)) (?d (call-interactively #'org-check-deadlines))
((equal ans ?b) (?b (call-interactively #'org-check-before-date))
(call-interactively 'org-check-before-date)) (?a (call-interactively #'org-check-after-date))
((equal ans ?a) (?D (call-interactively #'org-check-dates-range))
(call-interactively 'org-check-after-date)) (?t (call-interactively #'org-show-todo-tree))
((equal ans ?D) (?T (org-show-todo-tree '(4)))
(call-interactively 'org-check-dates-range)) (?m (call-interactively #'org-match-sparse-tree))
((equal ans ?t) ((?p ?P)
(call-interactively 'org-show-todo-tree)) (let* ((kwd (org-icompleting-read
((equal ans ?T) "Property: " (mapcar #'list (org-buffer-property-keys))))
(org-show-todo-tree '(4))) (value (org-icompleting-read
((member ans '(?T ?m)) "Value: " (mapcar #'list (org-property-values kwd)))))
(call-interactively 'org-match-sparse-tree))
((member ans '(?p ?P))
(setq kwd (org-icompleting-read "Property: "
(mapcar 'list (org-buffer-property-keys))))
(setq value (org-icompleting-read "Value: "
(mapcar 'list (org-property-values kwd))))
(unless (string-match "\\`{.*}\\'" value) (unless (string-match "\\`{.*}\\'" value)
(setq value (concat "\"" value "\""))) (setq value (concat "\"" value "\""))))
(org-match-sparse-tree arg (concat kwd "=" value))) (org-match-sparse-tree arg (concat kwd "=" value)))
((member ans '(?r ?R ?/)) ((?r ?R ?/) (call-interactively #'org-occur))
(call-interactively 'org-occur)) (otherwise (user-error "No such sparse tree command \"%c\"" answer)))))
(t (user-error "No such sparse tree command \"%c\"" ans)))))
(defvar org-occur-highlights nil (defvar org-occur-highlights nil
"List of overlays used for occur matches.") "List of overlays used for occur matches.")