Skip to main content

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

Help with `font-lock-add-keywords` regex for org keywords

I am trying to add my own org 'document keywords' with my own faces. I am referring to the keywords sitting at the top of the file like #+title: My Tile for example which get their own faces. Thanks ...
lyndhurst's user avatar
1 vote
1 answer
30 views

Using font-latex-user-keyword-classes

I'd like to add a few faces that should be used to color macros and commands in LaTeX-mode. Following the documentation, I found the variable font-latex-user-keyword-classes, which is supposed to do ...
Alexander Praehauser's user avatar
0 votes
0 answers
12 views

Disable web link highlighting on comment

I noticed that every time I write a golang comment containing a web link, it highlights the link even though it shouldn't be highlighted. The comment font face should have a higher priority, is this a ...
ranu's user avatar
  • 163
0 votes
0 answers
67 views

Color bleeding and polymode

I sometimes experience "color bleeding" in auctex, and wasn't able to find the source of the problem for a long time. In particular because I wasn't able to reproduce the issue. I also can't ...
student's user avatar
  • 1,159
1 vote
1 answer
37 views

How can I disable font-lock-mode but have the whitespace mode highlighting

Is there any way to disable syntax highlighting of the buffer (which I do by disabling the font-lock-mode) and having the trailing whitespaces highlighted in red? or at least show a unicode dot? (When ...
ali b's user avatar
  • 193
2 votes
1 answer
37 views

Highlight prettified code

is there a way of highlighting a prettified phrase? Something like: (push '("\\qquad " . "⧢") prettify-symbols-alist) (highlight-phrase "⧢" 'shadow) (highlight-...
Alois Pichler's user avatar
0 votes
1 answer
34 views

How to insert fontified git diff output into Emacs buffer?

I wrote this code: (defun compare-string-test (String1 String2) (interactive) (let ((Temp1 (make-temp-file "gitdiff" nil nil String1)) (Temp2 (make-temp-file "gitdiff" ...
Gabriele's user avatar
  • 1,680
0 votes
1 answer
53 views

Is there an efficient way to fontify matches of thousands of different strings in a buffer?

I have a list of thousands of different strings made up of different numbers of words (e.g. names of specific people) that I would like to fontify in a buffer. Some applications I could use for ...
John Kitchin's user avatar
0 votes
1 answer
53 views

Loss of latex-mode Fontification When Loading Libraries in latex-mode-hook That Require json-mode

My actual scenario involves using latex-mode-hook to load some libraries that require json-mode. I replicated my issue in a MWE: I have a LaTeX file: \documentclass{article} \usepackage{mwe} \begin{...
Gabriele's user avatar
  • 1,680
0 votes
1 answer
48 views

"unspecified-fg/bg" in "batch mode" when querying foreground/background colors

While writing tests for color-identifiers-mode I stumbled upon inability to make Emacs load background and foreground colors from a theme in "batch-mode". Example: emacs -batch --eval "(...
Hi-Angel's user avatar
  • 858
1 vote
0 answers
137 views

How to keep existing text-property decoration while using font-lock?

I tried to use text-property to decorate specific texts as well as automatically color tab characters in a text-mode buffer, but didn't find a way to realize them at the same time. This is my try: ...
yos's user avatar
  • 11
1 vote
2 answers
64 views

How to have Emacs display different text from that stored in buffer?

How can I get a buffer to display text that is different from the text stored on disk, updates as the buffer is modified, and replaces one string with another string every time it occurs? I'd like a ...
eppo's user avatar
  • 21
0 votes
0 answers
20 views

Is there a way to italicize cpp's methods and fields?

When I use vscode, I find that CPP's in-class fields are italicized and local variables are normalized, which allows me to easily distinguish between them For example, I can clearly tell that thread ...
Thysrael's user avatar
0 votes
1 answer
459 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
124 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
89 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
77 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
49 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
1 answer
26 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
4 votes
2 answers
762 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
  • 9,027
0 votes
1 answer
75 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,872
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
1 answer
52 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
  • 151
2 votes
1 answer
70 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
  • 5,795
1 vote
2 answers
505 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
  • 389
0 votes
2 answers
70 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
  • 389
0 votes
1 answer
54 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
  • 858
2 votes
1 answer
56 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
  • 748
0 votes
1 answer
125 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
0 votes
0 answers
59 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 ...
oOosys's user avatar
  • 475
0 votes
0 answers
69 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
  • 177
0 votes
1 answer
137 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,110
0 votes
1 answer
79 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,420
2 votes
1 answer
80 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
  • 303
0 votes
0 answers
23 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,388
0 votes
1 answer
29 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
733 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
289 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
61 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
97 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
104 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
37 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
85 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
84 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,420
1 vote
3 answers
181 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,420
1 vote
1 answer
366 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
  • 691
1 vote
1 answer
154 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
117 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
94 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
  • 6,174
0 votes
0 answers
38 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
  • 169

1
2 3 4 5
7