Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-01-22 13:54:26 +01:00
commit 9dafef9fa8
1 changed files with 33 additions and 35 deletions

View File

@ -4910,45 +4910,43 @@ Stuck projects are project that have no next actions. For the definitions
of what a project is and how to check if it stuck, customize the variable of what a project is and how to check if it stuck, customize the variable
`org-stuck-projects'." `org-stuck-projects'."
(interactive) (interactive)
(let* ((org-agenda-skip-function (let* ((org-agenda-overriding-header
'org-agenda-skip-entry-when-regexp-matches-in-subtree)
;; We could have used org-agenda-skip-if here.
(org-agenda-overriding-header
(or org-agenda-overriding-header "List of stuck projects: ")) (or org-agenda-overriding-header "List of stuck projects: "))
(matcher (nth 0 org-stuck-projects)) (matcher (nth 0 org-stuck-projects))
(todo (nth 1 org-stuck-projects)) (todo (nth 1 org-stuck-projects))
(todo-wds (if (member "*" todo)
(progn
(org-agenda-prepare-buffers (org-agenda-files
nil 'ifmode))
(org-delete-all
org-done-keywords-for-agenda
(copy-sequence org-todo-keywords-for-agenda)))
todo))
(todo-re (concat "^\\*+[ \t]+\\("
(mapconcat 'identity todo-wds "\\|")
"\\)\\>"))
(tags (nth 2 org-stuck-projects)) (tags (nth 2 org-stuck-projects))
(tags-re (if (member "*" tags) (gen-re (org-string-nw-p (nth 3 org-stuck-projects)))
(concat org-outline-regexp-bol (todo-wds
".*:[[:alnum:]_@#%]+:[ \t]*$") (if (not (member "*" todo)) todo
(if tags (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode))
(concat org-outline-regexp-bol (org-delete-all org-done-keywords-for-agenda
".*:\\(" (copy-sequence org-todo-keywords-for-agenda))))
(mapconcat #'identity tags "\\|") (todo-re (and todo
"\\):[[:alnum:]_@#%:]*[ \t]*$")))) (format "^\\*+[ \t]+\\(%s\\)\\>"
(gen-re (nth 3 org-stuck-projects)) (mapconcat #'identity todo-wds "\\|"))))
(re-list (tags-re (cond ((null tags) nil)
(delq nil ((member "*" tags)
(list (eval-when-compile
(if todo todo-re) (concat org-outline-regexp-bol
(if tags tags-re) ".*:[[:alnum:]_@#%]+:[ \t]*$")))
(and gen-re (stringp gen-re) (string-match "\\S-" gen-re) (tags (concat org-outline-regexp-bol
gen-re))))) ".*:\\("
(setq org-agenda-skip-regexp (mapconcat #'identity tags "\\|")
(if re-list "\\):[[:alnum:]_@#%:]*[ \t]*$"))
(mapconcat 'identity re-list "\\|") (t nil)))
(error "No information how to identify unstuck projects"))) (re-list (delq nil (list todo-re tags-re gen-re)))
(skip-re
(if (null re-list)
(error "Missing information to identify unstuck projects")
(mapconcat #'identity re-list "\\|")))
(org-agenda-skip-function
;; Skip entry if `org-agenda-skip-regexp' matches anywhere
;; in the subtree.
`(lambda ()
(and (save-excursion
(let ((case-fold-search nil))
(re-search-forward ,skip-re (org-end-of-subtree t) t)))
(progn (outline-next-heading) (point))))))
(org-tags-view nil matcher) (org-tags-view nil matcher)
(setq org-agenda-buffer-name (buffer-name)) (setq org-agenda-buffer-name (buffer-name))
(with-current-buffer org-agenda-buffer-name (with-current-buffer org-agenda-buffer-name