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
1
vote
1 answer

Syntax for adding/removing font-lock keywords in Emacs

Most of what I do with Emacs is in perl, and for that cperl-mode is mostly excellent; the one major annoyance is that a simple my $whatever introduction is given the property font-lock-keyword-face, which nixes the advantage of having keywords pop. …
Amory
  • 758
  • 2
  • 19
  • 31
1
vote
2 answers

Context-sensitive discontinuous font-locking in Emacs

Im trying to setup font-locking for a major mode. Here is some example code: USING: foo bar bar ; IN: fuelcolors TUPLE: font < super-class name size bold? italic? { foreground initial: COLOR: black } { background initial:…
Björn Lindqvist
  • 19,221
  • 20
  • 87
  • 122
1
vote
1 answer

dired-do-search does not use isearch-face

How can one have dired-do-search use the more visible isearch-face, or at least highlight the entire token found? A blinking cursor would be an alternative, if it weren't so distracting while editing. Restatement If I run isearch-forward on the…
Calaf
  • 10,113
  • 15
  • 57
  • 120
1
vote
3 answers

How to fix a font-lock regex in emacs that is not successfully matching

I'm trying to make a regex in emacs to font-lock tasks, projects and notes in taskpaper files. Taskpaper is a simple text based format for task management, with the following format: Project 1: - Task 1 - Task 2 Note about Task2 …
Daniel Neal
  • 4,165
  • 2
  • 20
  • 34
1
vote
1 answer

EMACS, Function call highlight

(EMACS 24.2 ) I need to highliight function call. I found this on internet (add-hook 'c-mode-hook (lambda () (font-lock-add-keywords nil '( ("\\<\\(\\sw+\\) ?(" . 'font-lock-function-name-face))t))) It works but it highlight also the…
Mario Giovinazzo
  • 431
  • 2
  • 12
0
votes
0 answers

Configure javadoc font face in emacs c-mode

I'm having trouble getting emacs to recognise a block comment as javadoc (for Doxygen-style comments) in a C file: emacs -q M-x emacs-version is 24.0.92.1 (i686-pc-linux-gnu, GTK+ Version 2.24.7) of 2011-12-21 Add the following to a c-mode…
Ben
  • 1,339
  • 1
  • 11
  • 15
0
votes
2 answers

Emacs: How to add a new face to dired

I'm trying to extend Dired in emacs 26 windows to show junctions similarly to symlinks. I've got everything done except I can't get the junction file name part to be fontified. Here's what I've done so far: (defface dired-junction '((t (:inherit…
pbpb
  • 11
  • 2
0
votes
1 answer

Haskell files are not recognize by `haskell-mode`

I am fairly new to Emacs - transitioning from Neovim. I have the following line in my config file: (use-package haskell-mode) When I open any Haskell file, I see no effect, e.g., no syntax highlighting and in the lower right corner it says my major…
Refael Sheinker
  • 713
  • 7
  • 20
0
votes
1 answer

Emacs php-mode font-lock properties are not applied to certain chars

For example variable dollar signs. php-mode.el line 1087: '("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)" (1 font-lock-variable-name-face)) ; $variable If I'm not mistaken the regexp should match $variable including the dollar sign. Now, i'm trying to figure out…
0
votes
0 answers

font-lock-comment-face to a Strong Color

If I describe-face over a strong color in Emacs, it tells me that its foreground is #ffd700, but when I eval this: (set-face-attribute 'font-lock-comment-face nil :foreground "#ffd700") ..it has a grayed out yellow color;) See screenshot…
Jason Hunter
  • 495
  • 1
  • 4
  • 11
0
votes
1 answer

Is it possible to inhibit font-locking for a specific buffer region?

In a follow-up question to my previous question, is it possible to inhibit font-locking for a specific region in a buffer? I've looked through the special text properties portion of the manual, but couldn't find any properties that appeared to…
Rorschach
  • 31,301
  • 5
  • 78
  • 129
0
votes
1 answer

emacs automatically highlight *E *F etc and highlight to EOL

I am trying to build my major mode for syntax highlighting log files from a certain tool flow. and I've been using this excellent guide to get started http://ergoemacs.org/emacs/elisp_syntax_coloring.html but I would like to highlight "*W", "*E" and…
rasmus
  • 125
  • 2
  • 3
  • 11
0
votes
1 answer

Emacs highlighting: how to deal with highlighting messed up by unusual usage of special characters?

Problem: In Emacs configuration modes (e.g. conf-xdefaults-mode or conf-space-mode), some special characters are used in unusual ways, for instance when they define keybindings. This messes up the highlighting for the rest of the…
prosoitos
  • 6,679
  • 5
  • 27
  • 41
0
votes
1 answer

Emacs change color for variables in java mode

How to customize already defined color scheme in emacs. In my case, i have a java mode. I know how set background, or how set color to comments, but what should I do, to redefine color for variables only? In the best case I expect that I can move to…
user8138907
0
votes
0 answers

How to write a regex that allows a comment at the end of line without turning off font-lock for the line in an Emacs major mode

I'm trying to write a regex for a font-lock command. I want the font-lock to apply to all characters following '!', until the end of line or a comment, starting with '#', but the font-lock is turned off for the whole line after I enter any…
Hessu
  • 49
  • 6