From: Marcel van der Boom <marcel@hsdev.com>
To: emacs-orgmode@gnu.org
Subject: org-add-note in adapted workflow always wants to be the last action
Date: Wed, 16 Oct 2013 11:41:36 +0200 [thread overview]
Message-ID: <87fvs15z8v.fsf@hsdev.com> (raw)
Hi,
I have written a snippet of code with the goal to ask me if I want to
archive a TODO item when marking it DONE or CANCELLED.
The code I have so far is this:
#+BEGIN_SRC emacs-lisp
(require 'org-habit)
;; I need a modified version of org-is-habit, which takes inheritance
;; in to account
(defun mrb/org-is-habit-recursive-p (&optional pom)
"Is the task at POM or point a habit, taking property
inheritance into account?"
(equalp "habit" (org-entry-get (or pom (point)) "STYLE" t)))
(defun mrb/archive-done-item()
;; Determine if the item went to the DONE/CANCELLED state
;; if so, ask to archive it, but skip habits which have
;; their own logic.
(when (and
(or
(equal org-state "DONE")
(equal org-state "CANCELLED"))
(not (mrb/org-is-habit-recursive-p)))
;; Try to use a dialog box to ask for confirmation
(setq last-nonmenu-event nil)
(org-archive-subtree-default-with-confirmation)))
;; Run archive for the item that changed state
(add-hook 'org-after-todo-state-change-hook
'mrb/archive-done-item)
#+END_SRC
The above works for marking items DONE. A dialog box pops up, I
(usually) hit enter and continue.
On marking items CANCELLED this does not work as expected because
the CANCELLED state is defined with the '@' postfix like so:
#+SEQ_TODO: WAITING TODO | DONE CANCELLED(@)
What happens now is that I first get the question on whether to
archive the item and after that I get asked to write a note.
This seems to be the case because the note is handled by adding it
to the post-command-hook through =org-add-log-setup= in the =org-todo=
command.
Is there anything I can do to reverse that order, i.e. Make sure
that the archiving question comes last?
My orgmode version is "8.1.1"
Thanks,
marcel
--
Marcel van der Boom -- http://hsdev.com/mvdb.vcf
HS-Development BV -- http://www.hsdev.com
We use bitcoin! -- http://bitcoin.org
reply other threads:[~2013-10-16 9:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fvs15z8v.fsf@hsdev.com \
--to=marcel@hsdev.com \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.