ソースを参照

org-table: Fix freeze with invalid hline reference

* lisp/org-table.el (org-table-find-row-type): Don't end up on the
  last hline, which doesn't exist, per
  e793158bc8492752745170e20839ddbb613fcb63.

Reported-by: Artis Rozentāls <artis.rozentals@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/93654>
Nicolas Goaziou 10 年 前
コミット
44744bba2c
1 ファイル変更7 行追加4 行削除
  1. 7 4
      lisp/org-table.el

+ 7 - 4
lisp/org-table.el

@@ -3017,10 +3017,13 @@ and TABLE is a vector with line types."
 			  nil))
 		    t)))
       (setq n (1- n)))
-    (if (or (< i 0) (>= i l))
-	(user-error "Row descriptor %s used in line %d leads outside table"
-	       desc cline)
-      i)))
+    (cond ((or (< i 0) (>= i l))
+	   (user-error "Row descriptor %s used in line %d leads outside table"
+		       desc cline))
+	  ;; The last hline doesn't exist.  Instead, point to last row
+	  ;; in table.
+	  ((= i (1- l)) (1- i))
+	  (t i))))
 
 (defun org-table--error-on-old-row-references (s)
   (when (string-match "&[-+0-9I]" s)