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
3 votes
0 answers
31 views

org-mode - how to ignore link syntax inside of src blocks?

The link syntax [[link]] is parsed as an org-link inside of a source block, as shown in the code and figure below, where my mouse if placed on top of [[2]]. #+begin_src emacs-lisp [[2]] #+end_src ...
user avatar
  • 3,373
1 vote
0 answers
34 views

Unusual behavior in Python syntax highlighting

I have Emacs 28.1 installed via brew running on macOS Monterey. No further customization. When I open a very basic Python program, I get unusual syntax highlighting. See below for a screenshot; you ...
user avatar
0 votes
0 answers
12 views

Diff SQL in Literal Examples

I need to store a diff of two SQL files in an org-mode note as a Literal Example. Part of that diff looks like this: +INSERT INTO `foo` VALUES (64,99,1,4,64); -INSERT INTO `bar` VALUES (1,1,'2022-04-...
user avatar
1 vote
1 answer
28 views

How do I match comments where the start and the end character are the same?

I have a programming language I want to make a major mode for where both the start and the end characters of a comment are the same. Specifically #. # This is a comment # As you can see it can match ...
user avatar
0 votes
2 answers
75 views

How to modify org headline font face based on WIP/TODO etc?

I have DOING defined as a DONE state. (Odd, I know.) I'm trying to get the font face for the DOING headline to appear the same as DONE. How can I do this? (Using Doom.)
user avatar
  • 173
1 vote
0 answers
88 views

Changes in python.el do not take place in python-mode

I'm facing the same problem as OP in this question: How can I make python-mode correctly indent python's match statement?. A quote from the OP: "Python 3.10 added a match statement. When I ...
user avatar
0 votes
0 answers
14 views

Make all colors black in the current buffer, without losing other face attributes

I want to disable colors for the current buffer, but preserve boldness, etc. (Which disabling font-lock-mode does not preserve.) The underlying reason is that sometimes the syntax highlighter goes ...
user avatar
  • 620
0 votes
1 answer
26 views

mode variant in org-mode code-block

I would like to add a quote from an rpm-spec file fragment in one of my org-mode documentation, e.g.: #+begin_src rpm-spec Name: foo Version: 1.0.0 BuildRequires: bar %description foo the ...
user avatar
  • 375
1 vote
0 answers
27 views

How to properly use modify-syntax-entry flags to syntax highlight comments in Lua?

I made my own Lua major mode about a month back. There is one thing that is still not working: highlighting comments. At first, I simply added ("--.*" . font-lock-comment-face) to lua-font-...
user avatar
  • 37
1 vote
1 answer
59 views

Meaning of colon before text in orgmode

I was working with orgmode when I typed colon follwed by a space and text. : text and the whole line got highlighted in blue (in my theme). What does this mean in Org mode?
user avatar
0 votes
1 answer
20 views

latex-mode keywords string highlight based on patterns

In LaTeX I use a number of custom commands for which I created a keyword highlight in init.el. For example, I have a command to write argmax/argmin and therefore I have the following in in my init.el ;...
user avatar
0 votes
0 answers
21 views

org-mode babel code color highlight doesn't work in a large file

I am enjoying the org-mode babel code color highlight. I write HTML, Perl, css and js in a single file and the coloring works fine with each languages' mode. This is the org file with some codes. #...
user avatar
0 votes
0 answers
64 views

Limited Python syntax highlighting when running Emacs via Terminal app on MacOS

On my Macbook, I get different syntax highlighting for Python depending on how I launch Emacs. If I launch via the MacOS app (installed via Homebrew) I get full syntax highlighting (first screenshot) ...
user avatar
0 votes
1 answer
22 views

How to auto run hide-ifdef-mode's hide-ifdefs command

I've been using hide-ifdef-mode with c-mode buffers for a while, but it is quite tedious to have to manually run hide-ifdefs (C-c @ h) every time a block of code containing preprocessors changes. Is ...
user avatar
  • 106
1 vote
1 answer
32 views

Point to bound variables in scope

So, Dr. Racket has a very interesting feature where you can see all occurrences of a bound variable if you hover it: Is there a way to do something similar in Emacs? I'm currently editing C++ code. ...
user avatar
  • 113
0 votes
2 answers
39 views

Is this syntax parse possible with Emacs' regex expressions?

I'm trying to write a small new mode for some input files to a specific computational physics program. I'm doing it the define-derived-mode way, and was specifying the syntax highlighting by setting ...
user avatar
  • 113
1 vote
1 answer
46 views

Defining color for "$"variable in bash

Unfortunately the dollar-sign in variable-names in the syntax-highlight is in the theme I use defined as 'default' face instead of being part of the variable name. Is there a way to customize this?
user avatar
0 votes
0 answers
30 views

How to highlight certain symbols only inside math environment?

I'd like to have certain math symbols highlighted. I checked AUCTeX manual but there does not seem to be a built-in way to do that. They are not folded forms or anything, but the real glyphs, which I ...
user avatar
  • 11
1 vote
1 answer
38 views

After setting syntax-propertize-function, comment is not being fontified with comment face

I'm trying to build a major mode for xwiki, where I'm defining {{{ verbatim }}} as a comment. So far, I've done (eval-when-compile (defconst xwiki-syntax-propertize-rules (syntax-...
user avatar
1 vote
1 answer
36 views

Trouble with f90 major mode, maltreatment of highlighting in continuation lines

My emacs (version 27.1 on a work computer where I do not have administrative privileges) seems strange. I am editing a *.f90 file and the major mode is correctly identified as f90. But the ...
user avatar
0 votes
0 answers
21 views

What makes the font-lock face of a variable appear and disappear when buffer text is modified?

I am looking into improving electric behaviour and stability of the syntax colourization of Erlang code done by the erlang-mode of erlang.el. While looking into this I noticed that the colorization of ...
user avatar
  • 621
0 votes
0 answers
19 views

#ifdef's bodies background in different colors (in C code)

I'd like to have the body of #ifdef blocks in C code with a different background color, i.e. #ifdef FOO /* This background in e.g., yellow */ #else /* This background in e.g., orange */ #endif ...
user avatar
  • 23
1 vote
1 answer
48 views

What libraries are available for working with Apache Avro IDL?

I noticed there is no library listed in melpa for highlighting and working with Apache Avro IDL schemata. Is there any, or else how people who work with Avro have set up their configuration to ease ...
user avatar
  • 320
0 votes
1 answer
49 views

Emacs >27.1: How to highlight in different colors for variables inside `fstring` in 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 ...
user avatar
  • 1,066
1 vote
1 answer
33 views

How to change #+begin_comment .... #+end_comment background and text color?

When I have this code: #+begin_comment So this is my comment's body text. I want it to have these features: 1. text color will be yellow 2. background color will be blue 3. text will be cursive #+...
user avatar
  • 43
0 votes
1 answer
174 views

Syntax Highlighting of Common Lisp User-Defined Macros in Emacs

I would like to start writing a few simple Domain Specific Languages in Common Lisp and would like the names of macros I define to be highlighted as if they were Common Lisp functions or macros in ...
user avatar
1 vote
1 answer
42 views

Syntax highlighting in C++ fails in user-defined literals

The C++11 way to separate the parts of a user-defined numeric (integer or floating point) literal with ' as e.g. in 1'500ms stalls parsing for syntax highlighting. I couldn't find anything on the net ...
user avatar
1 vote
1 answer
118 views

How to change syntax highlight inside #if 0?

In cc-mode, I want a way set all syntax highlight colours to slightly more desaturated versions when inside a #if 0 ... #endif block. If that would be troublesome/hard to maintain (having to set all ...
user avatar
  • 106
1 vote
1 answer
128 views

Emacs font-highlighting does not work on my own files?

I have an issue that probably has been asked and answered before but I am unable to find it because I seem to be using the wrong search terms for it. However, the issue I have is that if I make my own ...
user avatar
0 votes
2 answers
234 views

elpy flymake does not recognize local .pylintrc

I have the following in the project root for my .pylintrc: [FORMAT] # Maximum number of characters on a single line. max-line-length=1000 # String used as indentation unit. This is usually " ...
user avatar
0 votes
1 answer
58 views

Make mark color overlap highlight symbol at point

I use auto-highlight-symbol-mode package to auto highlight symbol on point. I found it annoying when I mark a text because the symbol highlight overlaps on my marked text, so I don't see if I marked ...
user avatar
  • 612
0 votes
0 answers
125 views

Unable to install ElPy: "eval-buffer: Cannot open load file: No such file or directory, s"

I followed the instructions to install ElPy from source: I cloned the repo to ~/code/elpy and added these to the Emacs initialization file: (add-to-list 'load-path "~/code/elpy") (load "...
user avatar
  • 1,499
0 votes
0 answers
61 views

Error and warning highlighting

I use Emacs to write LISP and Python code. I have tried NetBeans and Eclipse before, which had the advantage of parsing the buffer and highlighting problems, e.g. if one function or symbol is not ...
user avatar
  • 1,499
2 votes
0 answers
202 views

How to properly highlight a code block (in-buffer) when inside of another block/environment?

The issue is that my source code blocks, BEGIN_src ... END_src, are not properly highlighted when within another block, e. g., BEGIN_proof ... END_proof. Here is a picture of how that looks like: ...
user avatar
  • 755
1 vote
1 answer
37 views

Syntax highlighting of keywords only if following builtin

I'm writing a syntax highlighting mode and am trying to highlight certain arguments, only if they are following a specific word. I've written a MWE to show my problem: (defvar mwe-builtin-list '("...
user avatar
  • 331
2 votes
2 answers
757 views

font-lock-add-keywords is not working

So I've been trying to add custom syntax highlighting for digits using font-lock-add-keywords and regex. I've been looking at all the Emacs resources to do this, and while I have been able to ...
user avatar
  • 41
1 vote
1 answer
168 views

C++ mode, indendation confusion

Today I realized something odd that bothers me. Here is a little example of a function I wrote. I am using armadillo, but that is is unimportant. Here, the indentation looks just fine. float GetE0() { ...
user avatar
  • 61
0 votes
0 answers
80 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 ...
user avatar
0 votes
1 answer
44 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.
user avatar
  • 7,179
6 votes
1 answer
102 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 ...
user avatar
2 votes
1 answer
53 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?
user avatar
  • 2,924
0 votes
0 answers
66 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: ...
user avatar
1 vote
1 answer
72 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 ...
user avatar
  • 11
1 vote
0 answers
51 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 ...
user avatar
  • 2,924
3 votes
1 answer
282 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 ...
user avatar
  • 143
1 vote
1 answer
55 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-...
user avatar
  • 1,439
1 vote
1 answer
46 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, &&...
user avatar
  • 1,388
4 votes
2 answers
296 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 ...
user avatar
  • 141
0 votes
1 answer
210 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,...
user avatar
  • 101
0 votes
0 answers
119 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? ...
user avatar
  • 285

1
2 3 4 5