Bläddra i källkod

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.
Carsten Dominik 15 år sedan
förälder
incheckning
7dc0f4e4be
2 ändrade filer med 5 tillägg och 1 borttagningar
  1. 3 0
      lisp/ChangeLog
  2. 2 1
      lisp/org-list.el

+ 3 - 0
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.
 

+ 2 - 1
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)))