Przeglądaj źródła

org-list: Remove two defcustoms

* lisp/org-list.el (org-list-ending-method, org-list-end-regexp):
  Removed variables.
(org-in-item-p, org-list-separating-blank-lines-number,
org-list-parse-list, org-list-struct): Apply changes.
* lisp/org-exp.el (org-export-mark-list-end,
  org-export-mark-list-properties): Apply changes.
* lisp/org-latex.el (org-export-latex-lists): Apply changes.
* doc/org.texi (Plain lists): Document removal.

Conflicts:

	lisp/org-list.el
Nicolas Goaziou 13 lat temu
rodzic
commit
8b7a3f2498
4 zmienionych plików z 23 dodań i 81 usunięć
  1. 3 8
      doc/org.texi
  2. 2 4
      lisp/org-exp.el
  3. 1 3
      lisp/org-latex.el
  4. 17 66
      lisp/org-list.el

+ 3 - 8
doc/org.texi

@@ -1587,16 +1587,11 @@ line.  In particular, if an ordered list reaches number @samp{10.}, then the
 list.  An item ends before the next line that is less or equally indented
 list.  An item ends before the next line that is less or equally indented
 than its bullet/number.
 than its bullet/number.
 
 
-@vindex org-list-ending-method
-@vindex org-list-end-regexp
 @vindex org-empty-line-terminates-plain-lists
 @vindex org-empty-line-terminates-plain-lists
-Two methods@footnote{To disable either of them, configure
-@code{org-list-ending-method}.} are provided to terminate lists.  A list ends
-whenever every item has ended, which means before any line less or equally
-indented than items at top level.  It also ends before two blank
+A list ends whenever every item has ended, which means before any line less
+or equally indented than items at top level.  It also ends before two blank
 lines@footnote{See also @code{org-empty-line-terminates-plain-lists}.}.  In
 lines@footnote{See also @code{org-empty-line-terminates-plain-lists}.}.  In
-that case, all items are closed.  For finer control, you can end lists with
-any pattern set in @code{org-list-end-regexp}.  Here is an example:
+that case, all items are closed.  Here is an example:
 
 
 @example
 @example
 @group
 @group

+ 2 - 4
lisp/org-exp.el

@@ -1808,8 +1808,7 @@ These special cookies will later be interpreted by the backend."
 		  (top (point-at-bol))
 		  (top (point-at-bol))
 		  (top-ind (org-list-get-ind top struct)))
 		  (top-ind (org-list-get-ind top struct)))
 	     (goto-char bottom)
 	     (goto-char bottom)
