Questions tagged [font-lock]

Font-lock is a minor mode of GNU Emacs. It assigns faces locally to a particular buffer.

Font Lock mode is a minor mode of GNU Emacs. Font Lock mode is:

always local to a particular buffer, which assigns faces to (or fontifies) the text in the buffer. Each buffer's major mode tells Font Lock mode which text to fontify; for instance, programming language modes fontify syntactically relevant constructs like comments, strings, and function names.

Font Lock mode is enabled by default. To toggle it in the current buffer, type M-x font-lock-mode. A positive numeric argument unconditionally enables Font Lock mode, and a negative or zero argument disables it.

[section 14.12 Gnu Emacs Manual]

111 questions
2
votes
1 answer

Elm Markdown Block Highlighting

Is there an off-the-shelf solution for highlighting the [markdown| ... |] blocks in Elm code? At the moment I'm using haskell-mode to edit Elm files, and have two-mode-mode hooked up to switch to markdown-mode when I enter an appropriate block…
Inaimathi
  • 13,853
  • 9
  • 49
  • 93
2
votes
2 answers

Problems with emacs syntax highlighting for python programs

I am using python-mode for syntax highlighting. Everything is fine except the highlighting of docstrings, which makes reading code in github repositories with complex docstrings very difficult to do. Here an example: class DoubleQuotesDocString: …
blueFast
  • 41,341
  • 63
  • 198
  • 344
2
votes
3 answers

Finding out which regexp caused a specific face in Emacs

I am trying to find out which regexp causes the connect to be highlighted in this cperl-mode buffer. describe-face tells me this is a font-lock-type-face. After having a look at font-lock-keywords-alist and font-lock-keywords I dont't see where this…
Kungi
  • 1,477
  • 1
  • 18
  • 34
2
votes
2 answers

Apply face color basing on the colomn number

There are so-called strict formats, like pdb - where the meaning of the symbol is defined by the colomn number of the symbol. For example here is a specification of the above mentioned pdb format. Is there a way I can apply face colour basing on the…
Adobe
  • 12,967
  • 10
  • 85
  • 126
2
votes
1 answer

Font-locking based on top-level s-expression keyword

I'm writing an emacs major mode for a programming environment which supports two slightly different programming languages. Both are lisps (one is Scheme), so both use s-expressions. The two languages are differentiated by their function definition…
Ben
  • 843
  • 8
  • 21
1
vote
1 answer

How to customize c-doc-comment-style to use reStructuredText as documentation comment style?

Emacs uses c-doc-comment-style to specify the documentation comment style to use in cc-mode. I'd like to use reStructuredText, or rst, for documentation comments. There's an rst-mode for reStructuredText files, with rst-font-lock-keywords, but I…
Jani
  • 853
  • 8
  • 20
1
vote
2 answers

Change face of plain text between double quotation marks in Emacs

I am looking for a way to highlight or use different face of quoted text in plain text. It seems that there should be a sophisticated/enhanced text mode but I cannot find it. If there isn't a easy solution, can you let me know where should I begin…
lenient7
  • 13
  • 2
1
vote
1 answer

Emacs: font-lock-fontify-region and multiline

I am writing a minor mode for php/html files. I use a function (cf. font-lock-keywords) to fontify blocs. In order to fontify multilined blocs, I need to set font-lock-multiline to t. Everything is running quite nicely. Their is just a…
fxbois
  • 806
  • 9
  • 21
1
vote
1 answer

Emacs regexp and syntax highlighting

I want to highlight some words (ex. "true", "false"), but only when they are between the tags . In the example below I only want to highlight the second "true" keyword: Is there any…
fxbois
  • 806
  • 9
  • 21
1
vote
2 answers

Current line highlight (hl-line) does not respect existing highlights

I am trying to configure hl-line or hl-line+ in emacs to respect the existing highlights/text background colors in the buffer. I have configured hl-line in ~/.emacs as follows: (require 'hl-line) (global-hl-line-mode 1) Then I highlight the symbol…
ed56
  • 11
  • 2
1
vote
2 answers

Unknown number of matches in regex and font-lock

I am trying to use font-lock and elisp's regex to highlight something like this: class Foo implements A, B, C, D { } The problem is unknown length of comma separated list after implements. I've already done regex which highlights all words on list…
Grzegorz Rożniecki
  • 27,415
  • 11
  • 90
  • 112
1
vote
1 answer

How to highlight my own syntax in Emacs?

I am developing my own Domain Specific Language (DSL) and the filename extension is .xyz. Emacs doesn't know how to highlight syntax in .xyz files so I uausally turn on typescript-mode or json-mode. But the available syntax highlight mode is not…
Yixing Liu
  • 2,179
  • 1
  • 20
  • 36
1
vote
1 answer

how to highlight elisp macro argument?

when I use "use-package" macro in emacs lisp, I found that the argument is highlighted. but argument of my own macro is not highlighted by emacs. How to write a macro with highlighted arguments?
SamsonWang
  • 13
  • 5
1
vote
1 answer

function using font lock functions requires restarting font lock mode

I am confused about how font lock mode gets engaged. I do not have a statement that launches font lock mode in my init.el, but apparently it always runs as a minor mode. Furthermore I have the following function: (defun testregexfunc () …
lo tolmencre
  • 3,804
  • 3
  • 30
  • 60
1
vote
0 answers

c-mode single quote fontification

I just noticed that single quotes are being font-locked with warning face, throwing off fontification of the entire buffer. Does anyone know why this is is happening? For example, #include int main(int argc, char *argv[]) { if (…
Rorschach
  • 31,301
  • 5
  • 78
  • 129