From: Carsten Dominik <carsten.dominik@gmail.com>
To: Wes Hardaker <wjhns209@hardakers.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: patch for local variable based todo blocking
Date: Mon, 1 Feb 2010 17:36:14 +0100 [thread overview]
Message-ID: <722DA288-B750-44C9-8ABC-44A700DD7DF6@gmail.com> (raw)
In-Reply-To: <sdd40uf5jz.fsf@wjh.hardakers.net>
Applied, thanks.
- Carsten
On Jan 28, 2010, at 7:27 PM, Wes Hardaker wrote:
>
> Attached is a patch that lets local variables define whether or not
> todo
> dependency blocking should be used (both for TODOs and for
> checkboxes).
> I have one file in particular that I'm using checkboxes to quickly
> indicate multi-selections from a list but for most of my files I want
> TODOs blocked by uncompleted checkboxes.
>
> Normally org uses hook methods for checking for TODO blocks and this
> patch just inserts a check at the top to test and see if the variable
> turning on the blocking type is still set.
>
> --
> Wes Hardaker
> My Pictures: http://capturedonearth.com/
> My Thoughts: http://pontifications.hardakers.net/
> diff --git a/lisp/org.el b/lisp/org.el
> index cd378b4..bdc5c5a 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -10159,54 +10159,56 @@ changes. Such blocking occurs when:
> 3. The parent of the task is blocked because it has siblings that
> should
> be done first, or is child of a block grandparent TODO entry."
>
> - (catch 'dont-block
> - ;; If this is not a todo state change, or if this entry is
> already DONE,
> - ;; do not block
> - (when (or (not (eq (plist-get change-plist :type) 'todo-state-
> change))
> - (member (plist-get change-plist :from)
> - (cons 'done org-done-keywords))
> - (member (plist-get change-plist :to)
> - (cons 'todo org-not-done-keywords))
> - (not (plist-get change-plist :to)))
> - (throw 'dont-block t))
> - ;; If this task has children, and any are undone, it's blocked
> - (save-excursion
> - (org-back-to-heading t)
> - (let ((this-level (funcall outline-level)))
> - (outline-next-heading)
> - (let ((child-level (funcall outline-level)))
> - (while (and (not (eobp))
> - (> child-level this-level))
> - ;; this todo has children, check whether they are all
> - ;; completed
> - (if (and (not (org-entry-is-done-p))
> - (org-entry-is-todo-p))
> - (throw 'dont-block nil))
> - (outline-next-heading)
> - (setq child-level (funcall outline-level))))))
> - ;; Otherwise, if the task's parent has the :ORDERED: property,
> and
> - ;; any previous siblings are undone, it's blocked
> - (save-excursion
> - (org-back-to-heading t)
> - (let* ((pos (point))
> - (parent-pos (and (org-up-heading-safe) (point))))
> - (if (not parent-pos) (throw 'dont-block t)) ; no parent
> - (when (and (org-entry-get (point) "ORDERED")
> - (forward-line 1)
> - (re-search-forward org-not-done-heading-regexp pos t))
> - (throw 'dont-block nil)) ; block, there is an older sibling not
> done.
> - ;; Search further up the hierarchy, to see if an anchestor is
> blocked
> - (while t
> - (goto-char parent-pos)
> - (if (not (looking-at org-not-done-heading-regexp))
> - (throw 'dont-block t)) ; do not block, parent is not a TODO
> - (setq pos (point))
> - (setq parent-pos (and (org-up-heading-safe) (point)))
> + (if (not org-enforce-todo-dependencies)
> + t ; if locally turned off don't block
> + (catch 'dont-block
> + ;; If this is not a todo state change, or if this entry is
> already DONE,
> + ;; do not block
> + (when (or (not (eq (plist-get change-plist :type) 'todo-state-
> change))
> + (member (plist-get change-plist :from)
> + (cons 'done org-done-keywords))
> + (member (plist-get change-plist :to)
> + (cons 'todo org-not-done-keywords))
> + (not (plist-get change-plist :to)))
> + (throw 'dont-block t))
> + ;; If this task has children, and any are undone, it's blocked
> + (save-excursion
> + (org-back-to-heading t)
> + (let ((this-level (funcall outline-level)))
> + (outline-next-heading)
> + (let ((child-level (funcall outline-level)))
> + (while (and (not (eobp))
> + (> child-level this-level))
> + ;; this todo has children, check whether they are all
> + ;; completed
> + (if (and (not (org-entry-is-done-p))
> + (org-entry-is-todo-p))
> + (throw 'dont-block nil))
> + (outline-next-heading)
> + (setq child-level (funcall outline-level))))))
> + ;; Otherwise, if the task's parent has the :ORDERED:
> property, and
> + ;; any previous siblings are undone, it's blocked
> + (save-excursion
> + (org-back-to-heading t)
> + (let* ((pos (point))
> + (parent-pos (and (org-up-heading-safe) (point))))
> (if (not parent-pos) (throw 'dont-block t)) ; no parent
> (when (and (org-entry-get (point) "ORDERED")
> (forward-line 1)
> (re-search-forward org-not-done-heading-regexp pos t))
> - (throw 'dont-block nil))))))) ; block, older sibling not done.
> + (throw 'dont-block nil)) ; block, there is an older sibling
> not done.
> + ;; Search further up the hierarchy, to see if an anchestor is
> blocked
> + (while t
> + (goto-char parent-pos)
> + (if (not (looking-at org-not-done-heading-regexp))
> + (throw 'dont-block t)) ; do not block, parent is not a TODO
> + (setq pos (point))
> + (setq parent-pos (and (org-up-heading-safe) (point)))
> + (if (not parent-pos) (throw 'dont-block t)) ; no parent
> + (when (and (org-entry-get (point) "ORDERED")
> + (forward-line 1)
> + (re-search-forward org-not-done-heading-regexp pos t))
> + (throw 'dont-block nil)))))))) ; block, older sibling not
> done.
>
> (defcustom org-track-ordered-property-with-tag nil
> "Should the ORDERED property also be shown as a tag?
> @@ -10250,30 +10252,32 @@ See variable `org-track-ordered-property-
> with-tag'."
> "Block turning an entry into a TODO, using checkboxes.
> This checks whether the current task should be blocked from state
> changes because there are unchecked boxes in this entry."
> - (catch 'dont-block
> - ;; If this is not a todo state change, or if this entry is
> already DONE,
> - ;; do not block
> - (when (or (not (eq (plist-get change-plist :type) 'todo-state-
> change))
> - (member (plist-get change-plist :from)
> - (cons 'done org-done-keywords))
> - (member (plist-get change-plist :to)
> - (cons 'todo org-not-done-keywords))
> - (not (plist-get change-plist :to)))
> - (throw 'dont-block t))
> - ;; If this task has checkboxes that are not checked, it's blocked
> - (save-excursion
> - (org-back-to-heading t)
> - (let ((beg (point)) end)
> - (outline-next-heading)
> - (setq end (point))
> - (goto-char beg)
> - (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\
> [[- ]\\]"
> - end t)
> - (progn
> - (if (boundp 'org-blocked-by-checkboxes)
> - (setq org-blocked-by-checkboxes t))
> - (throw 'dont-block nil)))))
> - t)) ; do not block
> + (if (not org-enforce-todo-checkbox-dependencies)
> + t ; if locally turned off don't block
> + (catch 'dont-block
> + ;; If this is not a todo state change, or if this entry is
> already DONE,
> + ;; do not block
> + (when (or (not (eq (plist-get change-plist :type) 'todo-state-
> change))
> + (member (plist-get change-plist :from)
> + (cons 'done org-done-keywords))
> + (member (plist-get change-plist :to)
> + (cons 'todo org-not-done-keywords))
> + (not (plist-get change-plist :to)))
> + (throw 'dont-block t))
> + ;; If this task has checkboxes that are not checked, it's
> blocked
> + (save-excursion
> + (org-back-to-heading t)
> + (let ((beg (point)) end)
> + (outline-next-heading)
> + (setq end (point))
> + (goto-char beg)
> + (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\
> [[- ]\\]"
> + end t)
> + (progn
> + (if (boundp 'org-blocked-by-checkboxes)
> + (setq org-blocked-by-checkboxes t))
> + (throw 'dont-block nil)))))
> + t))) ; do not block
>
> (defun org-entry-blocked-p ()
> "Is the current entry blocked?"
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
prev parent reply other threads:[~2010-02-01 17:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-28 18:27 patch for local variable based todo blocking Wes Hardaker
2010-02-01 16:36 ` Carsten Dominik [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=722DA288-B750-44C9-8ABC-44A700DD7DF6@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=wjhns209@hardakers.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).