Questions tagged [font-lock]

Font Lock mode is a minor mode, always local to a particular buffer, which assigns faces to the text in the buffer.

Filter by
Sorted by
Tagged with
0 votes
1 answer
85 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
1 answer
68 views

How to set font for specified character?

I don't prefer JuliaMono font, but it provides a view of one character that I want to see in my code. It is "|" that looks like a solid vertical line in some OCaml common code situation. I ...
Valentyn Zakharenko's user avatar
0 votes
0 answers
57 views

Use different font for math fragments in org mode

How do I use the fixed-pitch font for math fragments in org-mode buffers? I.e., I want to use a monospace font for all strings of the form \(...\) or \[...\], where ... may include newline characters ...
A is for Ambition's user avatar
4 votes
1 answer
59 views

Meaning of nils in font-lock-defaults

I want to understand the fields in font-lock-defaults. The documentation reads Defaults for Font Lock mode specified by the major mode. Defaults should be of the form: (KEYWORDS [KEYWORDS-ONLY [CASE-...
Kevin's user avatar
  • 576
0 votes
1 answer
30 views

Use rx to highlight a specific group in a match [duplicate]

I am trying to write a major mode for a language, and I am working on the syntax highlighter. I am using rx with some success, however I need to highlight the following pattern: `somemacro(args...)` ...
Jake Ireland's user avatar
0 votes
0 answers
34 views

Is there a way to hide link prefixes in org-mode?

For some link types it would be nice to hide the link prefix automatically. This post does this with text properties, but I'd prefer if it was possible to do with something like prettify-symbols or ...
user41177's user avatar
  • 121
0 votes
1 answer
18 views

how to use different faces for regular expressions in the same line in font-lock-defaults

I'm trying to create a major-mode for HTTP requests in emacs, I'm stuck at the syntax coloring for regexs at the same line. let this be the HTTP request I'm trying to highlight: GET /...
ntriisii's user avatar
2 votes
2 answers
321 views

How to highlight documentation comments with tree-sitter?

In c-mode it's possible to show doxygen comments /** ... */ using font-lock-doc-face. See: docs for c-doc-comment-style. How can this be done in c-ts-mode ? I can find documentation pointing to ...
ideasman42's user avatar
  • 8,556
0 votes
1 answer
44 views

How can I fontify a new keyword with special character in Emacs, e.g. like `-let` or `-if` or `*if`?

I already tried but was not successful. Here is the regex: (font-lock-add-keywords 'lisp-mode '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend) ...
Tu Do's user avatar
  • 6,772
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
1 answer
42 views

Remapping a face in font lock mode

Given this headline: ** Title Title Title Title The headline has the face "org-level-2" applied. This face has been applied by means of a regexp, using font-lock. Let's assume that "...
cidra's user avatar
  • 135
2 votes
1 answer
59 views

Text Property of `initial-scratch-message' Not Taking Effect

;;; ~/.emacs.d/init.el (custom-set-variables '(inhibit-startup-screen t) '(initial-scratch-message #("++" 0 2 (face underline)))) I expect to see an ...
shynur's user avatar
  • 4,638
1 vote
2 answers
153 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
  • 339
0 votes
0 answers
21 views

Highlighting strings in Org and Markdown mode doesn't work with *bold* or /italic/

I want to highlight strings between double quotation marks in org-mode and markdown-mode, just so they're easier to see, as in LaTeX-mode. I have the following in my .emacs: ;; Highlight strings ...
Joel Adamson's user avatar
0 votes
2 answers
53 views

How do I export code font-lock from Org to HTML?

With the following .emacs (on bleeding-edge GNU Emacs 30.0.50 and Org mode 9.6.1 in 2023) ;; Org -> LaTeX (require 'ox-latex) (add-to-list 'org-latex-packages-alist '("" "minted"...
Sam7919's user avatar
  • 339
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
59 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
  • 420
0 votes
0 answers
39 views

Font Face rendering of boxes around text produces ugly result if text is not placed in separated lines

Following behavior observed while running Linux Mint 21 Cinnamon with Emacs 28.2.1 installed from source and with via emacs GUI made following changes to ~/.emacs: '(default ((t (:family "DejaVu ...
Claudio's user avatar
  • 420
0 votes
0 answers
38 views

How to stop screen from changing how emacs handles colors

In .screenrc, I have this line: term xterm-256color If I do not use that, or if I try something different (like xterm-color or screen-256color), then emacs has absolutely no color. Here is a font-lock ...
Ness's user avatar
  • 165
0 votes
0 answers
28 views

How do I realign fontified marker after adjusting window size?

I have the following function (defun org-fontify-proof-blocks () (add-to-list 'font-lock-extra-managed-props 'display) (let ((margin-format (format "%%%ds" ...
user432111's user avatar
0 votes
1 answer
92 views

How to visually indent continuation lines of Org property values to align with the column specified in org-property-format?

Long property values in Org mode property drawers are by default not visually indented in visual-line-mode so as to align with the start column of the property values (as defined in org-property-...
orgtre's user avatar
  • 1,052
0 votes
0 answers
17 views

Font-locking issues with org-special-blocks

I'd like to fix some minor annoyances with emphasis marker font locking in org-special-blocks. The issues are the following: When including an #+attr_latex: line above the #+begin_<environment> ...
user432111's user avatar
0 votes
0 answers
32 views

How to disable font-lock for org-special block lines?

I like using org-special blocks. I have an issue due to how I've set up my org-emphasis-regexp-components (done this way because I wanted the possibility of multi-line emphasis and emphasis w/in words)...
user39830's user avatar
0 votes
1 answer
60 views

How can I add custom keywords into Builtin Exceptions in python-mode to color them?

In python-mode, Exception keyword has font-lock-type-face for coloring. Example output of the coloring: If possible, I want to add custom keywords into Builtin Exceptions such as QuietExit, Terminate ...
alper's user avatar
  • 1,300
2 votes
1 answer
55 views

Lisp Mode Documentation Syntax color change?

I use emacs for common lisp development. I noticed that the documentation string for functions is white and makes it hard for me to read. Is there a way for me to change the color of this string? ...
Vinn's user avatar
  • 283
0 votes
0 answers
22 views

Consistent color for bindings in scheme-mode

Take a look at the following example: (define a (lambda (x) (define b 1) (let ((y 2)) #f))) Emacs 28.2 renders the above code in this way: This is inconsistent. define introduces ...
ceving's user avatar
  • 1,338
0 votes
1 answer
28 views

Highlight code between specified tags

how can I write extension for existing major mode, e.g. dart-mode to highlight block of codes. For example: // $done> import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:ui'; ...
Andrey's user avatar
  • 13
1 vote
1 answer
382 views

Change org mode's heading font size (like logseq) in respect of properties

I want my org file can be used in Emacs and logseq interchangeably (in pc Emacs, in mobile logseq) What I want is like logseq to have other properties for the heading text, like :PROPERTIES: :heading: ...
justakidd's user avatar
2 votes
2 answers
139 views

Disable Fontification in Org-Mode while Keeping Color Highlighting

I would like to ask a question about org-mode and font-lock-mode. I just started using Emacs and, since I am not a programmer, I use it mostly for writing and handling texts. And, I am quite ...
bman25's user avatar
  • 43
-1 votes
1 answer
52 views

new org-mode buffer with font-lock off

I am making a new buffer, then disabling font-lock. I use headings, I have noticed that they do not get coloured. Is this how things work ? Do buffers in modes with font-lock enabled always require ...
Dilna's user avatar
  • 1
0 votes
0 answers
80 views

font-lock-mode and printing in colour

After making a new buffer, font-lock-mode could either be enabled on disabled. For instance, if I use (text-mode) or (org-mode) will automatically enable font-lock-mode. However, for (fundamental-...
Dilna's user avatar
  • 1
2 votes
1 answer
67 views

Inserting coloured text in a buffer

I want to insert with colour properties. But when I try inserting in a new buffer, the colours get removed. (defun ticker-second (lampkl) "TODO." (interactive) (cond ((eq 'green ...
Dilna's user avatar
  • 1
0 votes
0 answers
32 views

Keeping specific comments with bold weight

I am using a bold typeface, but for comments I am using normal weight. But I would like that some specific comments to remain displayed with bold weight. The specific comments are those that start ...
Dilna's user avatar
  • 1
1 vote
1 answer
77 views

show binary value in different colors

Is there a simple way to show in emacs within an self-made-mode which use emacs font-lock-mode a binary value like "0b10010010" in different colors like the zero in lite gray and the one in ...
Lars's user avatar
  • 113
0 votes
1 answer
48 views

How can I change color of dollar sign different than font-latex-math-face in auctex?

In AUCTex, my font-latex-math-face has green color that also colors $ $ or \( \) into green as well. Here I just want to have different color for dollar sign than font-latex-math-face's Is it ...
alper's user avatar
  • 1,300
1 vote
3 answers
124 views

How can I avoid switching into font-latex-math-face in tikzpicture environment?

When I have text inside \begin{equation} ... \end{equation}, font-latex-math-face face is applied. If I have atikzpicture block inside equation, font-latex-math-face face is applied to it as well: \...
alper's user avatar
  • 1,300
1 vote
1 answer
187 views

Control font and color in spans of org-mode text?

I want to change the font and color of chunks of text in org mode, the way I can in OmniOutliner. Is it possible? Using the markdown or some other method. Screenshot of my emacs, in org-mode: In the ...
Rob N's user avatar
  • 587
1 vote
1 answer
116 views

Highlight org headline text only if org-level is less than 3 and has-children

This is a follow up to this question, which already has an accepted answer here. I have (setq org-level-color-stars-only t) to highlight only the stars in org-mode headings. Following this answer I ...
Inspired_Blue's user avatar
0 votes
1 answer
85 views

Highlight org-level-color-stars-only from org-level-2 onwards

Following this answer I have (setq org-level-color-stars-only t) to highlight only the stars in org-mode headings. However I want to further customize the heading coloring. In particular, I want to: ...
Inspired_Blue's user avatar
1 vote
1 answer
57 views

How to describe all faces at point?

When I do M-x describe-face, the default face is, according to the doc, "the faces of the character after point" However, looking at the *Fancy Diary Entries* buffer, I see many different ...
sds's user avatar
  • 5,958
0 votes
0 answers
36 views

How can I load font-lock-add-keywords on restart?

I use desktop session. Every time I restart my TODOS won't appear unless I kill the buffer and open it again. ;; SESSION (setq desktop-save-mode t desktop-save t desktop-save-buffer t ...
ritchie's user avatar
  • 151
0 votes
1 answer
27 views

comments are not highlighted with numbers in derived mode of prog-mode

It seems if the major mode is derived from prog-mode, a comment line will not be highlighted as a comment if it contains any numbers surrounded by blank spaces. The content of tt-mode.el (setq tt--...
Zheng Qu's user avatar
  • 123
1 vote
0 answers
47 views

Highlight variables/functions in commens of all prog-modes

In lisp-mode, strings inside comments that are encapsulated by `' are highlighted with font-lock-constant-face. How can I make all prog-mode-derived modes do that by default?
Atemu's user avatar
  • 290
3 votes
1 answer
167 views

Regular expression too big

Working to create my own major mode for sqf language (arma3 scripting) I get this error: Error during redisplay: (jit-lock-function 1) signaled (invalid-regexp "Regular expression too big") ...
xbelanch's user avatar
  • 131
0 votes
1 answer
104 views

Python-mode font-lock: change the color of the equals sign in function keyword assignments

In Python, keyword arguments passed to functions can take the form of "keyword"="value", such as in this example: some_function(somearg="foo", someotherarg=True) I'm ...
mhucka's user avatar
  • 163
0 votes
1 answer
202 views

Is it possible to use LSP for font-lock or indentation?

I'm writing C++ and running into problems with font-lock-mode often getting confused by more obscure language features (e.g., operator""_ud). I also find that indentation doesn't work very ...
user3188445's user avatar
0 votes
1 answer
168 views

How to properly use a regex for font locking

I'm stuck with a specific problem, I'm writing a major-mode for a language that supports multiple assignment, meaning that: let s = 9 let x, y, z = 1, 2, 3 var k = 11 var a, c = 4, 5 Are all valid ...
Nathan Furnal's user avatar
1 vote
1 answer
98 views

adding highlight to parts of a regexp

I am pretty new to emacs so please excuse the rookie question. So I am editing a helm chart template, and have enabled yaml-mode since most of helm uses yaml. but I wanted to add some highlighting to ...
munHunger's user avatar
  • 125
0 votes
2 answers
34 views

Customisation for comment delimiter colour based on light or dark theme

I would like to adapt the emacs customisation for comment delimiter colour to change according to light or dark background. How is this customarily done? (defun annot () "Customisation for ...
Dilna's user avatar
  • 1

1
2 3 4 5
7