Bugfix: Avoid unnecessary empty line inserted by changing TODO entry.
commit4138be27ba8145c93742ea0b18b64f918a633dcc
authorCarsten Dominik <carsten.dominik@gmail.com>
Sun, 22 Feb 2009 12:44:01 +0000 (22 13:44 +0100)
committerCarsten Dominik <carsten.dominik@gmail.com>
Sun, 22 Feb 2009 12:44:01 +0000 (22 13:44 +0100)
tree32d2163eefe5152ec68a9d73bfbb5a07d81d700a
parent9989e5f0309d4433a920806b9d040f0e8295fee6
Bugfix: Avoid unnecessary empty line inserted by changing TODO entry.

This commit fixes the bug discussed in:

   http://thread.gmane.org/gmane.emacs.orgmode/11106

The reason for the empty line being inserted is subtle:

The function `org-add-planning-info' is used to add and remove planning
info time stamps (deadline, scheduled, closed) from the second line in
an entry.  Usually, the function is called to add something, with an
optional argument to also remove something.  In doing so, it assumes
that the second line must be there, and if it is not there, it creates
it.

Now, sometimes `org-add-planning-info' is called only to remove a time
stamp.  In this particular case it was to remove the CLOSED time
stamp.  This happens when the state is changed from a DONE or nil
state to a not-done state.  The idea behind this is that maybe to
entry was marked earlier as DONE, but the user has changed his mind,
so the timestamp recording when it was finished should be removed.

So in this case, an empty line was created, assuming that there would
be something to add - only nothing was added.

This commit arranges for checking if there is something to add before
creating an empty line.
lisp/ChangeLog
lisp/org.el