Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow normal whitespace when reading EditorConfig settings file #162

Merged
merged 2 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions editorconfig-core-handle.el
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ This function is a fnmatch with a few modification for EditorConfig usage."
pattern))))

(defsubst editorconfig-core-handle--string-trim (str)
"Remove leading and trailing whitespace from STR."
(replace-regexp-in-string "[ \t\n\r]+\\'"
"Remove leading and trailing whitespaces from STR."
(replace-regexp-in-string "[[:space:]]+\\'"
""
(replace-regexp-in-string "\\`[ \t\n\r]+"
(replace-regexp-in-string "\\`[[:space:]]+"
""
str)))

Expand Down
6 changes: 6 additions & 0 deletions ert-tests/editorconfig-core-handle.el
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@
(concat fixtures
"a.js"))
'((("key" . "value"))))))

;; For checking various normal whitespace (line breaks, horizontal space, vertical space, etc.)
(let* ((conf (concat default-directory
"ert-tests/whitespaces/example-editorconfig.txt"))
(handle (editorconfig-core-handle conf)))
(should (editorconfig-core-handle-p handle)))
)
12 changes: 12 additions & 0 deletions ert-tests/whitespaces/example-editorconfig.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]

# Text encoding name.
charset = utf-8

# Page Break


# Remove trailing whitespace on lines?
trim_trailing_whitespace = true