From b777e3969372f23ed357bdd4058c1445ccfe5d38 Mon Sep 17 00:00:00 2001
From: David Maus <maus.david@gmail.com>
Date: Sat, 5 Dec 2009 21:56:34 +0100
Subject: [PATCH] org-list.el: Prevent infinite loop in `org-previous-item'

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.

Patch adds a conditional clause that leaves the search loop if point
reaches beginning of buffer.
---
 lisp/org-list.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

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)))
-- 
1.6.5

