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

Fix syntax-table class of carriage returns #680

Merged
merged 2 commits into from
May 16, 2024
Merged
Changes from 1 commit
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
Next Next commit
Fix syntax-table class of carriage returns
The syntax table interprets ASCII control chars (including CRs) as
symbols in clojure buffers, affecting functions such as
(thing-at-point 'symbol)
This caused clojure-find-ns to report "^M" as the namespace in some
files with \r\n line encodings.
yuhan0 committed May 15, 2024
commit d2d8cfef8de442f095235f75b555e063dc5d6d85
4 changes: 3 additions & 1 deletion clojure-mode.el
Original file line number Diff line number Diff line change
@@ -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)
@@ -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)