Fix list bug at beginning of buffer

David Maus writes:

> When `org-previous-item' is called on an item with nothing above it
> Orgmode enters an infinite loop. The reason is that
> `org-previous-item' searches for non-empty lines by moving point up
> line by line and if there is nothing above an item point gets stuck on
> begin of buffer.
>
> example.org
> ,----
> |
> |  - Item
> `----
>
> Move point on Item, M-x org-previous-item RET and Orgmode enters the
> infinite loop.
>
> Attached patch adds a conditional clause to `org-previous-item' that
> leaves the search loop if point reaches beginning of buffer.
This commit is contained in:
Carsten Dominik 2009-12-10 13:48:07 +01:00
parent e78d7568ca
commit 7dc0f4e4be
2 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2009-12-10 Carsten Dominik <carsten.dominik@gmail.com>
* org-list.el (org-previous-item): Exit at the beginning of the
buffer.
* org-id.el (org-id-locations-save): Only write the id locations
if any are defined.

View File

@ -616,7 +616,8 @@ Error if not at a plain list, or if this is the first item in the list."
(if (looking-at "[ \t]*$")
nil
(if (<= (setq ind1 (org-get-indentation)) ind)
(throw 'exit t)))))
(throw 'exit t)))
(if (bobp) (throw 'exit t))))
(condition-case nil
(if (or (not (org-at-item-p))
(< ind1 (1- ind)))