is the feature of displaying text, especially source code, in different colors and fonts according to the meaning of different terms.
Questions tagged [syntax-highlighting]
237 questions
29
votes
3 answers
Extending org-mode with more markups
I want to add a markup and formatting for such markup, i.e. ... with a box surrounds such markup. I also want the mark up to be compatible with (setq org-hide-emphasis-markers t). That is, when the variable is set to t, the and…

Tu Do
- 6,772
- 20
- 39
16
votes
2 answers
Can I turn off or switch the syntax checker for js2-mode?
I have a default setup of js2-mode. This provides nice syntax highlighting and checking but I am now working on a project with a different set of styles (specifically this new project does not use semicolons).
This causes every single line of code…

Startec
- 1,354
- 1
- 13
- 30
16
votes
1 answer
Github-flavored markdown mode: syntax highlight code blocks
For example, if I have a markdown file with the following:
###This is my markdown file
here is some text.
here is my code block:
``` js
var accountdown = require('accountdown');
var level = require('level');
var db = level('/tmp/users.db');
var…

modulitos
- 2,432
- 1
- 18
- 36
15
votes
1 answer
Export code blocks in org-mode with minted environment
After inspecting the LaTeX generated for my org-mode file, I figured out that the code blocks are exported with the verbatim environment. Are there any way to tell org-mode to export code blocks using the minted environment for the appropriated…

Jeff
- 537
- 4
- 13
15
votes
1 answer
syntax highlighting in source blocks
I thought that org-mode highlighted source blocks with the relevant mode. So for example:
#+BEGIN_SRC clojure
(defn plus [a b]
(+ a b))
#+END_SRC
This would show up with the syntax highlighting one would expect if in a Clojure buffer.
For some…

Alex Baranosky
- 1,069
- 1
- 8
- 17
12
votes
2 answers
For what languages is `syntax-ppss` appropriate?
I've been looking at a way of detecting whether point is on a comment by looking at how the current buffer is fontified.
Smartparens defines sp-point-in-comment, which relies on syntax-ppss. However, it seems that syntax-ppss and parse-partial-sexp…

Wilfred Hughes
- 6,890
- 2
- 29
- 59
12
votes
1 answer
How to get rainbow-delimiters/rainbow-blocks to highlight in-line math in LaTeX equations
I'm using spacemacs with AUCTeX for LaTeX editing and would like to make rainbow-delimiters and/or rainbow-blocks highlight LaTeX math equations. Unfortunately this only works partly, i.e., some equations get highlighted and some don't:
In the…

nemesit
- 291
- 1
- 5
12
votes
2 answers
How to get semantic syntax highlighting on emacs for C/C++ code
I'm new to emacs and programming in general so please bear with me. I'm trying to use emacs as my C/C++ IDE, and I noticed that in CC mode the variables/functions seemed to be highlighted only during declaration. My question is
Is it possible to…

DJ lee
- 131
- 1
- 4
11
votes
2 answers
The syntax highlight and indentation of source code block in exported html file for org-mode
When I insert C code block inside an org-mode file, the syntax highlight and indentation of the source code are customized as I wanted.
When I export it into a html file, the syntax highlight in the html file is exactly the same as in Emacs. But…

CodyChan
- 2,599
- 1
- 19
- 33
11
votes
1 answer
How do I specify a custom face with font-lock-defaults?
If I define font lock keywords using existing faces, I can highlight the string 'foo'.
(defconst my-mode-font-lock-keywords
(list
(cons "foo" 'font-lock-type-face)))
(define-derived-mode my-mode fundamental-mode "My mode"
"A demo mode."
…

Wilfred Hughes
- 6,890
- 2
- 29
- 59
11
votes
1 answer
Fontify broken links in org-mode
If I create a bad [[file:link]] or an internal [[Link]] that does not exist, I would like to org-mode to fontify this using org-warning face. How can I get this done?
Thanks,

Adam
- 1,857
- 11
- 32
11
votes
1 answer
Exporting highlighted source code to pdf in Org-Mode
I'm trying to export some python code with syntax highlighted to a pdf, from org-mode. Even though I can export to html without any issues I could not find a way to export it to pdf.
n.b. I'm using spacemacs but also tried without success with…

user13328
- 111
- 1
- 3
11
votes
3 answers
hl-line-mode hide background, how to avoid this?
With:
(when window-system
(set-face-background 'hl-line "light yellow")
(global-hl-line-mode 1))
current line highlighted by yellow background, but if text has background properties it also overwritten (like diff-mode, rainbow-mode).
Is it…

gavenkoa
- 3,352
- 19
- 36
10
votes
1 answer
How to highlight in different colors for variables inside `fstring` on python-mode
I am using python-mode which colors the parameters.
When I concatinate strings the variable color is represented as different:
On the other hand, if I use fstring, the variable is not represented as different color:
Please note that, if I enter…

alper
- 1,238
- 11
- 30
10
votes
3 answers
How to syntax highlight Python f-strings so {...} uses regular code colors?
Update, Emacs 28 supports f-stings
Python 3.6 supports F strings, eg:
So:
print(f'Test {} me!'.format(2 + 2))
Can be written as:
print(f'Test {2 + 2} me!')
Which print's Test 4 me, Is there a way to adjust emacs syntax highlighting so the text…

ideasman42
- 8,375
- 1
- 28
- 105