Emacs Asked on September 2, 2021
As a theme I am using Dracula.
For example I have this example code piece coloring:
When cursor is on terminate()
and I typed M-x customize-face
it is linked to (default ‘all faces’)
. I am not sure which variable’s color should I change.
This is example coloring in the SublimeText
where functions such as: terminate
, is_internet_on
, error
, session_start_msg
has a different color rather than white. I was wondering is it possible to achive this in emacs
as well?
I know one interesting solution, emacs-tree-sitter which is the Emacs implementation of the general parser tree-sitter used in Atom.
It's quite easy to use and work out of the box, this is how it look the function with the modus-vivendi theme:
As tree-sitter inherit from the font-lock default variables (define by the Dracula theme) for Emacs basic, stuff like the function name (in this case tools), is enough to call customize-face and then font-lock-function-name-face. BUT if you want to change more specific face colour (method,function call) those are define by tree-sitter, there is two main ways to achieve this, with the built in Emacs font customization, or setting the variables manually The first way:
Get the function at point (where the cursor is) with face-at-point - Call customize-face with the face name (keep in mind that it may scape some characters like the dot), and change the colours clicking in Show all attributes.
Same as the first one - Use the function face-spec-set for every face you want to change, in this case, the method call face:
(face-spec-set 'tree-sitter-hl-face:method.call '((t (:inherit tree-sitter-hl-face:function.call :foreground "red"))))
In this case, I put the face in red color.
For more information, emacs-tree-sitter documentation
Correct answer by f-sasa on September 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP