clojure-emacs / clojure-emacs/clojure-mode

All top-level def forms should have consistent font-lock

Open
#578 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
1k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Some thoughts on syntax highlighting.

```
(def foo 42) ; font-lock-variable-name-face
(defn bar [x] x) ; font-lock-function-name-face
```

I think variable-name-face should be used for foo in `(let [foo 42] ...)`, but not for foo in `(def foo 42)`. Top-level definitions should use the same face, whether its a function or a 'variable'. It seems more logical, since if I want to make both "foo" and "bar" use the same bold and highly visible face (since both are top-level defs), then e.g. in my c code I get local variables and function arguments highlighted with the same face.

I guess the correct hierarchy would be: top-level-definition-face -> (function-face, var-face[1]). It would be nice to have a separate space for def-like keywords as well (so a user could highlight "defn", but not "do" or "let").

[1]: technically defn also creates a var; what's the best short name for a top-level definition that is not a function? Do we actually need/want this distinction at all? I don't really see how it's useful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.