Skip to content

Fixed font-locking for def* with support of special chars #316

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

Merged
merged 1 commit into from
Aug 3, 2015
Merged

Fixed font-locking for def* with support of special chars #316

merged 1 commit into from
Aug 3, 2015

Conversation

BrunoBonacci
Copy link
Contributor

changed the regex to match "def" + anything until the first space " " (or blank),
this support font locking for things like defabc*, defyyy!, etc.

@@ -7,6 +7,10 @@
* [#302](https://github.com/clojure-emacs/clojure-mode/pull/302): Add new sexp navigation commands. `clojure-forward-logical-sexp` and `clojure-backward-logical-sexp` consider `^hints` and `#reader.macros` to be part of the sexp that follows them.
* [#303](https://github.com/clojure-emacs/clojure-mode/issues/303): Handle `boot` projects in `clojure-expected-ns`.

### Bugs fixed

* Fix font-locking for def with special chars such: `defn*`, `defspecial!`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such as

This sentence should end with with a ..

@bbatsov
Copy link
Member

bbatsov commented Aug 3, 2015

The commit message should say "Handle properly def* symbols, containing special chars" or something like it. We don't use past tense for commit message titles.

@@ -380,7 +380,7 @@ Called by `imenu--generic-function'."
(2 font-lock-type-face nil t))
;; Function definition (anything that starts with def and is not
;; listed above)
(,(concat "(\\(?:[a-z\.-]+/\\)?\\(def\[a-z\-\]*-?\\)"
(,(concat "(\\(?:[a-z\.-]+/\\)?\\(def[^ \r\n\t]*\\)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same as using [:space:]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really... I'm using ^ for exclusion.
So I'm saying take anything that starts with a def and it is followed by anything which is NOT a blank 0 or more times. So to be fair should be something like [^[:space:]].
Since different regex engines use different character classes ([:space:], [:blank:], [:s:], \s) I wasn't sure about the correct one for elisp and I took reference from line 387 and 389 (just below) where the expanded form it is used.

bbatsov added a commit that referenced this pull request Aug 3, 2015
Fixed font-locking for def* with support of special chars
@bbatsov bbatsov merged commit 031f280 into clojure-emacs:master Aug 3, 2015
@bbatsov
Copy link
Member

bbatsov commented Aug 3, 2015

👍 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