summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-08-14 16:31:16 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-08-14 16:34:37 +0200
commit67fe03bcd788a2f5206cd094d5e03a112499b726 (patch)
tree1a27e2d26f2ab8a2a2c3ebb696aa35fa6c99b0b4
parent10cb9d7323ae6b2c7e367c0171efdcd7115b5f63 (diff)
downloadorg-mode-67fe03bcd788a2f5206cd094d5e03a112499b726.tar.gz
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.
-rw-r--r--etc/ORG-NEWS4
-rw-r--r--lisp/org-list.el16
-rwxr-xr-xlisp/org.el6
-rw-r--r--testing/lisp/test-org-element.el6
-rw-r--r--testing/lisp/test-org-list.el68
5 files changed, 37 insertions, 63 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 58ea1b7..99c613d 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -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
diff --git a/lisp/org-list.el b/lisp/org-list.el
index e6a78f7..d865a78 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -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
diff --git a/lisp/org.el b/lisp/org.el
index c19bab0..737054a 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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)
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index f55c3ee..73a5459 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -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
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el
index b327f49..46bcf08 100644
--- a/testing/lisp/test-org-list.el
+++ b/testing/lisp/test-org-list.el
@@ -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 "$"))))