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

is it possible to add more font faces (like for variable definitions, modules, and function parameters)? #137

Closed
smabie opened this issue Jul 22, 2020 · 5 comments

Comments

@smabie
Copy link

smabie commented Jul 22, 2020

Compare the OCaml highlighting with the Julia highlighting.

screen

Would it be possible to maybe add more color to the julia one? I think the OCaml highlighting strikes a great balance of color without being too busy. I find the Julia highlighting to be too minimal and hard to read.

What do you guys thinks?

@non-Jedi
Copy link
Contributor

non-Jedi commented Jul 22, 2020

See #2 for variable definition highlighting (it's more difficult than it sounds, but help is welcome). We could certainly fontify "MyModule" in module MyModule with font-lock-type-face or font-lock-variable-name-face, but I don't think that would make things much more colorful.

Looking at your screenshots, the bigger difference to me is that Ocaml uses a lot more keywords, so there are more things to highlight. Julia's syntax is slightly more minimal in a lot of usage (probably not actually more minimal as far as total syntax available), and it tends to use symbols for syntax more often instead of keywords.

@non-Jedi
Copy link
Contributor

I'll also note that you appear to be using an older version of julia-mode, and several improvements have landed since the version you're using. I can tell because the current version does less fontification and doesn't highlight Symbol (d8cd4bd).

@smabie
Copy link
Author

smabie commented Jul 22, 2020

Ah ok, maybe I'll take a crack at something simple, like font-locking the token before an '=' sign. I'm using 2020-07-17.1915 version, that should be recent enough, right?

Also another easy one would be to color any capitalized word. This would color modules, like DataFrames.rename, the DataFrames part would be colored, and also object constructors.

@non-Jedi
Copy link
Contributor

non-Jedi commented Jul 22, 2020

I'm using 2020-07-17.1915 version, that should be recent enough, right?

Yep. Not sure why Symbol is getting font-locked in your screenshot then. Maybe a different package.

Ah ok, maybe I'll take a crack at something simple, like font-locking the token before an '=' sign.

Make sure you don't font-lock named-tuple fields then. And make sure you don't make font-locking uglier for multiple assignment by only highlighting one of the variables being assigned to.

Also another easy one would be to color any capitalized word. This would color modules, like DataFrames.rename, the DataFrames part would be colored, and also object constructors.

I strongly disagree with font-locking based on a convention like the fact that UpperCamelCase indicates a type. Font-locking should only be based on the syntax/semantics of the language.

@tpapp
Copy link
Collaborator

tpapp commented Jul 23, 2020

I agree with @non-Jedi about the above. Specifically, one usually has a single module per buffer (or at most a few submodules), and it is usually at the top, so highlighting it may not be necessary. I also don't think that we should highlight based on anything else than syntax.

Generally I find font locking in this package more or less sufficient, given Julia's relatively lightweight syntax. #2 may be desirable, but it is not a low-hanging fruit.

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

No branches or pull requests

3 participants