branch: scratch/editorconfig-cc commit 92519a8c255cfd7d2b730842c7cb00304f992735 Author: Hong Xu <h...@topbug.net> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Don't set indent size if the given value makes no sense. --- editorconfig.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/editorconfig.el b/editorconfig.el index d7266c39e6..652f9eb173 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -46,7 +46,14 @@ (defvar edconf-exec-path "editorconfig") +(defun edconf-string-integer-p (string) + "Whether a string representing integer" + (string-match-p "\\`[0-9]+\\'" string)) + (defun edconf-set-indentation (style &optional size tab_width) + (if (and (edconf-string-integer-p size) (not (equal size "tab"))) + (setq size (string-to-number size)) + (setq size nil)) (setq web-mode-indent-style 2) LaTeX-indent-level size LaTeX-item-indent size @@ -67,7 +74,7 @@ (defun edconf-set-line-length (length) "set the max line length (fill-column)" - (if length + (when (edconf-string-integer-p length) (set-fill-column (string-to-number length)))) (defun edconf-get-properties ()