-	     (when (and (not (eq org-list-ending-method 'indent))
-			(not (looking-at "[ \t]*$"))
+	     (when (and (not (looking-at "[ \t]*$"))
 			(looking-at org-list-end-re))
 			(looking-at org-list-end-re))
 	       (replace-match ""))
 	       (replace-match ""))
 	     (unless (bolp) (insert "\n"))
 	     (unless (bolp) (insert "\n"))
@@ -1867,8 +1866,7 @@ These special properties will later be interpreted by the backend."
 	      ;; useful to line processing exporters.
 	      ;; useful to line processing exporters.
 	      (goto-char bottom)
 	      (goto-char bottom)
 	      (when (or (looking-at "^ORG-LIST-END-MARKER\n")
 	      (when (or (looking-at "^ORG-LIST-END-MARKER\n")
-			(and (not (eq org-list-ending-method 'indent))
-			     (not (looking-at "[ \t]*$"))
+			(and (not (looking-at "[ \t]*$"))
 			     (looking-at org-list-end-re)))
 			     (looking-at org-list-end-re)))
 		(replace-match ""))
 		(replace-match ""))
 	      (unless (bolp) (insert "\n"))
 	      (unless (bolp) (insert "\n"))

+ 1 - 3
lisp/org-latex.el

@@ -2572,9 +2572,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
   "Convert plain text lists in current buffer into LaTeX lists."
   "Convert plain text lists in current buffer into LaTeX lists."
   ;; `org-list-end-re' output has changed since preprocess from
   ;; `org-list-end-re' output has changed since preprocess from
   ;; org-exp.el. Make sure it is taken into account.
   ;; org-exp.el. Make sure it is taken into account.
-  (let ((org-list-ending-method
-	 (if (eq org-list-ending-method 'regexp) 'regexp 'both))
-	(org-list-end-re "^ORG-LIST-END-MARKER\n"))
+  (let ((org-list-end-re "^ORG-LIST-END-MARKER\n"))
     (mapc
     (mapc
      (lambda (e)
      (lambda (e)
        ;; For each type of context allowed for list export (E), find
        ;; For each type of context allowed for list export (E), find

+ 17 - 66
lisp/org-list.el

@@ -229,42 +229,12 @@ spaces instead of one after the bullet in each item of the list."
 	  (const :tag "never" nil)
 	  (const :tag "never" nil)
 	  (regexp)))
 	  (regexp)))
 
 
-(defcustom org-list-ending-method 'both
-  "Determine where plain lists should end.
-Valid values are: `regexp', `indent' or `both'.
-
-When set to `regexp', Org will look into two variables,
-`org-empty-line-terminates-plain-lists' and the more general
-`org-list-end-regexp', to determine what will end lists.
-
-When set to `indent', a list will end whenever a line following
-an item, but not starting one, is less or equally indented than
-the first item of the list.
-
-When set to `both', each of the preceding methods is applied to
-determine lists endings.  This is the default method."
-  :group 'org-plain-lists
-  :type '(choice
-	  (const :tag "With a regexp defining ending" regexp)
-	  (const :tag "With indentation of regular (no bullet) text" indent)
-	  (const :tag "With both methods" both)))
-
 (defcustom org-empty-line-terminates-plain-lists nil
 (defcustom org-empty-line-terminates-plain-lists nil
   "Non-nil means an empty line ends all plain list levels.
   "Non-nil means an empty line ends all plain list levels.
-This variable only makes sense if `org-list-ending-method' is set
-to `regexp' or `both'.  This is then equivalent to set
-`org-list-end-regexp' to \"^[ \\t]*$\"."
+Otherwise, two of them will be necessary."
   :group 'org-plain-lists
   :group 'org-plain-lists
   :type 'boolean)
   :type 'boolean)
 
 
-(defcustom org-list-end-regexp "^[ \t]*\n[ \t]*\n"
-  "Regexp matching the end of all plain list levels.
-It must start with \"^\" and end with \"\\n\".  It defaults to 2
-blank lines. `org-empty-line-terminates-plain-lists' has
-precedence over it."
-  :group 'org-plain-lists
-  :type 'string)
-
 (defcustom org-list-automatic-rules '((bullet . t)
 (defcustom org-list-automatic-rules '((bullet . t)
 				      (checkbox . t)
 				      (checkbox . t)
 				      (indent . t))
 				      (indent . t))
@@ -381,9 +351,8 @@ specifically, type `block' is determined by the variable
 
 
 ;;; Predicates and regexps
 ;;; Predicates and regexps
 
 
-(defconst org-list-end-re (if org-empty-line-terminates-plain-lists
-			      "^[ \t]*\n"
-			    org-list-end-regexp)
+(defconst org-list-end-re (if org-empty-line-terminates-plain-lists "^[ \t]*\n"
+			    "^[ \t]*\n[ \t]*\n")
   "Regex corresponding to the end of a list.
   "Regex corresponding to the end of a list.
 It depends on `org-empty-line-terminates-plain-lists'.")
 It depends on `org-empty-line-terminates-plain-lists'.")
 
 
@@ -432,8 +401,7 @@ group 4: description tag")
   (not (org-in-block-p org-list-forbidden-blocks)))
   (not (org-in-block-p org-list-forbidden-blocks)))
 
 
 (defun org-in-item-p ()
 (defun org-in-item-p ()
-  "Return item beginning position when in a plain list, nil otherwise.
-This checks `org-list-ending-method'."
+  "Return item beginning position when in a plain list, nil otherwise."
   (save-excursion
   (save-excursion
     (beginning-of-line)
     (beginning-of-line)
     (let* ((case-fold-search t)
     (let* ((case-fold-search t)
@@ -460,8 +428,7 @@ This checks `org-list-ending-method'."
 	;; to compute its boundaries END-BOUNDS.  When point is
 	;; to compute its boundaries END-BOUNDS.  When point is
 	;; in-between, move cursor before regexp beginning.
 	;; in-between, move cursor before regexp beginning.
 	(let ((hl 0) (i -1) end-bounds)
 	(let ((hl 0) (i -1) end-bounds)
-	  (when (and (not (eq org-list-ending-method 'indent))
-		     (progn
+	  (when (and (progn
 		       (while (setq i (string-match
 		       (while (setq i (string-match
 				       "[\r\n]" org-list-end-re (1+ i)))
 				       "[\r\n]" org-list-end-re (1+ i)))
 			 (setq hl (1+ hl)))
 			 (setq hl (1+ hl)))
@@ -470,23 +437,18 @@ This checks `org-list-ending-method'."
 		     (< (point) (cdr end-bounds)))
 		     (< (point) (cdr end-bounds)))
 	    (goto-char (car end-bounds))
 	    (goto-char (car end-bounds))
 	    (forward-line -1)))
 	    (forward-line -1)))
-	;; Look for an item, less indented that reference line if
-	;; `org-list-ending-method' isn't `regexp'.
+	;; Look for an item, less indented that reference line.
 	(catch 'exit
 	(catch 'exit
 	  (while t
 	  (while t
 	    (let ((ind (org-get-indentation)))
 	    (let ((ind (org-get-indentation)))
 	      (cond
 	      (cond
 	       ;; This is exactly what we want.
 	       ;; This is exactly what we want.
-	       ((and (looking-at item-re)
-		     (or (< ind ind-ref)
-			 (eq org-list-ending-method 'regexp)))
+	       ((and (looking-at item-re) (< ind ind-ref))
 		(throw 'exit (point)))
 		(throw 'exit (point)))
 	       ;; At upper bound of search or looking at the end of a
 	       ;; At upper bound of search or looking at the end of a
 	       ;; previous list: search is over.
 	       ;; previous list: search is over.
 	       ((<= (point) lim-up) (throw 'exit nil))
 	       ((<= (point) lim-up) (throw 'exit nil))
-	       ((and (not (eq org-list-ending-method 'indent))
-		     (looking-at org-list-end-re))
-		(throw 'exit nil))
+	       ((looking-at org-list-end-re) (throw 'exit nil))
 	       ;; Skip blocks, drawers, inline-tasks, blank lines
 	       ;; Skip blocks, drawers, inline-tasks, blank lines
 	       ((and (looking-at "^[ \t]*#\\+end_")
 	       ((and (looking-at "^[ \t]*#\\+end_")
 		     (re-search-backward "^[ \t]*#\\+begin_" lim-up t)))
 		     (re-search-backward "^[ \t]*#\\+begin_" lim-up t)))
@@ -703,8 +665,7 @@ Assume point is at an item."
 		(forward-line -1))
 		(forward-line -1))
 	       ;; Looking at a list ending regexp.  Dismiss useless
 	       ;; Looking at a list ending regexp.  Dismiss useless
 	       ;; data recorded above BEG-CELL.  Jump to part 2.
 	       ;; data recorded above BEG-CELL.  Jump to part 2.
-	       ((and (not (eq org-list-ending-method 'indent))
-		     (looking-at org-list-end-re))
+	       ((looking-at org-list-end-re)
 		(throw 'exit
 		(throw 'exit
 		       (setq itm-lst
 		       (setq itm-lst
 			     (memq (assq (car beg-cell) itm-lst) itm-lst))))
 			     (memq (assq (car beg-cell) itm-lst) itm-lst))))
@@ -716,9 +677,7 @@ Assume point is at an item."
 	       ((looking-at item-re)
 	       ((looking-at item-re)
 		(push (funcall assoc-at-point ind) itm-lst)
 		(push (funcall assoc-at-point ind) itm-lst)
 		(push (cons ind (point)) end-lst)
 		(push (cons ind (point)) end-lst)
-		(when (or (and (eq org-list-ending-method 'regexp)
-			       (<= ind (cdr beg-cell)))
-			  (< ind text-min-ind))
+		(when (or (<= ind (cdr beg-cell)) (< ind text-min-ind))
 		  (setq beg-cell (cons (point) ind)))
 		  (setq beg-cell (cons (point) ind)))
 		(forward-line -1))
 		(forward-line -1))
 	       ;; Skip blocks, drawers, inline tasks, blank lines.
 	       ;; Skip blocks, drawers, inline tasks, blank lines.
@@ -732,14 +691,13 @@ Assume point is at an item."
 		(forward-line -1))
 		(forward-line -1))
 	       ((looking-at "^[ \t]*$")
 	       ((looking-at "^[ \t]*$")
 		(forward-line -1))
 		(forward-line -1))
-	       ;; From there, point is not at an item.  Unless ending
-	       ;; method is `regexp', interpret line's indentation:
+	       ;; From there, point is not at an item. Interpret
+	       ;; line's indentation:
 	       ;; - text at column 0 is necessarily out of any list.
 	       ;; - text at column 0 is necessarily out of any list.
 	       ;;   Dismiss data recorded above BEG-CELL.  Jump to
 	       ;;   Dismiss data recorded above BEG-CELL.  Jump to
 	       ;;   part 2.
 	       ;;   part 2.
 	       ;; - any other case may be an ending position for an
 	       ;; - any other case may be an ending position for an
 	       ;;   hypothetical item above.  Store it and proceed.
 	       ;;   hypothetical item above.  Store it and proceed.
-	       ((eq org-list-ending-method 'regexp) (forward-line -1))
 	       ((zerop ind)
 	       ((zerop ind)
 		(throw 'exit
 		(throw 'exit
 		       (setq itm-lst
 		       (setq itm-lst
@@ -771,8 +729,7 @@ Assume point is at an item."
 	       (next-single-property-change (point) 'org-example nil lim-down)))
 	       (next-single-property-change (point) 'org-example nil lim-down)))
 	     ;; Looking at a list ending regexp.  Save point as an
 	     ;; Looking at a list ending regexp.  Save point as an
 	     ;; ending position and jump to part 3.
 	     ;; ending position and jump to part 3.
-	     ((and (not (eq org-list-ending-method 'indent))
-		   (looking-at org-list-end-re))
+	     ((looking-at org-list-end-re)
 	      (throw 'exit (push (cons 0 (point)) end-lst-2)))
 	      (throw 'exit (push (cons 0 (point)) end-lst-2)))
 	     ((looking-at item-re)
 	     ((looking-at item-re)
 	      ;; Point is at an item.  Add data to ITM-LST-2. It may
 	      ;; Point is at an item.  Add data to ITM-LST-2. It may
@@ -788,16 +745,14 @@ Assume point is at an item."
 	     ;; Ind is lesser or equal than BEG-CELL's.  The list is
 	     ;; Ind is lesser or equal than BEG-CELL's.  The list is
 	     ;; over: store point as an ending position and jump to
 	     ;; over: store point as an ending position and jump to
 	     ;; part 3.
 	     ;; part 3.
-	     ((and (not (eq org-list-ending-method 'regexp))
-		   (<= ind (cdr beg-cell)))
+	     ((<= ind (cdr beg-cell))
 	      (throw 'exit
 	      (throw 'exit
 		     (push (cons 0 (funcall end-before-blank)) end-lst-2)))
 		     (push (cons 0 (funcall end-before-blank)) end-lst-2)))
 	     ;; Else, if ind is lesser or equal than previous item's,
 	     ;; Else, if ind is lesser or equal than previous item's,
 	     ;; this is an ending position: store it.  In any case,
 	     ;; this is an ending position: store it.  In any case,
 	     ;; skip block or drawer at point, and move to next line.
 	     ;; skip block or drawer at point, and move to next line.
 	     (t
 	     (t
-	      (when (and (not (eq org-list-ending-method 'regexp))
-			 (<= ind (nth 1 (car itm-lst-2))))
+	      (when (<= ind (nth 1 (car itm-lst-2)))
 		(push (cons ind (point)) end-lst-2))
 		(push (cons ind (point)) end-lst-2))
 	      (cond
 	      (cond
 	       ((and (looking-at "^[ \t]*#\\+begin_")
 	       ((and (looking-at "^[ \t]*#\\+begin_")
@@ -1192,9 +1147,7 @@ some heuristics to guess the result."
 				    (point))))))))
 				    (point))))))))
       (cond
       (cond
        ;; Trivial cases where there should be none.
        ;; Trivial cases where there should be none.
-       ((or (and (not (eq org-list-ending-method 'indent))
-		 org-empty-line-terminates-plain-lists)
-	    (not insert-blank-p)) 0)
+       ((or org-empty-line-terminates-plain-lists (not insert-blank-p)) 0)
        ;; When `org-blank-before-new-entry' says so, it is 1.
        ;; When `org-blank-before-new-entry' says so, it is 1.
        ((eq insert-blank-p t) 1)
        ((eq insert-blank-p t) 1)
        ;; `plain-list-item' is 'auto.  Count blank lines separating
        ;; `plain-list-item' is 'auto.  Count blank lines separating
@@ -2929,9 +2882,7 @@ Point is left at list end."
     (goto-char top)
     (goto-char top)
     (when delete
     (when delete
       (delete-region top bottom)
       (delete-region top bottom)
-      (when (and (not (eq org-list-ending-method 'indent))
-		 (not (looking-at "[ \t]*$"))
-		 (looking-at org-list-end-re))
+      (when (and (not (looking-at "[ \t]*$")) (looking-at org-list-end-re))
 	(replace-match "")))
 	(replace-match "")))
     out))
     out))