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
1
vote
0answers
39 views

Modified mode highlighting

I want to modify the highlighting of my JS files, so that every line starting with LOG gets shown in a different color.1 I wrote the following (require 'font-core) (font-lock-mode 1) (defface mg-...
3
votes
1answer
256 views

Syntax highlight embedded script

I have a bash shell script that has a fairly sizable amount of perl code in it. Is there a why to get perl syntax highlighting instead of the normal here doc coloring? Thank you for any help, I'm new ...
0
votes
1answer
319 views

Is it possible to create case-insensitive keywords in a generic-mode?

I am very new to Emacs and I am discovering the functionality of "generic-mode" for the first time. I am trying to add a generic-mode to create basic syntax highlighting for an obscure programming ...
2
votes
1answer
754 views

Override c++-mode font lock

I am improving the C++ highlighting in Emacs with the minor mode: modern-cpp-font-lock. Consider this following C++14 code: int main() { int i = 1'2'3l; } From cppreference.com Optional single ...
3
votes
2answers
378 views

Division sometimes breaks syntax highlighting in ruby-mode

Interesting bug in ruby-mode. When a variable called index is followed by a slash /, syntax highlighting breaks. Here's a screenshot to show you what I mean: I'm not really sure how to file a ...
2
votes
1answer
137 views

Treat shebang as a comment

I am trying to get js-mode to highlight a "shebang" (#!/usr/bin/env node) as a comment, but my code is not working. Instead, the entire buffer is colored like a comment. I've read the documentation ...
0
votes
1answer
102 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
2answers
298 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
157 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
297 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
212 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
471 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
537 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
176 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
185 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
141 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
688 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
237 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
90 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
457 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
138 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 ...
3
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
157 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
735 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
422 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
449 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
421 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
216 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: ... / ...
6
votes
1answer
292 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
87 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.
27
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
503 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
558 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
588 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
956 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
583 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 ...