Remove `org-list-empty-line-terminates-plain-lists'

* lisp/org-list.el (org-list-empty-line-terminates-plain-lists): Remove
  variable.
(org-list-end-re):
(org-list-separating-blank-lines-number):
* lisp/org.el (org-blank-before-new-entry): Adapt to change above.

* testing/lisp/test-org-element.el (test-org-element/at-point):
* testing/lisp/test-org-list.el (test-org-list/move-item-down):
(test-org-list/move-item-up):
(test-org-list/insert-item): Update tests.

This variable is not useful: plain lists can always be terminated with
two blank lines.
This commit is contained in:
Nicolas Goaziou 2015-08-14 16:31:16 +02:00
parent 10cb9d7323
commit 67fe03bcd7
5 changed files with 37 additions and 63 deletions

View File

@ -12,6 +12,10 @@ Please send Org bug reports to emacs-orgmode@gnu.org.
** New functions
~org-show-children~ is a faster implementation of
~outline-show-children~.
** Removed options
*** Remove ~org-list-empty-line-terminates-plain-lists~
Two consecutive blank lines always terminate all levels of current
plain list.
* Version 8.3
** Incompatible changes

View File

@ -259,14 +259,6 @@ spaces instead of one after the bullet in each item of the list."
(const :tag "never" nil)
(regexp)))
(define-obsolete-variable-alias 'org-empty-line-terminates-plain-lists
'org-list-empty-line-terminates-plain-lists "24.4") ;; Since 8.0
(defcustom org-list-empty-line-terminates-plain-lists nil
"Non-nil means an empty line ends all plain list levels.
Otherwise, two of them will be necessary."
:group 'org-plain-lists
:type 'boolean)
(defcustom org-list-automatic-rules '((checkbox . t)
(indent . t))
"Non-nil means apply set of rules when acting on lists.
@ -383,10 +375,8 @@ specifically, type `block' is determined by the variable
;;; Predicates and regexps
(defconst org-list-end-re (if org-list-empty-line-terminates-plain-lists "^[ \t]*\n"
"^[ \t]*\n[ \t]*\n")
"Regex corresponding to the end of a list.
It depends on `org-list-empty-line-terminates-plain-lists'.")
(defconst org-list-end-re "^[ \t]*\n[ \t]*\n"
"Regex matching the end of a plain list.")
(defconst org-list-full-item-re
(concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)\\(?:[ \t]+\\|$\\)\\)"
@ -1222,7 +1212,7 @@ some heuristics to guess the result."
(point))))))))
(cond
;; Trivial cases where there should be none.
((or org-list-empty-line-terminates-plain-lists (not insert-blank-p)) 0)
((not insert-blank-p) 0)
;; 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

View File

@ -1624,11 +1624,7 @@ this variable on for the duration of the command."
The value is an alist, with `heading' and `plain-list-item' as CAR,
and a boolean flag as CDR. The cdr may also be the symbol `auto', in
which case Org will look at the surrounding headings/items and try to
make an intelligent decision whether to insert a blank line or not.
For plain lists, if `org-list-empty-line-terminates-plain-lists' is set,
the setting here is ignored and no empty line is inserted to avoid breaking
the list structure."
make an intelligent decision whether to insert a blank line or not."
:group 'org-edit-structure
:type '(list
(cons (const heading)

View File

@ -3268,10 +3268,8 @@ Text
(should
(eq 'item
(org-test-with-temp-text "- Para1\n\n- Para2"
(progn (forward-line)
(org-element-type
(let ((org-list-empty-line-terminates-plain-lists nil))
(org-element-at-point)))))))
(forward-line)
(org-element-type (org-element-at-point)))))
;; Special case: at the last blank line in a plain list, return it
;; instead of the last item.
(should

View File

@ -481,9 +481,12 @@
(should (equal (buffer-string)
"- item 2\n- item 1\n - sub-item 1")))
;; Preserve blank lines.
(org-test-with-temp-text "- item 1\n\n- item 2"
(let ((org-list-empty-line-terminates-plain-lists nil)) (org-move-item-down))
(should (equal (buffer-string) "- item 2\n\n- item 1")))
(should
(equal
"- item 2\n\n- item 1"
(org-test-with-temp-text "- item 1\n\n- item 2"
(org-move-item-down)
(buffer-string))))
;; Error when trying to move the last item...
(org-test-with-temp-text "- item 1\n- item 2"
(forward-line)
@ -565,10 +568,13 @@
(should (equal (buffer-string)
"- item 2\n - sub-item 2\n- item 1")))
;; Preserve blank lines.
(org-test-with-temp-text "- item 1\n\n- item 2"
(search-forward "- item 2")
(let ((org-list-empty-line-terminates-plain-lists nil)) (org-move-item-up))
(should (equal (buffer-string) "- item 2\n\n- item 1")))
(should
(equal
"- item 2\n\n- item 1"
(org-test-with-temp-text "- item 1\n\n- item 2"
(search-forward "- item 2")
(org-move-item-up)
(buffer-string))))
;; Error when trying to move the first item...
(org-test-with-temp-text "- item 1\n- item 2"
(should-error (org-move-item-up)))
@ -630,20 +636,10 @@
"Test item insertion."
;; Blank lines specifications.
;;
;; Non-nil `org-blank-before-new-entry': insert a blank line, unless
;; `org-list-empty-line-terminates-plain-lists' is non-nil.
;; Non-nil `org-blank-before-new-entry': insert a blank line.
(should
(org-test-with-temp-text "- a"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . t))))
(end-of-line)
(org-insert-item)
(forward-line -1)
(looking-at "$"))))
(should-not
(org-test-with-temp-text "- a"
(let ((org-list-empty-line-terminates-plain-lists t)
(org-blank-before-new-entry '((plain-list-item . t))))
(let ((org-blank-before-new-entry '((plain-list-item . t))))
(end-of-line)
(org-insert-item)
(forward-line -1)
@ -651,8 +647,7 @@
;; Nil `org-blank-before-new-entry': do not insert a blank line.
(should-not
(org-test-with-temp-text "- a"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . nil))))
(let ((org-blank-before-new-entry '((plain-list-item . nil))))
(end-of-line)
(org-insert-item)
(forward-line -1)
@ -661,8 +656,7 @@
;; line already in the sole item, do not insert one.
(should-not
(org-test-with-temp-text "- a"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . auto))))
(let ((org-blank-before-new-entry '((plain-list-item . auto))))
(end-of-line)
(org-insert-item)
(forward-line -1)
@ -670,45 +664,37 @@
;; `org-blank-before-new-entry' set to `auto': if there's a blank
;; line in the sole item, insert another one.
(should
(org-test-with-temp-text "- a\n\n b"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . auto))))
(goto-char (point-max))
(org-test-with-temp-text "- a\n\n b<point>"
(let ((org-blank-before-new-entry '((plain-list-item . auto))))
(org-insert-item)
(forward-line -1)
(looking-at "$"))))
;; `org-blank-before-new-entry' set to `auto': if the user specified
;; a blank line, preserve it.
(should
(org-test-with-temp-text "- a\n\n"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . auto))))
(goto-char (point-max))
(org-test-with-temp-text "- a\n\n<point>"
(let ((org-blank-before-new-entry '((plain-list-item . auto))))
(org-insert-item)
(forward-line -1)
(looking-at "$"))))
;; `org-blank-before-new-entry' set to `auto': if some items in list
;; are already separated by blank lines, insert one.
(should
(org-test-with-temp-text "- a\n\n- b"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . auto))))
(goto-char (point-max))
(org-test-with-temp-text "- a\n\n- b<point>"
(let ((org-blank-before-new-entry '((plain-list-item . auto))))
(org-insert-item)
(forward-line -1)
(looking-at "$"))))
(should
(org-test-with-temp-text "- a\n\n- b"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . auto))))
(let ((org-blank-before-new-entry '((plain-list-item . auto))))
(org-insert-item)
(forward-line)
(looking-at "$"))))
(should
(org-test-with-temp-text "- a\n #+BEGIN_EXAMPLE\n\n x\n #+END_EXAMPLE"
(let ((org-list-empty-line-terminates-plain-lists nil)
(org-blank-before-new-entry '((plain-list-item . auto))))
(goto-char (point-max))
(org-test-with-temp-text
"- a\n #+BEGIN_EXAMPLE\n\n x\n #+END_EXAMPLE<point>"
(let ((org-blank-before-new-entry '((plain-list-item . auto))))
(org-insert-item)
(forward-line -1)
(looking-at "$"))))