Skip to content

Fix character font lock - #588

Merged
bbatsov merged 1 commit into
clojure-emacs:masterfrom
rvlo:fix-character-font-lock
May 4, 2021
Merged

Fix character font lock#588
bbatsov merged 1 commit into
clojure-emacs:masterfrom
rvlo:fix-character-font-lock

Conversation

@rvlo

@rvlo rvlo commented Mar 22, 2021

Copy link
Copy Markdown
Contributor

Characters escaped weren't being formatted correctly, as shown by the submitted test.

Example of code that wasn't being formatted:
["text" \, "other"]
(str \[ "inside" \])


Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):

  • The commits are consistent with our contribution guidelines.
  • You've added tests (if possible) to cover your change(s). Bugfix, indentation, and font-lock tests are extremely important!
  • You've run M-x checkdoc and fixed any warnings in the code you've written.
  • You've updated the changelog (if adding/changing user-visible functionality).
  • You've updated the readme (if adding/changing user-visible functionality).

Thanks!

@rvlo

rvlo commented Mar 24, 2021

Copy link
Copy Markdown
Contributor Author

I also propose moving the lambda arguments regex below character literals, for handling \% correctly. Would there be any problems in doing so?

@bbatsov

bbatsov commented May 2, 2021

Copy link
Copy Markdown
Member

You'll have to check this. The font-locking logic is quite brittle.

The changes you proposed look reasonable. Please, mention the fix in the changelog.

When inside a vector or before white space, some escaped characters,
like comma, square and curly brackets, weren't being formatted.

* Added tests.
* Added examples in test.clj for visual inspection.
@rvlo
rvlo force-pushed the fix-character-font-lock branch from 7274062 to f0eee5a Compare May 4, 2021 13:23
@rvlo

rvlo commented May 4, 2021

Copy link
Copy Markdown
Contributor Author

I added a test for the % character literal, moved the lambda arguments below character literals, added an entry to the changelog, rebased on master and squashed the commits.

@bbatsov
bbatsov merged commit e440080 into clojure-emacs:master May 4, 2021
@bbatsov

bbatsov commented May 4, 2021

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants