|
@@ -423,6 +423,12 @@ This is a list of four items:
|
|
|
a tag, any tag will mark the project unstuck.
|
|
|
4. An arbitrary regular expression matching non-stuck projects.
|
|
|
|
|
|
+If the project turns out to be not stuck, search continues also in the
|
|
|
+subtree to see if any of the subtasks have project status.
|
|
|
+
|
|
|
+See also the variable `org-tags-match-list-sublevels' which applies
|
|
|
+to projects matched by this search as well.
|
|
|
+
|
|
|
After defining this variable, you may use \\[org-agenda-list-stuck-projects]
|
|
|
or `C-c a #' to produce the list."
|
|
|
:group 'org-agenda-custom-commands
|
|
@@ -3146,6 +3152,18 @@ used by user-defined selections using `org-agenda-skip-function'.")
|
|
|
This variable should not be set directly, but custom commands can bind it
|
|
|
in the options section.")
|
|
|
|
|
|
+(defun org-agenda-skip-entry-when-regexp-matches ()
|
|
|
+ "Checks if the current entry contains match for `org-agenda-skip-regexp'.
|
|
|
+If yes, it returns the end position of this entry, causing agenda commands
|
|
|
+to skip the entry but continuing the search in the subtree. This is a
|
|
|
+function that can be put into `org-agenda-skip-function' for the duration
|
|
|
+of a command."
|
|
|
+ (let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
+ skip)
|
|
|
+ (save-excursion
|
|
|
+ (setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
+ (and skip end)))
|
|
|
+
|
|
|
(defun org-agenda-skip-subtree-when-regexp-matches ()
|
|
|
"Checks if the current subtree contains match for `org-agenda-skip-regexp'.
|
|
|
If yes, it returns the end position of this tree, causing agenda commands
|
|
@@ -3157,6 +3175,20 @@ to skip this subtree. This is a function that can be put into
|
|
|
(setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
(and skip end)))
|
|
|
|
|
|
+(defun org-agenda-skip-entry-when-regexp-matches-in-subtree ()
|
|
|
+ "Checks if the current subtree contains match for `org-agenda-skip-regexp'.
|
|
|
+If yes, it returns the end position of the current entry (NOT the tree),
|
|
|
+causing agenda commands to skip the entry but continuing the search in
|
|
|
+the subtree. This is a function that can be put into
|
|
|
+`org-agenda-skip-function' for the duration of a command. An important
|
|
|
+use of this function is for the stuck project list."
|
|
|
+ (let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
+ (entry-end (save-excursion (outline-next-heading) (1- (point))))
|
|
|
+ skip)
|
|
|
+ (save-excursion
|
|
|
+ (setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
+ (and skip entry-end)))
|
|
|
+
|
|
|
(defun org-agenda-skip-entry-if (&rest conditions)
|
|
|
"Skip entry if any of CONDITIONS is true.
|
|
|
See `org-agenda-skip-if' for details."
|
|
@@ -3227,7 +3259,8 @@ of what a project is and how to check if it stuck, customize the variable
|
|
|
`org-stuck-projects'.
|
|
|
MATCH is being ignored."
|
|
|
(interactive)
|
|
|
- (let* ((org-agenda-skip-function 'org-agenda-skip-subtree-when-regexp-matches)
|
|
|
+ (let* ((org-agenda-skip-function
|
|
|
+ 'org-agenda-skip-entry-when-regexp-matches-in-subtree)
|
|
|
;; We could have used org-agenda-skip-if here.
|
|
|
(org-agenda-overriding-header "List of stuck projects: ")
|
|
|
(matcher (nth 0 org-stuck-projects))
|
|
@@ -3246,9 +3279,10 @@ MATCH is being ignored."
|
|
|
(tags (nth 2 org-stuck-projects))
|
|
|
(tags-re (if (member "*" tags)
|
|
|
(org-re "^\\*+ .*:[[:alnum:]_@]+:[ \t]*$")
|
|
|
- (concat "^\\*+ .*:\\("
|
|
|
- (mapconcat 'identity tags "\\|")
|
|
|
- (org-re "\\):[[:alnum:]_@:]*[ \t]*$"))))
|
|
|
+ (if tags
|
|
|
+ (concat "^\\*+ .*:\\("
|
|
|
+ (mapconcat 'identity tags "\\|")
|
|
|
+ (org-re "\\):[[:alnum:]_@:]*[ \t]*$")))))
|
|
|
(gen-re (nth 3 org-stuck-projects))
|
|
|
(re-list
|
|
|
(delq nil
|