Browse Source

org-table: Fix thinko

* lisp/org-table.el (org-table-line-to-dline): Do not assume dichotomy
  failed.

Reported-by: Lem Ming <ramboman777@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-09/msg00035.html>
Nicolas Goaziou 1 year ago
parent
commit
c475cc2886
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lisp/org-table.el

+ 5 - 2
lisp/org-table.el

@@ -1429,7 +1429,7 @@ non-nil, the one above is used."
     (cond ((or (> (aref org-table-dlines min) line)
 	       (< (aref org-table-dlines max) line))
 	   nil)
-	  ((= (aref org-table-dlines max) line) max)
+	  ((= line (aref org-table-dlines max)) max)
 	  (t (catch 'exit
 	       (while (> (- max min) 1)
 		 (let* ((mean (/ (+ max min) 2))
@@ -1437,7 +1437,10 @@ non-nil, the one above is used."
 		   (cond ((= v line) (throw 'exit mean))
 			 ((> v line) (setq max mean))
 			 (t (setq min mean)))))
-	       (if above min max))))))
+	       (cond ((= line (aref org-table-dlines max)) max)
+		     ((= line (aref org-table-dlines min)) min)
+		     (above min)
+		     (t max)))))))
 
 ;;;###autoload
 (defun org-table-delete-column ()