* org-add-note in adapted workflow always wants to be the last action
@ 2013-10-16 9:41 Marcel van der Boom
0 siblings, 0 replies; only message in thread
From: Marcel van der Boom @ 2013-10-16 9:41 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-10-16 9:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 9:41 org-add-note in adapted workflow always wants to be the last action Marcel van der Boom
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).