We’re rewarding the question askers & reputations are being recalculated! Read more.

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
0
votes
1answer
101 views

How to auto highlight buffer or region in web-mode?

I'm using web-mode 13.1.25, but was until today on 12.x with the same issue. It seems I need to continually choose Highlight buffer (C-c C-h) as otherwise, certain functions misbehave. These steps ...
10
votes
1answer
277 views

Highlighting upcoming dates in org mode agenda

I have entries in my org file similar to: * Birthdays :PROPERTIES: :CATEGORY: birthday :END: %%(org-anniversary 1981 1 2) Harry (%d) What I would like is for these to appear in the agenda (say) 2 ...
1
vote
0answers
155 views

Dynamic background colour for code blocks

Years ago I saw a feature in XCode where nested code blocks (delimited by {}) containing my cursor had graded background shades, with the lightest at my cursor, and the darkest at the outer level. .e....
1
vote
2answers
285 views

Adding a command to latex-match-warning-keywords for tex-mode

I want the commands \largerpage and \addlines to be displayed in red (font-latex-match-warning-keywords) but cannot figure out how to do this. I found several posts, but non of this seems to work. ...
5
votes
1answer
207 views

Syntax highlight narrowed python string literals as code

I have some python code, that has some long string literals containing more python code. These strings should most of the time be uniformly colored, as happens by default. However, I would like to be ...
10
votes
2answers
447 views

How to add complex syntax highlighting in a minor mode?

I'd like to highlight code with various faces in a minor mode. Here's a screenshot that's close to what I want: One thing that I'm missing is having the comment chars # in font-lock-comment-face. ...
6
votes
1answer
527 views

Line highlighting canceling out syntax highlighting

I use hl-line-mode and I really like the built-in misterioso theme. However, the way that lines are highlighted with this theme cancels out syntax highlighting or any other properties of the ...
1
vote
1answer
173 views

syntax-highlighting strings incorrectly for strings in opascal-mode

I write my projects in FreePascal and use opascal-mode to write it. I'm having a problem that this mode thinks that '\' is not a complete string, and hence all code after it is highlighted as a string....
1
vote
1answer
182 views

setting comment face in major mode on multi-line word-delimited comments

I am working on a major mode for an input file format I am interested in and want to set multi-line comments with the delimiters skip and noskip like skip larb noskip or skip GRID TYPE ...
2
votes
1answer
134 views

zsh expansion modifiers are treated as comments

zsh has a ton of syntax. In particular, the # character serves a bunch of different roles. Here are two that are problematic: Prefix globbing flags (#b)(*).c This finds all files that end in .c and ...
1
vote
1answer
663 views

Highlighting YAML comments correctly

See https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg01046.html for more background. YAML defines a comment as a # either preceded by the beginning of the line or whitespace (more ...
5
votes
2answers
234 views

Highlight as Comment if character is not present

