Questions tagged [syntax-highlighting]

is the feature of displaying text, especially source code, in different colors and fonts according to the meaning of different terms.

Filter by
Sorted by
Tagged with
4
votes
2answers
972 views

How do I turn off syntax coloring for lines that exceed the word-limit in prelude?

I'm using Prelude v 1.0.0. I want to turn off the syntax coloring when my lines exceed a certain word-limit. I don't know where that setting is set. Thanks! EDIT: I should be more precise. Prelude, ...
4
votes
1answer
588 views

How to highlight “constexpr” in cc-mode?

Question Pretty straightforward: How to highlight constexpr in cc-mode (editing C++ code)? Example If I use const as in the following example const double = 3.14 const gets highlighted as a ...
3
votes
2answers
174 views

How do I turn off highlighting for $…$ in tex-mode

I like to use highlighting when working with emacs. But I don't like some of the default settings. I recently installed emacs 24.4 on my iMac. I really don't like all the highlighting of math ...
1
vote
2answers
229 views

How can I change the color of a \enquote quotation inside Emacs?

When I paste a text inside quotation marks into Emacs+AUCTeX, AUCTeX formats it with a soft red color (see the screenshot below at the first line). I like this color. However, I'm using csquotes ...
3
votes
0answers
983 views

How to make the custom font lock keywords not override the default major mode font lock?

Following my previous question on making custom highlight rules here: Color-code a new generic character combination , I have stumbled on a new issue, that possibly merits another question. I have a ...
4
votes
2answers
612 views

Color-code a new generic character combination

I'm new to Emacs and Org-mode, this is a very basic question. Unfortunately the keywords are too common for me to find the answer. I would like to create a custom pattern to colour my writing input. ...
2
votes
1answer
102 views

ESS Syntax Highlighting for Negative Numbers?

I know how to set coloring for an interactive R session in ESS + Emacs for all numbers. Is there a way to drill down further and set different colors for negative numbers?
9
votes
2answers
4k views

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 ...
3
votes
4answers
699 views

How can I stop emacs from highlighting whitespace?

After a recent update, my Perl files are rendered like this: Note that trailing spaces are shown in red and empty lines in yellow. This is happening despite my having the following in my ~/.emacs: (...
3
votes
1answer
196 views

How do I highlight certain words between double quotes with font-lock?

I'm trying to add additional colors to json-mode for when I edit json-schema. I can get it working fine without searching for double quotes, but I need to for some highlighting. I've tried quite a ...
1
vote
1answer
527 views

Haxe-mode broken in Emacs 24.4

Installing Emacs 24.4 broke my haxe mode. The mode for the HaXe language doesn't seem to be maintained any more so I'm trying to fix it myself. Firstly, I had a cl-macroexpand-all problem which ...
1
vote
0answers
796 views

syntax highlighting and auto-completion for CSS?

How can I set up css-mode for syntax highlighting and autocompletion? I installed web-mode, but it doesn't seem to be giving me any of those features.
12
votes
1answer
1k views

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 ...
5
votes
3answers
448 views

Saving and restoring highlighting patterns

I have some log files that I spend a lot of time reading, and I find myself doing the same series of commands to get useful highlighting each time I open a new log. Typically some combination of M-x ...
5
votes
2answers
162 views

How do I handle multiple string delimeters in a major mode?

I'm trying to write a major mode for a language that supports normal strings and triple-quoted strings ("foo" and """foo"""). (defconst my-string-mode-syntax-table (let ((table (make-syntax-table)))...
11
votes
1answer
2k views

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-...
8
votes
2answers
462 views

How can I nest one syntax table in another?

I've written a simple mode for handling JSON. It uses the derived machinery to re-use most of json-mode's code. However one addition is you can insert elisp into the JSON text which is evaluated at ...
10
votes
2answers
359 views

Why don't major modes just inspect the faces?

When writing a major mode, it's often useful to know 'is point in a string?' 'is point in a comment?'. Most major modes seem to attempt to parse the programming language. For example: python-syntax-...
15
votes
1answer
2k views

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 ...
2
votes
1answer
276 views

Flycheck and OpenMP pragmas for GCC

I'm using Flycheck with GCC as my checker for C. However, Flycheck gives warnings on OpenMP pragmas, regardless of whether they're correct or not! Is there any setting I can change to turn off these ...
7
votes
1answer
371 views

How can I prevent python-mode from occasionally highlighting everything as string

I use python-mode for my Python code, and every once in a while the syntax highlighter gets confused and thinks everything in the buffer is a string literal. This typically seems to happen when I ...
7
votes
1answer
694 views

Change syntax highlighting without changing major mode?

I want to start a python-shell M-x python-shell. If I'm not happy with the syntax highlighting, is it possible to improve it (put more colors in the buffer) without changing major mode? In vim this ...
6
votes
1answer
374 views

Applying major-mode font locking to exported org-babel snippets

Currently I have a bunch of code snippets in my Org-based presentation. I'm exporting them with ox-reveal, but the exported code doesn't have any syntax highlighting. Is there any way to: have syntax ...
12
votes
2answers
500 views

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, ...
4
votes
1answer
718 views

Why do sql-mode and sql-interactive-mode not highlight strings the same way?

Here is a screenshot showing the difference between sql-interactive-mode (top) and sql-mode (bottom). Why does the string not get highlighted properly in sql-interactive-mode? (Note - this also ...
8
votes
1answer
279 views

How do I create a simple syntax table for a major mode?

I'm trying to understand how syntax tables work, but my minimal major mode doesn't highlight anything. I've written the following elisp, which is just supposed to highlight comments: (defconst my-...

1 2 3 4