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

A script to export org with highlighted code block

I've written the script to export all of my ORG files into HTML files. It takes the files from the folder "content" and saves the results to "public". (setq user-emacs-directory &...
ANtlord's user avatar
0 votes
1 answer
87 views

How to use tree-sitter parser for syntax highlighting?

I'm trying to setup Emacs for editing Roc (https://www.roc-lang.org/) source code. I have an LSP server for Roc and tree-sitter parser for Roc installed. Unfortunately I failed to find tree-sitter ...
Yuriy Al. Shirokov's user avatar
0 votes
0 answers
16 views

Haskell Interactive mode - incorrect parsing of crammed code

When using list comprehension without white spaces, all text after vertical bar turns grey. [x| is treated like header of here-document - grey color spans for the rest of the buffer, unless sequence |...
Przemek's user avatar
  • 101
0 votes
0 answers
39 views

why is "org-highlight-latex-and-related" messing with org-hyperlink description?

Basically, to highlight latex equation I need to include native in org-highlight-latex-and-related. But that messes up links with _ ([[file:asdfk_jkfke_erj224jk.txt][a link]] for the example below). (...
Garid's user avatar
  • 589
0 votes
0 answers
30 views

Disable syntax highlighting after single quote in HTML mode

I manually edit an HTML file which contains plain text and HTML tags. How can I prevent emacs' html-mode to treat single-quotes ' (i.e. apostrophes) as string separator? For example in <pre>This ...
djonif's user avatar
  • 1
0 votes
1 answer
23 views

Define new comment style with string literals rather than characters

I am trying to define another comment style, similar to what we can do with modify-syntax-entry: (modify-syntax-entry ?/ ". 124b") (modify-syntax-entry ?* ". 23") (modify-syntax-...
Jake Ireland's user avatar
0 votes
2 answers
444 views

How enable tree-sitter modes (*-ts-mode) that aren't built-in?

My Emacs (29.1) comes with the some tree-sitter modes: c-ts-mode go-ts-mode js-ts-mode ... I downloaded the compiled .dll and they work out of box. However, there are some languages that tree-sitter ...
Lai Yu-Hsuan's user avatar
0 votes
1 answer
98 views

How does emacs/eglot decide which syntax element to highlight and how could I change it?

For example, I'm writing a Lua file. I noticed that the table keys are not highlighted: I'd like to make the table keys in a different color than values, like what Emacs does for YAML: But I don't ...
Lai Yu-Hsuan's user avatar
0 votes
0 answers
16 views

Syntax highlighting for source blocks inside special blocks

Syntax highlighting doesn't work for source blocks that are nested inside special blocks: #+BEGIN_test #+begin_src js return 14 #+end_src #+RESULTS: : 14 #+END_test #+begin_src js return 14 #+...
feelsbadman's user avatar
0 votes
0 answers
27 views

Support for fixed-length fields

I have a file which contains several lines. Each line contains of several "fields" (about 20 - 40 ), each having a fixed length of characters. There are no gaps (field1 follows fields2 and ...
ClemensFMN's user avatar
0 votes
0 answers
17 views

Whitespace in syntax table for comment delimiters in conflict with indentation and font lock

The special file format of my software uses angle brackets as a delimiter and # / # as comment markers (note the whitespace after the first # and before the last #). I try to make a major mode to ...
Lalylulelo's user avatar
0 votes
0 answers
21 views

Polymode in org-edit-special

I use (add-hook 'python-mode-hook 'poly-python-sql-mode) where poly-python-sql-mode is a special polymode that correctly highlights SQL queries that are used within strings in a Python file. When this ...
guibor's user avatar
  • 121
0 votes
0 answers
51 views

Syntax highlighting C++ variable names that contain a $ sign

Many C/C++ compilers have a nonstandard extension that allows $ to appear in variable names. In c++-mode, if I write int main() { int $a = 0; } Then $a doesn't get colored like a variable name, ...
Joseph Garvin's user avatar
0 votes
0 answers
39 views

Wrong syntax highlighting with command substitution in sh-mode [bash]

I am using the Doom framework (3.0.0) for Emacs (28.1) on Windows 10 with MinGW64. At least for all practical purposes to the effect of my work, everything seems to be running smoothly except for the ...
Marcos's user avatar
  • 101
0 votes
0 answers
69 views

indentation and syntax highlighting stops working randomly

Every now and when emacs indentation and syntax highlighting stops working. This seems to affect all modes that I'm using (primarily org-mode,ess-mode and emacs-lisp-mode), and manifests itself in ...
swhalemwo's user avatar
1 vote
2 answers
158 views

How do I change Org's HTML code background?

Modifying Minted background is easy if my output from Org is LaTeX. \definecolor{LightGray}{gray}{0.9} \begin{minted} [ frame=lines, framesep=2mm, baselinestretch=1.2, bgcolor=LightGray, fontsize=\...
Sam7919's user avatar
  • 349
1 vote
0 answers
66 views

Is there a way to export a selected color scheme into css for org-mode?

I know that you can set the org-html-htmlize-output-type variable to 'css in order to make org-mode use a set of CSS classes for coloring output. However, all of the colors need to be defined by the ...
sajmon's user avatar
  • 36
0 votes
1 answer
33 views

No syntax-highlight in c-mode *immediately* after enabling

I'm writing tests for color-identifiers-mode I co-maintain, and I stumbled upon a problem that after creating a buffer and enabling c-mode in it, there is no highlight over keywords. For example, if ...
Hi-Angel's user avatar
  • 554
2 votes
1 answer
46 views

Why dividing long line (with lambda/interactive) in the (general.el) breaks off the Syntax coloring?

This is part of my general el config. As shown in the image, when I divide long line (that has lamda, interative) into multiple lines :which-key ...... changes color.` Why is this happening? Am I ...
Garid's user avatar
  • 589
0 votes
1 answer
60 views

Does Emacs support syntax highlighting for self-defined text categories?

In other words, are the text-part-categories which can be highlighted limited in amount and hard-wired into Emacs (keywords, functions, strings, digits, numbers, etc.) or is it possible to define any ...
Claudio's user avatar
  • 430
1 vote
1 answer
136 views

How do I get syntax highlighting in example blocks when exporting org-mode to HTML?

I have set org-src-fontify-natively to t, and have htmlize installed. But my example blocks still don't have syntax highlighting when exported to HTML. #+begin_example python print(8*8) #+end_example ...
HappyFace's user avatar
  • 791
0 votes
1 answer
88 views

PHP Syntax highlighting problem

I'm very new to GNU Emacs. I use GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-05-31. Here is my ~/.emacs file. (setq-default tab-width 4) (require ...
Răzvan Birișan's user avatar
0 votes
0 answers
146 views

Doom Emacs AsciiDoc syntax highlighting?

I want to write AsciiDoc documents in Emacs (more specifically Doom Emacs) with syntax highlighting. I've tried: Adding (package! adoc-mode) to the bottom of ~/.doom.d/packages.el . Adding adoc-mode ...
01AutoMonkey's user avatar
1 vote
1 answer
39 views

Highlight car of each sexpr in source

All the syntax highlighting suggestions I've managed to find so far are keyword driven. I'm reading data written in s-expressions that doesn't have keywords, but the car of each list is still somewhat ...
Jon Chesterfield's user avatar
0 votes
0 answers
96 views

Org-reveal not working with highlight.js

Here is my .org file #+REVEAL_THEME: Moon #+REVEAL_PLUGINS: (highlight) #+begin_src html <h2 class="headline1> Hello </h2> #+end_src The highlighting is not ...
Anoop D's user avatar
  • 101
1 vote
0 answers
46 views

How to apply changes from a major mode that I'm currently creating?

I'm writing a syntax highlighting mode for emacs, and wondering if there is a way to improve my workflow. Currently I do this: make edits to mymode.el restart emacs open mymode.el eval buffer open a ...
Alex Shroyer's user avatar
2 votes
1 answer
166 views

Ligatures without font-lock

Is there a way to enable ligatures in Emacs other than using font-lock? I'm asking because font-lock is slow on reasonably large buffers. After having read it https://www.reddit.com/r/emacs/comments/...
Nordlöw's user avatar
  • 497
1 vote
1 answer
746 views

Why can't I install package yaml-mode on my Emacs via use-package declaration?

I am trying to install a package called yaml-mode on my Emacs. Basically, a syntax highlighting for .yaml files. My current syntax highlighters do not have support for yaml files, apparently. Hence, I ...
Pedro Delfino's user avatar
0 votes
1 answer
185 views

How to set a specific background color for a certain string in text?

I would like to highlight each occurence of some word e.g. "covid" in a text when the file is loaded. It will be in org files but even global scope for all files is not a problem. So, I can ...
fegax's user avatar
  • 35
5 votes
0 answers
106 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 ...
Daniel's user avatar
  • 3,603
1 vote
0 answers
173 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 ...
user38125's user avatar
1 vote
1 answer
40 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 ...
irishgreencitrus's user avatar
0 votes
2 answers
225 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.)
Gavin's user avatar
  • 258
1 vote
0 answers
394 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 ...
Keyboard_Crasher's user avatar
0 votes
1 answer
60 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 ...
Chen Levy's user avatar
  • 385
1 vote
0 answers
83 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-...
Alan's user avatar
  • 37
2 votes
1 answer
246 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?
Emmanuel Goldstein's user avatar
0 votes
1 answer
34 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 ;...
PinkCollins's user avatar
0 votes
1 answer
183 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) ...
charliesneath's user avatar
0 votes
1 answer
127 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 ...
Luctins's user avatar
  • 120
1 vote
1 answer
47 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. ...
Romário's user avatar
  • 133
0 votes
2 answers
93 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 ...
Duncan W's user avatar
  • 113
1 vote
1 answer
63 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?
OsunSeyi's user avatar
0 votes
0 answers
44 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 ...
Tera's user avatar
  • 41
1 vote
1 answer
92 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-...
ackerleytng's user avatar
1 vote
1 answer
50 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 ...
kbg519v1a's user avatar
1 vote
1 answer
108 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 ...
dmvianna's user avatar
  • 370
0 votes
1 answer
77 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 ...
alper's user avatar
  • 1,300
1 vote
1 answer
45 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 #+...
kipkipe's user avatar
  • 43
1 vote
1 answer
292 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 ...
Rama Lakshmanan's user avatar

1
2 3 4 5