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
0answers
14 views

Simple syntax highlighting and regex

I'm working in mediawiki-mode and I'd like to more easily see comments I've highlighted in red with <span> tags, something like this: <span style="color:#FF0000">Comment here!<...
0
votes
0answers
14 views

GraphQL and Styled Components syntax highlighting in web-mode?

How can I add syntax highlighting for GraphQL and Styled Components in web-mode? Right now it doesn't work, which makes programming much less convenient, and it's surprisingly difficult to find the ...
0
votes
1answer
31 views

Color words based on gramatical categories?

Does there exist any package to color words based on grammatical class? (Noun, verb, adjective... etc). Something like rainbow-mode for grammar instead of colors.
6
votes
1answer
62 views

minor mode to display long integers?

I have to deal with long integers frequently, typically 9+ digits, and all of the digits matter (so scientific notation doesn't help me. Is there a minor mode that helps make it easier to visually ...
1
vote
1answer
44 views

Altering syntax highlighting for a particular expression

In c-mode, I would like all lines beginning with exec sql to have that expression grey and the rest of the line in the default face. How might I achieve that?
0
votes
0answers
37 views

Static function highlighting/locking in C++

In C++ mode, I am finding that static functions are only highlighted when written in the form static ReturnType function_name(args), and not when written ReturnType static function_name(args). Image: ...
1
vote
1answer
31 views

Syntax coloring: Unable to color special syntax

I am writing a mode to color a few common syntax in a symbolic language called FORM. I am a new user of emacs and I took the help of this website to write down the following code. I modified the ...
1
vote
0answers
23 views

Modifying syntax so as to grey out the non-source part of an org file

I thought a nice alternative to (org-edit-special) (which becomes cumbersome with many small blocks), and to tangling-and-untangling (which is incompatible with noweb references), might be simply to ...
2
votes
1answer
57 views

Is there a standard mode for .ini files?

After looking for a mode for .ini files, I found ini-mode via MELPA, but upon installing it in Emacs 26, there was a message about it being an obsolete mode. What are the alternatives? In my limited ...
1
vote
1answer
28 views

show-paren-mode or similar to highlight multi-character parentheses

In latex, "parentheses" such as \(\), $$ and \[\] are constantly used. Is there a way to customize show-paren-mode or is there some other mode to highlight these multi-character parentheses in latex-...
1
vote
1answer
33 views

Alternative text for keywords?

font-lock-add-keywords lets users highlight keywords. Can you also specify an alternative text? For example, in C source code, besides using a special face, we may wish to visualize ! as not, &&...
1
vote
2answers
38 views

Is it possible to selectively disable syntax highlighting rules?

The context : GNU Emacs 26.1 working on Debian 10.3 currently editing YAML files (Ansible code) Here's how my code looks like : As you can see, the syntax highlighting is puzzled by the odd number ...
0
votes
1answer
59 views

Highlight syntax of function names and their arguments in custom mode

I'm trying to create a major mode that handles the following syntax: function someName(value1, value2) # some contents end function I'm using the following to highlight the keywords function,...
0
votes
0answers
51 views

disable syntax highlight on inactive windows

I got the following code for highlighting inactive and active windows with different background color. How do I make so that inactive windows have no syntax highlighting, only the active window has? ...
9
votes
1answer
279 views

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

Automatically highlight elements in an XML buffer

I spend a lot of time in XML buffers using nxml-mode (Emacs 26). Out of hundreds of XML elements, I am only interested in one or two. How can I have Emacs always show the XML elements I'm interested ...
0
votes
0answers
50 views

Emacs font style and colorisation

I am used to Emacs under Windows 10 and trying to switch to Ubuntu. My Windows 10 Emacs font is M-x describe-font: name (opened by): -outline-Courier New-normal-normal-normal-mono-13-*-*-*-c-*-...
2
votes
1answer
112 views

How does org-mode implement syntax highlighting for code blocks?

How does org-mode implement syntax highlighting for code blocks? More specifically, for a C file, does it use cc-mode or does it have its own algorithm? For example, if I have this org file: test.org: ...
4
votes
1answer
48 views

How to highlight digit groups of 3 in numerals?

I find it very useful to visually distinguish every 3 digit group of numbers in source code so that I can read it. For example something if I see 1000000 it is fairly easy to see that this is 1M ...
2
votes
0answers
31 views

Different face for checked-off items in plain lists?

Q: how can I get a different face for checked-off items in org plain lists? I use org-mode's plain lists a lot: - [X] item 1 - [ ] item 2 - [ ] item 3 - [ ] item 4, with a whole lot of text that ...
0
votes
0answers
143 views

syntax highlighting in ranger

I've been playing around with ranger in emacs and I'm really liking it for browsing new codebases. I would like to get syntax highlighting working, as it does when using ranger in a terminal. I'm not ...
2
votes
1answer
57 views

AUCTeX fontification for any command: overkill?

Reading the AUCTeX manual I see that it is possible to add expressions to those one wants to highlight in a .tex file. There are also many specific suggestions around for how to add specific commands ...
0
votes
0answers
245 views

Markdown and Latex highlighting (font lock) in R Markdown file

I am using polymode to edit rmarkdown files. Exporting to e.g. pdf is super simple and works very well. R code chunks are also properly highlighted. But: I do quite often use latex code inside (r)...
0
votes
1answer
56 views

font-lock keywords and syntax-table mutually interfering

I would like to define something that font-locks a bit like a new sort of string-literal/comment. I might write: (font-lock-add-keywords 'emacs-lisp-mode (list '("<<.*>>" 0 'my-custom-...
0
votes
0answers
36 views

In Spacemacs, in a Perl or Go file, is there a way to get syntax highlighting for SQL strings?

For heredocs and backtick strings in Perl or Go code respectively, I would like to get SQL syntax highlighting. Can this be done?
1
vote
1answer
58 views

Scilab-mode syntax highlighting

I'm trying to install (and run) scilab-mode, but the syntax highlighting does not work when I open .sci or .sce file. I use the exact configuration described in the scilab.el package. https://www....
0
votes
0answers
75 views

How can I get Tex-latex-mode style inline math fontification in Org mode?

I enjoy the inline math fontification that the AucTeX TeX-latex-mode provides – both the theme-responsive coloring and visual indication for sub- and super-scripted math. I have worked in plain ...
1
vote
1answer
577 views

How to disable semantic highlighting in lsp-mode?

Language server mode has a variable for semantic highlighting lsp-ht, I would like to disable all syntax highlighting in lsp-mode. Is this possible? (setq lsp-enable-links nil) (setq lsp-enable-...
1
vote
0answers
58 views

sh-mode: Correctly indent and highlight inside bash's subshell substitution $()?

I noticed that bash will correctly apply syntax highlighting inside the subshell substitution in VALUE="Hello $(echo World)." But when creating a more complicated value, e.g. VALUE="Hello $( ...
2
votes
1answer
26 views

Show @ symbol in different color in clojure mode

I want to show @ symbols (meaning dereference) in red in clojure-mode. How do I do that?
1
vote
1answer
90 views

Improving org-block-begin-line, splitting in several faces

The face org-block-begin-line allows to customize the first line of the following block #+BEGIN_SRC lang :var arg1=1 arg2=2 ... #+END_SRC However, I would like to customize the faces within the line,...
0
votes
0answers
27 views

Refresh code indentation over a region

I have this: #!/usr/bin/bash while read f; do { #Try echo "$f" } || { # Catch printf "error" } done < "${1:-/dev/stdin}"; And I would like this in one ...
1
vote
0answers
99 views

How to highlight references of local functions and variables?

I want my local function names (those declared in the current file and picked by font-lock-function-name-face) and my variable names (font-lock-variable-name-face) to be highlighted across the whole ...
0
votes
2answers
53 views

Chinese Text commentary syntax highlighting

Plain text inherited from ctext.org contain the following syntax: {{...}} 堯年十六,以唐侯升為天子,遂以為號。{{《論語·泰伯》疏 案曰:堯典正義云:徧檢書傳無帝堯卽位之年,則此似非伏生大傳文,疑出書緯。}} 辯章百姓。{{見《毛詩·采菽》正義、《史記·五帝紀》索隱、《後漢書》注}} ...
2
votes
1answer
42 views

Are comment style flags insufficient to separate SQL comments?

I am trying to understand why SQL mode accepts -* as a comment block start. In sql.el, I read: (defvar sql-mode-syntax-table (let ((table (make-syntax-table))) ;; C-style comments /**/ ... ...
1
vote
0answers
34 views

Why does sql-mode think -* starts a block comment?

While typing in a SQL mode buffer, I noticed that -* starts a block comment. Why? It happens whenever I type an asterisk/star character (ASCII 42) directly after a simple dash/hyphen/minus character (...
0
votes
1answer
119 views

org-babel for vimscript or most similar language

Since I couldn't find anything as per title, does anyone know what org-babel language could be used as workaround? Currently I surround code blocks with #+begin_src sh, though in particular the ...
4
votes
2answers
158 views

How to highlight the current scope with C family languages?

While it's possible to highlight a block using the character under the cursor, is there a way to highlight the scope of the current cursor? I'm interested in something like QtCreator's block-...
0
votes
1answer
44 views

Highlight some specific text in Emacs

I am using web-mode for my php files: http://web-mode.org/ And I call often a php function which looks like this: __lg('Some text here', 'Global', NULL, FALSE); This function can be call with only ...
0
votes
2answers
333 views

hl-line-mode interferes with custom syntax highlighting [duplicate]

Recently, using fic-mode as reference, I implemented a way for words like TODO, etc. to be highlighted. Here is the code: (defun todo/pos-in-doc-or-comment-region-p (pos) (memq (get-char-property ...
1
vote
0answers
24 views

Migrate Webstorm Code Highlighting

I am currently using Webstorm as my daily driver but I am trying to look into Emacs and possibly transition. One of the most important things to me that I have spent the last 3 years on was to ...
1
vote
1answer
178 views

highlight-regexp groups for syntax highlighting

I want to highlight certain words to a color using highlight-regexp. The words I want to highlight are "fn", "let", "mut", etc. for rust development. The code I have so far is this: (add-hook '...
6
votes
1answer
126 views

How to prevent emacs from fontifying empty part of the line?

As an example, if I start a one line comment: ;; Comment⏎ Emacs will fontify the the whole line, from the beginning of line, occupying the entire width of the window, as comment. This can be made ...
0
votes
1answer
119 views

Custom verbatim environments/macros in AucTeX

Here's my MWE: \documentclass{article} \newenvironment{tscode}{}{} \def\tscode|#1|{} \begin{document} \tsinline|efwe| \begin{tscode} efihw$feiw$ \end{tscode} \end{document} % Local Variables: % ...
1
vote
0answers
55 views

Syntax highlight strings in compilation-mode

Is it possible to activate syntax highlighting for strings in compilation mode? Sometimes the compilation error output of some C++ linter is quite unreadable. Lengthy types and function definitions ...
1
vote
0answers
48 views

EMACS doesn't grey out comments

When I comment out code with combination of /* and */ in JavaScript nothing happens with text and it stays the same color. (You can see it in second part of code, one that is not grayed out but is ...
3
votes
1answer
66 views

How to re-enable syntax highlighting of code that have been disabled by #if preprocessor statements

Code between #if SYMBOL and #endif is greyed out in cc-mode if the SYMBOL has not been defined within the current file. The project that I´m currently working on has a common code base for Mac and ...
1
vote
1answer
179 views

Using org-mode for writing. Would like text in quotes to be highlighted and also character names

I'm using org-mode to write a novel and I would like to have any text between "quotes" to be a different color, just to be able to easily see when a character is talking. Also, if I could have a ...
1
vote
0answers
389 views

Syntax highlighting not working in Emacs (in Python mode)

When I Python-mode I have noticed that occasionally my syntax highlighting is not working. I have noticed this when using the Cyberpunk theme as well as the Tango-Dark theme. Closing and reopening ...
0
votes
0answers
1k views

Export org-mode code blocks with minted style

I am trying to export org-mode source blocks to pdf via Latex and I use minted to get syntax highlighting. My org file looks like this: #+latex_header: \usepackage[utf8]{inputenc} %% For unicode ...