From 44744bba2c86f0b90fa08305479d6cbd0d8ef21e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 30 Dec 2014 22:37:44 +0100 Subject: [PATCH] org-table: Fix freeze with invalid hline reference MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * 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 --- lisp/org-table.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 6b33edaf4..a2019a52f 100644 --- a/lisp/org-table.el +++ b/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) -- 2.11.4.GIT