From 523f8986e73cffbb09d5d8da8f30c587eb695213 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 14 Jul 2008 11:23:57 -0700 Subject: [PATCH] Bug fix for plain lists starting in first line of a buffer. --- lisp/ChangeLog | 6 ++++++ lisp/org.el | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 39d5a9729..f2fc94abd 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2008-07-14 Carsten Dominik + + * org.el (org-renumber-ordered-list, org-beginning-of-item-list): + Cater for the case of a list starting in the first line of the + buffer. + 2008-07-09 Carsten Dominik * org-publish.el (org-publish-find-title): Bug fix. diff --git a/lisp/org.el b/lisp/org.el index 2499976c3..fc038e669 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6034,9 +6034,10 @@ with something like \"1.\" or \"2)\"." (buffer-substring (point-at-bol) (match-beginning 3)))) ;; (term (substring (match-string 3) -1)) ind1 (n (1- arg)) - fmt) + fmt bob) ;; find where this list begins (org-beginning-of-item-list) + (setq bobp (bobp)) (looking-at "[ \t]*[0-9]+\\([.)]\\)") (setq fmt (concat "%d" (match-string 1))) (beginning-of-line 0) @@ -6044,7 +6045,7 @@ with something like \"1.\" or \"2)\"." (catch 'exit (while t (catch 'next - (beginning-of-line 2) + (if bobp (setq bobp nil) (beginning-of-line 2)) (if (eobp) (throw 'exit nil)) (if (looking-at "[ \t]*$") (throw 'next nil)) (skip-chars-forward " \t") (setq ind1 (current-column)) @@ -6110,7 +6111,8 @@ I.e. to the first item in this list." (if (or (< ind1 ind) (and (= ind1 ind) (not (org-at-item-p))) - (bobp)) + (and (= (point-at-bol) (point-min)) + (setq pos (point-min)))) (throw 'exit t) (when (org-at-item-p) (setq pos (point-at-bol))))))) (goto-char pos)))