]> git.eshelyaron.com Git - emacs.git/commit
Fix todo-mode commands called on done items separator
authorStephen Berman <stephen.berman@gmx.net>
Wed, 1 Aug 2018 12:42:57 +0000 (14:42 +0200)
committerStephen Berman <stephen.berman@gmx.net>
Wed, 1 Aug 2018 12:42:57 +0000 (14:42 +0200)
commit22d463ed5ca262e1d8893b115c3f1237485fc7e0
tree4dfed30b619e33c73f054dcd0075035b8a3d30fe
parentcabe9e5126bfed05643d595589031cce8a404255
Fix todo-mode commands called on done items separator

The done items separator is not reachable by todo-mode navigation
commands, but it is e.g. by C-n and C-p.  Ensure that invoking
todo-mode commands with point on the separator does not result in
unexpected results, errors or file corruption (bug#32343).

* lisp/calendar/todo-mode.el (todo-insert-item--basic): Make
copying item and inserting item "here" noops when invoked on done
items separator.  Consolidate error handling of these cases.  Also
restrict "here" insertion to valid positions in the current
category, since this is simpler than the previous behavior of
inserting as the first item, which was moreover undocumented,
counterintuitive and superfluous.
(todo-set-item-priority, todo-move-item, todo-item-done)
(todo-item-start, todo-item-end): Make noops when invoked on done
items separator.

* test/lisp/calendar/todo-mode-tests.el: Require ert-x.
(todo-test--insert-item): Add formal parameters of
todo-insert-item--basic.
(todo-test--done-items-separator): New function.
(todo-test-done-items-separator01-bol)
(todo-test-done-items-separator01-eol)
(todo-test-done-items-separator02-bol)
(todo-test-done-items-separator02-eol)
(todo-test-done-items-separator03-bol)
(todo-test-done-items-separator03-eol)
(todo-test-done-items-separator04-bol)
(todo-test-done-items-separator04-eol)
(todo-test-done-items-separator05-bol)
(todo-test-done-items-separator05-eol)
(todo-test-done-items-separator06-bol)
(todo-test-done-items-separator06-eol)
(todo-test-done-items-separator07): New tests.
lisp/calendar/todo-mode.el
test/lisp/calendar/todo-mode-tests.el