summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2011-03-19 07:42:13 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2011-03-19 07:42:13 +0100
commit622599ca07c9b5d0e2b63b8af1e3fbe6726b6784 (patch)
tree689f5e277fae3050b3230414399300dbdb3cfcad
parent3dd474575205d3808390fc6ea2d5feccdb3d4305 (diff)
downloadorg-mode-622599ca07c9b5d0e2b63b8af1e3fbe6726b6784.tar.gz
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.
-rw-r--r--lisp/org-table.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 458c95e..46c7970 100644
--- a/lisp/org-table.el
+++ b/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)))