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.

71 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10
votes
0answers
200 views

How to investigate "color bleeding"?

I frequently have color-bleed issues in emacs, most often with AUCTeX: all of a sudden and for no apparent reason, the line I'm writing will be fontified as math. First things first: no, I do not ...
6
votes
0answers
108 views

Code blocks in font-lock comments

I'm developing a major mode for a language that has doc comments. They look like this: (** Foos three bars. Better call this as [foo 1 b c]. Though of course [foo a b 1] works as well. **) ...
5
votes
1answer
202 views

Syntax highlighting is breaking in long bibtex files (spacemacs bibtex layer)

So I have a long papers.bib bibtex file that I edit with emacs (spacemacs bibtex layer), but the syntax highlighting only ever goes about halfway down. Here it is at about line 790: Other times this ...
5
votes
0answers
87 views

How to replace a character display only for the `italic` face?

I am using a font that does not include italic characters. However, it does include characters like mathematical italic small a, which I would like to use instead. I can set up a display-table that ...
4
votes
0answers
366 views

"Invalid face reference: linum" even load linum after make frame

I want to have line number at buffer, but when I use Emacs server, the Message buffer display the following error: Invalid face reference: font-lock-comment-delimiter-face [2 times] Invalid face ...
3
votes
0answers
49 views

deeply nested loops and conditionals

