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.

45 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10
votes
2answers
301 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 ...
8
votes
0answers
527 views

How to syntax highlight Python f-strings so {…} uses regular code colors?

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 ...
7
votes
2answers
158 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, ...
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 ...
4
votes
0answers
64 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 ...
3
votes
0answers
100 views

how to highlight imported functions in python code?

python-mode or elpy-mode in Emacs only highlight the basic Python library functions. If you work a lot with other libraries like numpy and matplotlib, would be nice to have these functions and ...
3
votes
0answers
77 views

How to place asterisks in beginning and end of lines in a marked region?

I use org-mode a a lot and take notes in Org files. I like to sometimes highlight some important text. I colored bold to be red but it doesn't span multiple lines. And I couldn't get that to work ...
3
votes
0answers
981 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 ...
3
votes
1answer
259 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 ...
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 ...
2
votes
0answers
65 views

Which mode to get syntax-highlighting for commit messages (svn/git/hg… etc)

When editing commit messages for various version control, what should I enable to get syntax highlighting? (without having to use some heavy mode for all other VCS operations like magit)
2
votes
0answers
453 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 ...
1
vote
1answer
43 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....
1
vote
0answers
38 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 $( ...
1
vote
1answer
56 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,...
1
vote
0answers
76 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 ...
1
vote
0answers
29 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 (...
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
0answers
43 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
46 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 ...
1
vote
0answers
280 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 ...
1
vote
0answers
98 views

Fix org-mode agenda highlighting

I'm having an issue with highlighting in Org agenda: Can't make the link and tags Gray when the item is marked as Done. I've tried to play with different properties of the font-lock definition, but ...
1
vote
0answers
40 views

Hide region from syntax highlighting and indentation

c++-mode does not handle the C++17 R"delim()delim" string literals. Is there a way to mark a region (via comments?) so it will not be syntax highlighted and will not confuse the indenter?
1
vote
0answers
100 views

How to highlight fragments of source and example blocks within an org-mode buffer itself

This is a variation on the theme of How to <mark> code fragments in org-export. Here the question is about making portions of src and example blocks stand out (preferably without breaking the ...
1
vote
0answers
57 views

How can I activate my syntax-table?

I'm using SampleMode and the ModeTutorial to create my own mode. I have a problem with the syntax table. As I understand, // and # start one-line comments like this: (defvar my-mode-syntax-table (...
1
vote
0answers
62 views

LaTeX highlighting: Dollar expressions across lines

I'm having some trouble with LaTeX math expressions between (single) dollar signs. Specifically, syntax highlighting breaks across lines. Things looks something like this: if there exists $\alpha&...
1
vote
0answers
76 views

Eclim problems not being highlighted/problems not being shown in minibuffer

I know I have eclim setup correctly because everything else works, I.E I can do autocomplete, jump to definition etc. I can even see problems with eclim-problems. However, when I make a syntax error, ...
1
vote
0answers
22 views

Cperl font lock regions in here docs

I am having a problem in cperl-mode described in this question. Basically inserting a newline at the start of a line in here doc in cperl-mode is breaking the syntax highlighting. One of the answers ...
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-...
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
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)...
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.
0
votes
0answers
40 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-*-...
0
votes
0answers
89 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 ...
0
votes
0answers
76 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
40 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
30 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?
0
votes
0answers
64 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 ...
0
votes
1answer
302 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-...
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 ...
0
votes
0answers
19 views

how to disable multiline highlighting for org-emphasis?

Be default, org-emphasis can span across 2 lines (but not 3), e.g., the words "is an" is highlighted as bold in the following example: This *is an* example. I don't want that kind of highlighting, i....
0
votes
1answer
99 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: % ...
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 ...
0
votes
0answers
71 views

Auto highlighting text when paste a new content

This is my first post here. I have Emacs installed at work and at home. The functionality is slightly different when I use highlighting and I cannot figure out which options to change. At work, I ...
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 ...