diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2009-12-10 13:48:07 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2009-12-10 13:48:35 +0100 |
commit | 7dc0f4e4be4d5d8bc29d95736bdf11f1bf95ae42 (patch) | |
tree | cd97e5ad3a653ff271357c6b082da3b5f98d171a | |
parent | e78d7568cae21c08e99323e2ab271f56998d7aa5 (diff) | |
download | org-mode-7dc0f4e4be4d5d8bc29d95736bdf11f1bf95ae42.tar.gz |
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.
-rwxr-xr-x | lisp/ChangeLog | 3 | ||||
-rw-r--r-- | lisp/org-list.el | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ce900bd..de6aff0 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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. diff --git a/lisp/org-list.el b/lisp/org-list.el index edd612a..56cbc42 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -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))) |