Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

* Fix `clojure-align` when called from `clojure-ts-mode` major mode buffers.
* [#671](https://github.com/clojure-emacs/clojure-mode/issues/671): Syntax highlighting for digits after the first in `%` args. (e.g. `%10`)
- [#680](https://github.com/clojure-emacs/clojure-mode/issues/680): Change syntax class of ASCII control characters to punctuation, fixing situations where carriage returns were being interpreted as symbols

# Changes

Expand Down
4 changes: 3 additions & 1 deletion clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ The prefixes are used to generate the correct namespace."
(defvar clojure-mode-syntax-table
(let ((table (make-syntax-table)))
;; Initialize ASCII charset as symbol syntax
(modify-syntax-entry '(0 . 127) "_" table)
;; Control characters from 0-31 default to the punctuation syntax class
(modify-syntax-entry '(32 . 127) "_" table)

;; Word syntax
(modify-syntax-entry '(?0 . ?9) "w" table)
Expand All @@ -385,6 +386,7 @@ The prefixes are used to generate the correct namespace."
(modify-syntax-entry ?\xa0 " " table) ; non-breaking space
(modify-syntax-entry ?\t " " table)
(modify-syntax-entry ?\f " " table)
(modify-syntax-entry ?\r " " table)
;; Setting commas as whitespace makes functions like `delete-trailing-whitespace' behave unexpectedly (#561)
(modify-syntax-entry ?, "." table)

Expand Down
5 changes: 5 additions & 0 deletions test/clojure-mode-util-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@
(with-clojure-buffer "(ns)(ns foo)"
(expect (clojure-find-ns) :to-equal "foo"))
(with-clojure-buffer "(ns )(ns foo)"
(expect (clojure-find-ns) :to-equal "foo")))
(it "should ignore carriage returns"
(with-clojure-buffer "(ns \r\n foo)"
(expect (clojure-find-ns) :to-equal "foo"))
(with-clojure-buffer "(ns\r\n ^{:doc \"meta\r\n\"}\r\n foo\r\n)"
(expect (clojure-find-ns) :to-equal "foo"))))

(describe "clojure-sort-ns"
Expand Down