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.
246
questions
1
vote
0
answers
20
views
Make show-parens-mode recognize changed syntax table
I'm using a lot of bra-ket-like notation in LaTeX-mode, meaning things like ⟨f|, so I put
(modify-syntax-entry ?\⟨ "(|" LaTeX-mode-syntax-table)
(modify-syntax-entry ?\⟩ ")|" LaTeX-...
0
votes
1
answer
106
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 ...
0
votes
1
answer
46
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:
(...
0
votes
2
answers
146
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, ...
0
votes
0
answers
79
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 &...
0
votes
1
answer
453
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 ...
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 |...
0
votes
0
answers
101
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).
(...
1
vote
0
answers
77
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 ...
0
votes
1
answer
30
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-...
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 ...
0
votes
1
answer
336
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 ...
0
votes
0
answers
31
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
#+...
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 ...
0
votes
0
answers
55
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, ...
1
vote
2
answers
494
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=\...
1
vote
0
answers
103
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 ...
0
votes
1
answer
53
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 ...
2
votes
1
answer
55
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 ...
0
votes
1
answer
121
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 ...
1
vote
1
answer
288
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
...
0
votes
1
answer
154
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 ...
0
votes
0
answers
267
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 ...
1
vote
1
answer
41
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 ...
0
votes
0
answers
135
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 ...
1
vote
0
answers
53
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 ...
2
votes
1
answer
269
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/...
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 ...
0
votes
1
answer
321
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 ...
5
votes
0
answers
133
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
...
2
votes
0
answers
184
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 ...
1
vote
1
answer
47
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 ...
0
votes
2
answers
290
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.)
2
votes
0
answers
418
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 ...
0
votes
1
answer
63
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 ...
1
vote
0
answers
123
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-...
4
votes
1
answer
397
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?
0
votes
1
answer
51
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
;...
0
votes
1
answer
210
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)
...
0
votes
1
answer
159
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 ...
1
vote
1
answer
58
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. ...
0
votes
2
answers
107
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 ...
1
vote
1
answer
71
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?
0
votes
0
answers
59
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 ...
1
vote
1
answer
114
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-...
1
vote
1
answer
57
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 ...
1
vote
1
answer
153
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 ...
0
votes
1
answer
94
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 ...
1
vote
1
answer
48
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
#+...
1
vote
1
answer
351
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 ...