I am writing a simple syntax highlighting mode for a special file type. In the syntax, a line is only valid if it starts with a & character, otherwise it is treated as a comment (basically it is ...
1
vote
1answer
87 views

Sub-word formatting in org-mode [duplicate]

I'm writing an org-mode document where I want to mark up only part of a single word; for example, I might want something like these examples, which were generated by the Markdown some*thing* like ...
7
votes
1answer
1k views

How to highlight specific keywords inside strings/quotes?

I have another syntax highlighting for SQL keywords inside strings (inside quotes) in VIM. It looks like this: Then in Emacs with PHP-mode, everything between quotes (') will be considered as a ...
1
vote
1answer
85 views

How can I highlight different keywords according to a suffix?

I want to highlight foo in foo:: without highlighting foo::<bar>, using font-lock-keywords. This is the result I want: Initially I tried this: (defvar example-font-lock-keywords `((,(rx (...
5
votes
1answer
448 views

LaTeX Mode and Listings with $-signs?

I am using LaTeX-Mode and need to include some listings which contain dollar-signs: \begin{lstlisting}[caption=Meteor Server: Bereitstellen einer entfernten Prozedur,label=lst:meteor-server-publish-...
4
votes
0answers
54 views

Help with advanced syntax rules

How can I express syntax rules like "[0-9/.:*+!_'?-] are valid symbol constituent, but not as the first char"? Or "/ is a valid symbol constituent, but can only appear once and in the middle of a ...
0
votes
2answers
121 views

Disabling strange emacs comment highlighting

I have started programming scheme, and I noticed the scheme minor mode highlights comments in the most obnoxious way possible when using solarized dark (color-theme-solarized). This also occurs on ...
8
votes
1answer
1k views

Which mode to use for ECMAScript 6?

Is there a mode out there that has syntax higlighting (and possibly more, but this is the least I want) for a more recent ecmascript? I'm especially interested in one that has support for template ...
4
votes
0answers
62 views

Paired string delimiters?

Red and Rebol have multiline strings that start with { and end with }. Reading through Elisp docs I don't see any simple way to define this in the syntax table. The string quotes class matches the ...
1
vote
1answer
2k views

Emacs Live Syntax/Error Highlighting

How do I make Emacs give me live feedback on my syntax? Like, after I finish typing a line of code, how can I make it so that Emacs tells me if that line isn't using correct syntax? For example, in ...
1
vote
1answer
41 views

How can a mode be prevented from changing syntax coloring?

The theme I'm using on emacs (zenburn) makes JDEE custom syntax coloring very hard to read. I'd like JDEE to obey the color theme I've already chosen. Is there a simple way to prevent a mode from ...
2
votes
2answers
4k views

Better syntax-higlighting for member variables and function calls in cpp-mode

In atom, C++ files are well colored unlike emacs cpp-mode. Emacs does not highlight references to member variables, function calls or member functions. They all are uncolored. The left is from emacs ...
1
vote
0answers
43 views

web-mode sql detection doesn't activate syntax highlighting

we edit freemarker template engine files with web-mode. The files also contain a lot of SQL. I added (defun my-web-mode-hook () "Hooks for Web mode." (setq web-mode-enable-sql-detection t)...
11
votes
2answers
4k views

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

Syntax highlighting fails on clone-indirect-buffer-other-window

I normally use indirect buffers while I edit python code in python-mode, I create them by running clone-indirect-buffer-other-window. While the syntax highlighting of the main buffer looks just fine, ...
0
votes
1answer
723 views

Something not right with this Flycheck checker - unclear why

I just wrote the following checker for syntax-checking Vala code using valac: (flycheck-def-option-var flycheck-vala-packages nil vala-valac "A list of additional pakages for valac. The value of ...
5
votes
2answers
413 views

Emacs interface to a pastebin site that supports org-mode-style syntax highlighting?

I've been using emacs-pastebin but all my pastebins wind up as plain text. Is there a way to set emacs-pastebin so that pastebins are set to LISP format by default? Better yet, is there a pastebin ...
2
votes
0answers
444 views

No numpy, scipy, sympy and matplotlib minor-modes?

Python scientific libs are immensily popular for the last decade or so. However googling and "melping" for its emacs minor-modes reveals nothing. Basically I need just syntax highlighting. Do you ...
3
votes
2answers
403 views

highlight-chars permanently

I am trying to highlight particular chars for use in C++ in emacs. I have found the package highlight-chars works very easily. I can use hc-highlight-chars command, it then prompts me for a set of ...
9
votes
2answers
207 views

What is a string fence or comment fence?

The docstring for modify-syntax-entry says the following: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) ... The first character of NEWENTRY should be one of the following: ... / ...
7
votes
1answer
285 views

Why does inserting a newline break highlighting with syntax-propertize-function?

I'm trying to write a major-mode that highlights triple-quoted strings. Here's a minimal reproducible example: (defconst demo-triple-quoted-string-regex (rx "\"\"\"" ;; After the delimiter, ...
1
vote
1answer
95 views

perl syntax highlighting disactivated

I'm using emacs for perl scripting and for some unknown reason the syntax highlighting is inactivated when opening new or existing scripts. I'm wondering if I press a key unknowingly that ...
5
votes
1answer
1k views

Web mode HTML tag highlighting

First off, a picture of what I see, editing a handlebars file: My colour theme is base16-grayscale, so that blue is probably hard coded somewhere. I asked on the web-mode mailing list, but was told ...
7
votes
1answer
1k views

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('...
1
vote
1answer
85 views

How do I change the background highlight color for a selection I marked with C-Spacebar?

I think that question explains it all. I tried changing highlight face but nothing happened.
26
votes
2answers
2k views

Extending org-mode with more markups

I want to add a markup and formatting for such markup, i.e. <kbd>...</kbd> with a box surrounds such markup. I also want the mark up to be compatible with (setq org-hide-emphasis-markers t)...
0
votes
1answer
494 views

Enable highlighting symbols in prog-mode

I am trying to configure highlight-symbol mode with use-package for only programming modes. This is what I have: (use-package highlight-symbol :ensure t :init (add-hook 'prog-mode-hook ...
3
votes
1answer
115 views

How do I select a region that has been syntax highlighted?

In a buffer with source code that has already been syntax highlighted (eg some Python code in python-mode), how do I access the results of the syntax parsing to select text from elisp that is a ...
4
votes
2answers
554 views

Three-characters comment syntax

Emacs supports syntax flags for 1- and 2-characters comment delimiters. Can it be made to recognize and properly highlight 3-characters delimiters? For example: In Emacs Lisp: ;;; Headings In C#...
9
votes
3answers
1k views

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 ...
0
votes
1answer
578 views

js2-mode: Highlighting and syntax checks only update when the buffer or mode is refreshed

As I'm typing into my buffer in js2-mode, the syntax is not being updated and all my new code is plain white. Additionally, existing text keeps its original color. For example, when I uncomment some ...
4
votes
2answers
928 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
572 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
167 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
214 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
948 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
596 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
95 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 ...