I am refactoring legacy code. Looks like: for (int i = 0; i < something.length; i++) { .... .... lots of code here .... if (a.good != b.bad) { .... .... .... ...
3
votes
1answer
408 views

Smarter and more efficient way to add font lock keywords to org-mode?

I really hate looking at raw markup in org-mode documents, so I am trying to replace as much of it with symbols as possible. So #=begin_ becomes {, src becomes some-glyph etc. My current approach ...
3
votes
0answers
77 views

Is it possible to have conditional font locks?

For example, I want to use font-lock-add-keywords highlight some keywords in source code. But the font lock system would also highlight the same words (anywhere) in the comments/docs/strings part of ...
2
votes
0answers
81 views

How to make orgmode decorate quotes?

Org mode decorates some parts of text (like section headers with yellow), but I'd like to add other ones such as double quotes (such as strings when I am editing Lisp code).
2
votes
0answers
574 views

Markdown and Latex highlighting (font lock) in R Markdown file

I am using polymode to edit rmarkdown files. Exporting to e.g. pdf is super simple and works very well. R code chunks are also properly highlighted. But: I do quite often use latex code inside (r)...
2
votes
0answers
34 views

Why does setting the 'face property trigger fontification?

I'm trying to write a major mode for a programming language with JSX based syntax. Here's a minimal implementation. (defun example-forward-parse-jsx (start-pos limit) "Move point past the JSX ...
2
votes
0answers
150 views

Make text Invisible with font-lock-keywords

I'm interested in changing my org-mode buffers to have a better looking logbook. My ideal state to end up in is that text that looks like this: - State "WAITING" from "WAITING" [2018-11-16 Fri ...
2
votes
0answers
200 views

org-pretty-entities for markdown-mode

org-mode has the variable org-pretty-entities that allows for the display of LaTeX math as unicode characters. How could one get the same result in markdown-mode? It seems like this should be a ...
2
votes
0answers
192 views

Output of ipython shell much slower than python shell

Even turning off font-lock-mode and set (setq python-shell-font-lock-enable nil), the output of an ipython shell (setq python-shell-interpreter "ipython") seems much slow than the python shell (...
2
votes
0answers
256 views

Faces vs. font-lock faces

What is the relationship between the "basic" faces defined in faces.el and "font-lock" faces in font-lock.el? My initial impression was that basic faces, like bold and fixed-pitch, are based on style ...
2
votes
0answers
60 views

Can I reuse Org's syntax highlighting in LaTeX mode?

Org-mode has a magical org-src-fontify-natively setting. With this on, org highlights each code snippet using the corresponding mode's font-locking support. Can I use this in LaTeX-mode? It would ...
2
votes
0answers
69 views

Changing background color based on first character on line

How can I change the font background based on the first character on a given line? Take for example: (set-face-attribute 'marker-2 nil :background some_function) where some_function returns "blue" ...
2
votes
0answers
421 views

Emacs/ESS/Org hangs/spins on yank

I have the following Emacs org buffer that I'm editing: #+BEGIN_SRC R regimes <- read.spreadsheet(wlda, 3) %>% within({ TurbineID <- paste(Site, Turbine) Date.of.Change....
2
votes
0answers
386 views

Is there a way to suppress errors in the *Messages* buffer?

I have a persistent problem with some jit-lock-function somewhere whenever I compile. I'm actually invoking the visual studio compiler, and I assume some of the output is somehow abhorrent to emacs. I ...
1
vote
0answers
40 views

Why is it called "Font Lock" mode?

Just wondering, because ... The function of font-lock-mode is to programmatically un/assign a given typeface or typeface font to text. But it's just an assignment, which can be easily overridden; FLM ...
1
vote
0answers
33 views

Additional keyword fontification

How do I add fontification of additional keywords ? This does not work: (add-hook 'c++-mode-hook (lambda () (font-lock-add-keywords nil '(("^\\(trn\\|def\\|mem\\)\\>" . 'font-...
1
vote
1answer
52 views

How to highlight without one rule breaking another (font-lock-add-keywords)

I have 2 rules and the second one highlighting text disables the first... (font-lock-add-keywords 'org-mode '(("^rtfm .*$" 0 '(:foreground "red")))) (font-lock-add-keywords 'org-...
1
vote
0answers
34 views

How to remove fringe when copying from emacs?

When copying from emacs buffers in a terminal to other application, I grab the region and copy them and paste it onto another application. The copied text has a leading whitespace in each line ...
1
vote
0answers
23 views

Is it possible to have different color values for a font-lock face in a string?

My font-lock-warning-face has a red color. Which works well in almost all circumstances, it is very pronounced. The problem is, my font-lock-string-face has orange color. So warnings inside strings ...
1
vote
0answers
75 views

Problem with font in markdown-mode table

I am using variable-pitch for markdown-mode. Tables use fixed-pitch (markdown-table-face). The table aligns for regular text. It breaks alignment for links. The spaces are also underlined. ...
1
vote
0answers
28 views

Incorrect font locking/syntax hightlighting in c-mode

I've recently started using Emacs, and I'm having a problem with the font-locking in c-mode. I'm using the Monokai theme, and I'm finding that some tokens are being coloured incorrectly. The problem ...
1
vote
1answer
51 views

can show-trailing-white-space be forced to ignore blank lines

I'm trying to use the flag show-trailing-white-space and it usually shows me what I want. I.e., I never want dangling white space at the end of a line containing text. However, between lines of text,...
1
vote
1answer
169 views

Improving org-block-begin-line, splitting in several faces

The face org-block-begin-line allows to customize the first line of the following block #+BEGIN_SRC lang :var arg1=1 arg2=2 ... #+END_SRC However, I would like to customize the faces within the line,...
1
vote
0answers
55 views

EMACS doesn't grey out comments

When I comment out code with combination of /* and */ in JavaScript nothing happens with text and it stays the same color. (You can see it in second part of code, one that is not grayed out but is ...
1
vote
0answers
59 views

Enable `cc-mode` documentation highlightning per minor mode

I am writing a minor mode for enabling support for JML within Java files. I realized the syntax highlighting with cc-mode's support for documentation comments. It works if I set c-doc-comment-style ...
1
vote
0answers
250 views

Fix org-mode agenda highlighting

I'm having an issue with highlighting in Org agenda: Can't make the link and tags Gray when the item is marked as Done. I've tried to play with different properties of the font-lock definition, but ...
1
vote
0answers
128 views

No font lock in org-mode

When I the first time enter an org-mode buffer, I get no font lock at all unless I revert-buffer or reopen the file. Even I turn on the debug mode, no error is emit. How should I debug and fix this?
1
vote
0answers
56 views

Font-locking for text inside org-mode COMMENT blocks

While other sorts of #+BEGIN ... #+END blocks seem to get font-locking applied to them (potentially changing foreground and background colours etc.), #+BEGIN_COMMENT ... #+END_COMMENT blocks do not. ...
1
vote
0answers
40 views

`htmlize` not taking CIDER font-locking into account

I'm using htmlize to give Org-mode code blocks syntax highlighting when exported as HTML, but the exported code only captures some of the font-locking. In particular, for Clojure, it does not capture ...
1
vote
0answers
141 views

How to highlight fragments of source and example blocks within an org-mode buffer itself

This is a variation on the theme of How to <mark> code fragments in org-export. Here the question is about making portions of src and example blocks stand out (preferably without breaking the ...
1
vote
0answers
458 views

How can I dynamically set the column width that I'd like to font-lock?

My init currently has the following: (defun font-lock-width-keyword (width) ...
1
vote
0answers
56 views

derived mode for Pandoc Templates

I am trying to derive mode based on Sample Mode. Reduced contents here: ;;; pandoc-template.el --- Pandoc-Template major mode ;; Copyright (C) 2017 ;; Author: VaclavHaisman ;; Keywords: extensions (...
1
vote
0answers
97 views

Drunken font lock in a long-running session

I'm running the emacsformacosx.com build of Emacs 25.2.1 in daemon mode. I connect to it through emacsclient invoked from various tmux sessions in macOS Terminal. $TERM is xterm-256color. The daemon ...
1
vote
0answers
32 views

Cperl font lock regions in here docs

I am having a problem in cperl-mode described in this question. Basically inserting a newline at the start of a line in here doc in cperl-mode is breaking the syntax highlighting. One of the answers ...
1
vote
0answers
85 views

Remove the left font lock of flyspell after uncomment

I use flyspell-prog-mode, and quite often I comment a region, the source code was checked, and the font lock of dirty words will left after I uncomment the source code. How can I fixes this? Thanks ...
1
vote
0answers
156 views

Fontification by AUCTeX is great, but font locking for ConTeXt code, any idea?

I wasn't sure where to post this question, but I count on the Emax community when it comes to font-locking and fontification. We all know that AUCTeX is the way to go when writing a document in LaTeX,...
1
vote
0answers
406 views

org-mode fontification error

Since some time ago I've been having this message: org-mode fontification error whenever I initialize org-mode by opening an org buffer. The initialization process will just get stuck and I have to ...
0
votes
1answer
17 views

How to replace one face with another for propertized text?

Text with properties can have faces assigned, how can one face be replaced with another? An example use case for this is highlighting some text or it's background. Seeing as Emacs doesn't have the ...
0
votes
1answer
21 views

Disabling syntax highlighting for specific keywords baked into an optimized regexp

I'm working on a project in Racket, and the syntax highlighting in Emacs' racket-mode is becoming an issue for me. Racket is a highly modular language, and one of the modules that I am not using ...
0
votes
1answer
30 views

Emacs 28 and python-mode the syntax font-lock-mode seems all off

I wanted to upgrade to emacs 28 to get f-strings support in python but the font-lock.... seem to be all messed up. Sometimes it works as in the past but sometimes it doesn't like why is ...
0
votes
0answers
18 views

What makes the font-lock face of a variable appear and disappear when buffer text is modified?

I am looking into improving electric behaviour and stability of the syntax colourization of Erlang code done by the erlang-mode of erlang.el. While looking into this I noticed that the colorization of ...
0
votes
1answer
14 views

How to custom-set-faces with one of the named faces?

I can do this: (custom-set-faces '(j-verb-face ((t (:foreground "Red"))))) But what I want is to set the color to one that is theme-dependent. I tried the following, which causes a "...
0
votes
0answers
12 views

Tone down the bracket match highlighting in LaTeX mode

The LaTeX highlighting is great, but I don't like the way every bracket pair is highlighted — and in such a garish colour. Any thoughts on how to tone this down a bit?
0
votes
0answers
48 views

Highlighting all matched groups in font-lock-add-keywords rule

I'm trying to highlight variable-type in custom let-like form that looks like: (mylet ((<variable-type> <variable-name> <variable-value>) (...)) <some-forms>) To do ...
0
votes
0answers
22 views

Suddenly incorrect fontification of newlines

When a font style is applied to the newline character, certain styles - such as background colors - normally are extended to the end of the visual line. Suddenly this has changed for me, and the fonts ...