emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] changing TODO status with org-after-todo-state-change-hook defined fails
@ 2013-03-01 14:44 Eric S Fraga
  2013-03-01 16:31 ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2013-03-01 14:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]

Hello,

All of a sudden, changing the TODO status (=org-todo=) from anything to
WAIT is failing with:

: Error in post-command-hook (org-add-log-note): (error "Can't expand minibuffer to full frame")

and ends up asking for a date and time and inserts new SCHEDULED
information.  My TODO sequence is:

: org-todo-keywords '((sequence "TODO(t)" "INPR(i@/!)" "WAIT(w@/!)" "|" "DONE(d@/!)" "XXXX(x@)" "POST(p!)"))

I have the following hook defined:

#+begin_src emacs-lisp
(add-hook 'org-after-todo-state-change-hook
	  '(lambda ()
	     ;; remove the scheduled date/time if present as the activity is no longer mine
	     ;; based on a suggestion by Manish on the org-mode mailing list
	     (if (string= org-state "WAIT") (org-schedule t))))
#+end_src

This used to work in that it would remove any SCHEDULED entry in the
item.  Now not only does it not remove the SCHEDULED information, it
prompts for a date+time after the error message above.  No log note is
requested.  It also seems to delete some text after the logbook drawer
in some cases.

I simply do not understand what is happening!  With emacs -Q and only
the two settings above (i.e. not the rest of my org customisation), the
problem arises.  If I don't have the hook, there is no
problem.  Attached is my simple test file.  The log notes indicated I
was successful in changing from TODO to WAIT before I defined the
hook.  I then switched to TODO and tried to then switch back to
WAIT.  The logging of the latter failed.

I note that nothing appears to have changed in org-schedule recently.

Any suggestions (other than remove the hook ;-)?

Thanks,
eric

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3f-1315-g25b5ab

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: examplebug.org --]
[-- Type: text/x-org, Size: 406 bytes --]

#+TITLE:     examplebug.org
#+AUTHOR:    Eric S Fraga
#+options: toc:nil num:nil
#+TODO: TODO(t) INPR(i@/!) WAIT(w@/!) | DONE(d@/!) XXXX(x@) POST(p!)

* WAIT first test
  SCHEDULED: <2013-03-01 Fri>
  - State "TODO"       from "WAIT"       [2013-03-01 Fri 14:41]
  - State "WAIT"       from "TODO"       [2013-03-01 Fri 14:41] \\
    this works as I do not have the hook defined

  Something I need to do.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bug] changing TODO status with org-after-todo-state-change-hook defined fails
  2013-03-01 14:44 [bug] changing TODO status with org-after-todo-state-change-hook defined fails Eric S Fraga
@ 2013-03-01 16:31 ` Bastien
  2013-03-01 20:19   ` Eric S Fraga
  2013-03-01 22:16   ` Sebastien Vauban
  0 siblings, 2 replies; 5+ messages in thread
From: Bastien @ 2013-03-01 16:31 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Hi Eric,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> #+begin_src emacs-lisp
> (add-hook 'org-after-todo-state-change-hook
> 	  '(lambda ()
> 	     ;; remove the scheduled date/time if present as the activity is no longer mine
> 	     ;; based on a suggestion by Manish on the org-mode mailing list
> 	     (if (string= org-state "WAIT") (org-schedule t))))
> #+end_src

You need to use (org-schedule '(4)) here, this is part of a change
in master that allows to use C-u C-u C-c C-s to add a delay (and 
same for C-u C-u C-c C-d which adds a warning delay.)

> Any suggestions (other than remove the hook ;-)?

HTH!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bug] changing TODO status with org-after-todo-state-change-hook defined fails
  2013-03-01 16:31 ` Bastien
@ 2013-03-01 20:19   ` Eric S Fraga
  2013-03-01 22:16   ` Sebastien Vauban
  1 sibling, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2013-03-01 20:19 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Hi Eric,
>
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> #+begin_src emacs-lisp
>> (add-hook 'org-after-todo-state-change-hook
>> 	  '(lambda ()
>> 	     ;; remove the scheduled date/time if present as the activity is no longer mine
>> 	     ;; based on a suggestion by Manish on the org-mode mailing list
>> 	     (if (string= org-state "WAIT") (org-schedule t))))
>> #+end_src
>
> You need to use (org-schedule '(4)) here, this is part of a change
> in master that allows to use C-u C-u C-c C-s to add a delay (and 
> same for C-u C-u C-c C-d which adds a warning delay.)
>
> HTH!

It does indeed!  I did read the description of org-schedule to remind
myself of why I had what I did there but I kind of skimmed over the
"universal argument" bit... <blush>

However, I would suggest that a more graceful exit might be good?  I
still do not understand why the log message wasn't prompted for.

Anyway, thanks: my setup is working again as it should!

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3f-1313-g7d4812

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bug] changing TODO status with org-after-todo-state-change-hook defined fails
  2013-03-01 16:31 ` Bastien
  2013-03-01 20:19   ` Eric S Fraga
@ 2013-03-01 22:16   ` Sebastien Vauban
  2013-03-02 10:25     ` Bastien
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2013-03-01 22:16 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Bastien,

Bastien wrote:
> Eric S Fraga <e.fraga-hclig2XLE9Zaa/9Udqfwiw@public.gmane.org> writes:
>
> You need to use (org-schedule '(4)) here, this is part of a change in master
> that allows to use C-u C-u C-c C-s to add a delay (and same for C-u C-u C-c
> C-d which adds a warning delay.)

I find the use of C-u C-u C-c C-d full of promise, but not yet there:

I do C-c C-d and set a deadline on Fri 8 of March.

I do C-u C-u C-d C-d and S-Left twice: in the agenda, I see the date moving to
the 27 of Feb, 2 days before today; but the warning will be applied starting 2
days (the count is right) before the 8 of March.

I think we should see the 8 of March as reference date for fixing the start
date (or length, depending on how we see it) of the warning delay.

It's even more weird if we S-Right from the current date: it seems that the
difference in days is taken in absolute value, but I'm not even sure of that.

Is it possible to put the reference date correctly when we call C-u C-u C-c
C-d?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bug] changing TODO status with org-after-todo-state-change-hook defined fails
  2013-03-01 22:16   ` Sebastien Vauban
@ 2013-03-02 10:25     ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2013-03-02 10:25 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: OrgMode ML

Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> I think we should see the 8 of March as reference date for fixing the start
> date (or length, depending on how we see it) of the warning delay.

That's now the case, thanks for reporting this.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-02 11:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-01 14:44 [bug] changing TODO status with org-after-todo-state-change-hook defined fails Eric S Fraga
2013-03-01 16:31 ` Bastien
2013-03-01 20:19   ` Eric S Fraga
2013-03-01 22:16   ` Sebastien Vauban
2013-03-02 10:25     ` Bastien

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).