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
21 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
40 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
40 views

Chinese Text commentary syntax highlighting

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

Changing colors of text between two pre-specified markers

I am editing some TeX files, in emacs in which contains lots of text between @{ and @} markers. Is it possible to modify TeX's highlighting so that text between those brackets get colored in yellow, ...
0
votes
0answers
49 views

Limitations of latex mode inline math syntax highlighting

My Problems: In latex major mode (not Latex major mode), syntax highlighting works okay for line 1, but not for line 2. line 1 : my hypothesis is $a^2 + b^2 = c^2.$ line 2 : my hypothesis is \(a^2 ...
0
votes
1answer
88 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
36 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
37 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
40 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
141 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
170 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
584 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
1answer
224 views

Dynamic syntax highlighting (font-lock-mode) stops working in emacs 25.3

About 15-20 minutes into using emacs my syntax highlighting stops dynamically updating. Instead any new text just uses the color of the text right before it. Any ideas on how to debug this issue or ...
5
votes
1answer
191 views

Highlight matching quotes

Is it possible to highlight matching quotes as show-paren-mode does with parentheses? The characters I'm looking to highlight are "dumb" quotes, both single (Unicode: apostrophe, U+0027) and double (...
1
vote
0answers
70 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 ...
2
votes
1answer
50 views

Preventing syntax highlighting in the wrap-prefix

When Emacs wraps long lines, is there a way to prevent the wrap prefix from having syntax highlighting (font-lock) or any such special properties? Specifically, I have the following settings: ;; ...
0
votes
1answer
211 views

org-mode only highlights some source blocks, not all

I write my emacs configuration file in org mode, which works fine, only that org-mode does not highlight some source blocks. I set (setq org-src-fontify-natively t), but this only seems to take ...
0
votes
1answer
69 views

Search based fontification not working

In trying to learn Emacs Lisp on Emacs 25.3.1, I decided to implement a minimal version of fic-mode. Following is the code: (defun todo/pos-in-doc-or-comment-region-p (pos) (memq (get-char-property ...
0
votes
0answers
60 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 ...
5
votes
0answers
343 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 ...
2
votes
2answers
216 views

Detect missing > html emacs web-mode

Hello I am new to Emacs and I am currently using it for web development projects. I am currently using Laravel and VueJS on my development. I search online what is the best major mode for this web ...
0
votes
1answer
65 views

Highlight a buffer with custom programming language syntax

I have files which are not .py but they are python code. I want to highlight them as if they were python files. How can I do that.
4
votes
1answer
489 views

org-mode batch export: Missing syntax highlighting

I'm having issues achieving any syntax highlighting in the results of the following command: emacs nix.org --batch -f org-html-export-to-html --kill I know this question has been asked a few times ...
0
votes
1answer
97 views

Why does text surrounded by tildes in org mode turn grey

I noticed that text surrounded by tildes in org-mode turns grey (as least in my colour theme, and I assume the colour changes in others as well). What is that about?
1
vote
0answers
39 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?
6
votes
1answer
342 views

How to highlight graphql template literals (gql) in js(x) files?

Inside of a jsx file, I want to use a gql template literal to define GraphQL queries. Could I in emacs make that section of the jsx file highlight graphql syntax, instead of just showing it as a ...
2
votes
2answers
429 views

Can I highlight Lisp like this?

I'm using Spacemacs, and I REALLY love how Dr. Racket background highlights parentheses as you move around. I'm wondering if I can do this in Emacs instead of this God forsaken "rainbow delimiters" ...
3
votes
0answers
75 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 ...
1
vote
1answer
287 views

Highlight labels/flet/macrolet definitions in lisp-mode

I found this solution (https://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00322.html, fully cited below), but it isn't working as expected. It highlights only the first definition inside labels/...
1
vote
1answer
57 views

How can I make syntax-propertize skip part of the buffer?

In SPARQL, comments starts with a # and follows to the end of the line. The problem is that URI's, which is a big part of SPARQL, can also contain #, but then they are not the start of a comment. Like ...
0
votes
0answers
72 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
2answers
257 views

How to export babel source blocks with syntax highlighting to ODT in org-mode in Emacs 27?

In Emacs 27, babel source blocks do not export syntax highlighting to ODT format. The same org document is exported as expected in Emacs 25. Versions: GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-...
0
votes
1answer
76 views

Default syntax highlighting as in “emacs -Q”

I want to use the syntax highlighting that you get when running emacs -Q. If I run emacs -q, or run Emacs with no ~/.emacs file existent, or not load any custom theme, I get a dark-backgrounded color ...
3
votes
0answers
63 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 ...
1
vote
1answer
162 views

Syntax highlighting inside HTML5 <script> tags

I was curious if there was a way to get highlighting/indentation for any JavaScript that's inside of HTML5 tags? I don't frequently use JavaScript but for a class I'm in we're working with it. I ...
1
vote
1answer
262 views

Is there a way to highlight the (s) expression you are in?

I currently have (paren-set-mode 'paren) in my init.el, and it does a good job of highlighting the area between parentheses. However, I was wondering if there was a way to highlight the expression I ...
1
vote
3answers
761 views

Different colors for questions and answers in org-mode

I'm writing questions and answers in org-mode for project purposes (like meeting notes). A sample looks like this: 1. [X] Equipment name for tags associated with pumps - Discuss Comment: We can ...
0
votes
1answer
193 views

Adding new syntax highlighting for some major modes does not work

My question is similar to this one and that one: I would like to add highlighting of some characters that are not highlighted in some programming modes, like python-mode and fortran-mode. So, ...
2
votes
0answers
54 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)
1
vote
0answers
52 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 (...