Просмотр исходного кода

Avoid infinite loop when converting a table with prefix arg 0

* lisp/org-table.el (org-table-convert-region): Throw error when SEPARATOR
is smaller than 1.
Carsten Dominik 14 лет назад
Родитель
Сommit
622599ca07
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      lisp/org-table.el

+ 3 - 1
lisp/org-table.el

@@ -492,7 +492,9 @@ nil      When nil, the command tries to be smart and figure out the
 		((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?")
 		((equal separator '(16)) "^\\|\t")
 		((integerp separator)
-		 (format "^ *\\| *\t *\\| \\{%d,\\}" separator))
+		 (if (< separator 1)
+		     (error "Number of spaces in separator must be >= 1")
+		   (format "^ *\\| *\t *\\| \\{%d,\\}" separator)))
 		(t (error "This should not happen"))))
       (while (re-search-forward re end t)
 	(replace-match "| " t t)))