Selaa lähdekoodia

Fix bug when buffer is starting with a list.

* org-list.el (org-list-in-item-p-with-indent): Test if first line is
  the item beginning.
* org-list.el (org-list-top-point-with-indent): Test if first line is
  a valid list beginning.
Nicolas Goaziou 14 vuotta sitten
vanhempi
commit
ebf5e1236b
1 muutettua tiedostoa jossa 12 lisäystä ja 4 poistoa
  1. 12 4
      lisp/org-list.el

+ 12 - 4
lisp/org-list.el

@@ -393,9 +393,13 @@ Return the position of the previous item, if applicable."
 	       (catch 'exit
 		 (while t
 		   (cond
-		    ((or (= (point) limit)
-			 (looking-at "^[ \t]*:END:"))
+		    ((looking-at "^[ \t]*:END:")
 		     (throw 'exit nil))
+		    ((<= (point) limit)
+		     (throw 'exit
+			    (and (org-at-item-p)
+				 (< (org-get-indentation) ind-ref)
+				 (point-at-bol))))
 		    ((looking-at "^[ \t]*$")
 		     (skip-chars-backward " \r\t\n")
 		     (beginning-of-line))
@@ -481,9 +485,13 @@ List ending is determined by indentation of text. See
 	       (while t
 		 (let ((ind (org-get-indentation)))
 		   (cond
-		    ((or (<= (point) limit)
-			 (looking-at "^[ \t]*:END:"))
+		    ((looking-at "^[ \t]*:END:")
 		     (throw 'exit item-ref))
+		    ((<= (point) limit)
+		     (throw 'exit
+			    (if (and (org-at-item-p) (< ind ind-ref))
+				(point-at-bol)
+			      item-ref)))
 		    ((looking-at "^[ \t]*$")
 		     (skip-chars-backward " \r\t\n")
 		     (beginning-of-line))