From 3a91400baac11e43a32b13463b593a638e7dc807 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 26 Jul 2010 09:53:17 +0200 Subject: [PATCH] Modified default number of blank lines when inserting an item. * org-list.el (org-list-insert-item-generic): the second item in a list will be separated from its predecessor with the number of blank lines separating the first item from its parent, if any, or no blank line. --- lisp/org-list.el | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index bacf064c2..53750b2a4 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -398,14 +398,8 @@ function ends." ;; Trivial cases where there should be none. ((or org-empty-line-terminates-plain-lists (not insert-blank-p)) 0) - ;; When `org-blank-before-new-entry' says so, or item is - ;; alone in the whole list, it is 1. - ((or (eq insert-blank-p t) - (save-excursion - (goto-char (org-list-top-point)) - (end-of-line) - (not (org-search-forward-unenclosed - org-item-beginning-re (org-list-bottom-point) t)))) 1) + ;; When `org-blank-before-new-entry' says so, it is 1. + ((eq insert-blank-p t) 1) ;; plain-list-item is 'auto. Count blank lines separating ;; neighbours items in list. (t (let ((next-p (org-get-next-item (point) (org-list-bottom-point)))) @@ -415,12 +409,10 @@ function ends." (org-back-over-empty-lines)) ;; Is there a previous item? ((not (org-first-list-item-p)) (org-back-over-empty-lines)) - ;; Local search failed: search globally. - ((and (goto-char (org-list-bottom-point)) - (beginning-of-line 0) - (org-search-backward-unenclosed "^[ \t]*$" (org-list-top-point) t)) - (1+ (org-back-over-empty-lines))) - ;; No blank line found in the whole list. + ;; Item alone: count lines separating it from parent, if any + ((/= (org-list-top-point) (point-at-bol)) + (org-back-over-empty-lines)) + ;; No parent: no blank line. (t 0))))))) (insert-fun (lambda (text)