Skip to main content

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
1 answer
42 views

Better accuracy syntax highlighting

So I spent a bit of time making my own theme for emacs since none of them were quite right for me, and I'm really loving it as a text editor, but I'm wondering if there was a package that would give ...
Alex's user avatar
  • 1
0 votes
1 answer
32 views

Tex equation block highlighting in org-mode

I would like to highlight \begin{equation} ... \end{equation} Tex environments with a different color in org-mode. Inline Tex expressions (delimited by the $ symbol) can be highlighted as follows: (...
unvarnished's user avatar
0 votes
2 answers
106 views

org-mode: example blocks are no longer syntax highlighted in emacs

After upgrading to emacs 29.2 and org 9.7, my example blocks are no longer syntax highlighted in emacs. They used to be syntax highlighted when I specified the block's language. Any ideas? I use Doom, ...
HappyFace's user avatar
  • 830
0 votes
0 answers
70 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
367 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
20 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
83 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
  • 666
1 vote
0 answers
66 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
  • 11
0 votes
1 answer
28 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
2k 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
283 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
25 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
1 answer
28 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
34 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
  • 123
0 votes
0 answers
53 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
1 vote
2 answers
417 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
  • 379
1 vote
0 answers
97 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
  • 56
0 votes
1 answer
43 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
  • 798
2 votes
1 answer
53 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
  • 666
0 votes
1 answer
103 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 ...
oOosys's user avatar
  • 475
1 vote
1 answer
262 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
  • 830
0 votes
1 answer
130 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
236 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
40 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
128 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
51 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
239 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
  • 517
1 vote
1 answer
1k 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
283 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
  • 45
5 votes
0 answers
125 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,653
2 votes
0 answers
180 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
43 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
277 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
  • 298
2 votes
0 answers
412 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
104 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
4 votes
1 answer
347 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
45 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
198 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
153 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
55 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
  • 143
0 votes
2 answers
102 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
67 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
55 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
108 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
53 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
139 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
  • 392
0 votes
1 answer
88 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,400
1 vote
1 answer
47 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
2 3 4 5