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
1answer
114 views

Revert `font-lock-face` changes

I have a custom face defined as (defface my-underlined '((t (:underline "red"))) :group 'my-group) At some place I underline some words with something like (add-text-properties (match-beginning ...
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
1answer
261 views

How to syntax-colour py.test output?

In compilation-mode (or some similar mode), how can I make the default py.test output be colourized? I'm not talking about clickable links, but about just 'syntax' colouring the various parts of the ...
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 ...
0
votes
1answer
513 views

Changing font of non-monospace text in Emacs

I see variable and function names in Info pages rendered with a different font in Emacs recently, how can I change this font? For example, here ^ this-comamnd and last-command are in a font. I would ...
1
vote
2answers
112 views

Cperl-mode syntax highlighting breaks when inserting a newline into a here doc

in cperl-mode, here docs are colored with a font-lock-string-face. However if you used any function that inserts a newline on a blank line (e.g. M-: (insert "\n")) it will cause all code after the ...
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 (...
3
votes
1answer
770 views

Adding new commands to the syntax highlighting of a language mode

I am working on a corporate installation. They have emacs, and it has tcl mode. The issue is that the command lassign is not highlighted, unlike, for example, set, or return. What that I would like, ...
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
1answer
91 views

How to use text-properties in a lambda function

I wish to map the text properties onto a list and them insert them on a new buffer. For some reason the following snippet doesn't work. I've used the -map utility from dash.el package for the map. ...
0
votes
2answers
548 views

Change color of specific text in files

Was wondering if anyone knew of a way to go into the .emacs file and add an attribute to change the color of a specific string in all files it appears. The specific example I wish to use this for ...
4
votes
1answer
467 views

Fontify org quote blocks with font-locked markup

I have org-fontify-quote-and-verse-blocks set to t and '(org-block ((t (:foreground "#2E8B57")))) to make quote blocks stand out in a particular color. However, this also means that I cannot get ...
1
vote
2answers
337 views

Preventing font-lock string match from going past end of line

I have a custom mode to highlight my log files. In it, I attempt to highlight strings that are surrounded by double quotes("[^"]*"). In the files, there are sometimes lines with an odd number of ...
0
votes
1answer
24 views

Fonts appear in different color in buffer

When I write a big text exceeding the window bounds when starting Emacs the fonts appear in other color than the rest. If it makes any good to mention, when I disable font-lock mode text appears in ...
0
votes
1answer
410 views

Using font-lock regexp groups

(defun pretty-add-keywords (mode keywords) (font-lock-add-keywords mode (mapcar (lambda (kw) `(,(car kw) (0 (prog1 nil ...
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 ...
1
vote
1answer
391 views

Add text property, when global-font-lock mode is on

I am trying to set the foreground color for first line in my buffer which has global-font-lock ON. Buffer contents - (ignore) (add-text-properties 1 8 '(:...
1
vote
1answer
697 views

Syntax highlighting using Emacs

I'm creating an elisp file based on http://ergoemacs.org/emacs/elisp_syntax_coloring.html from this site. My updated code is shown below ;;; MOD5-mode.el --- sample major mode for editing MOD5 ...
1
vote
2answers
491 views

Customize haddock comments color

How can I change the color of the comments starting with -- | in Haskell mode? When I write a comment in Haskell I get a grey face, but when the comment starts with -- |, as required by Haddock ...
0
votes
0answers
224 views

font-lock problem of c++ mode

I recently notice that there's some strange behaviours of the font-lock of the c++-mode. Let's start emacs by emacs -Q in the terminal, edit a new file test.cpp and save the following contents Then ...
2
votes
1answer
299 views

Why do some faces not work with font lock mode expressions?

I'm trying to learn about font locking in my own custom major modes. I can get things working fine for the most part, keywords highlighted, regexp-opt matching strings, using capture groups within a ...
2
votes
1answer
756 views

What code is font locking quoted strings in my custom mode buffer?

I'm experimenting with making a major mode that does some simple syntax highlighting. My keywords are being highlighted just fine, but the quoted string in the example below is also being highlighted ...
1
vote
1answer
69 views

How to font lock the second token on a line of tokens

I'm trying to font lock some tokens in a simple text file, without picking up adjacent tokens. For example, here are some example lines that I have been working with: name: foobar (&optional arg1 ...
1
vote
1answer
285 views

Make my font lock config only highlight my keywords when they are upper case

I've got a font lock config that I use to add certain helpful keywords to various modes of my choosing: (defun my-font-lock-keywords (mode) (font-lock-add-keywords mode '(("\\<\\(...
1
vote
1answer
119 views

How to fontify grep output displayed in a help window

I wrote a function to show me a list of all defuns in the current buffer. The output is syntactically incorrect Lisp code (if you can even call it Lisp code, being syntactically a mess). Here's what ...
3
votes
4answers
861 views

How can I improve ansi-color rendering performance?

Previously I posted this question to Stack Overflow regarding rendering ansi-colors. The tip worked but performance very bad; when I open a 15 MB log file, emacs just locks up. I decided to try ...
3
votes
1answer
992 views

Override c++-mode font lock

I am improving the C++ highlighting in Emacs with the minor mode: modern-cpp-font-lock. Consider this following C++14 code: int main() { int i = 1'2'3l; } From cppreference.com Optional single ...
3
votes
1answer
462 views

How to fully fontify latex snippets including subscript and superscript within org-mode

I have many latex snippets delimited by $ inside my org notes. I recently discovered org-highlight-latex-and-related, which highlights latex snippets a certain face. However, I want to also apply the ...
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,...
3
votes
1answer
133 views

No fontify in ledger source block

I cannot make it show syntax in the org-mode ledger block. It is just shown with plain text. But if I bring it to the edit buffer, it displays the syntax properly. Can anyone help me to trace this ...
9
votes
1answer
407 views

Make consistent syntax highlighting of LaTeX source blocks

Org manual's solution for syntax highlighting of org-babel code blocks is to turn on native fontification with (setq org-src-fontify-natively t) works well for LaTeX code enclosed in blocks with #+...
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 ...
5
votes
0answers
660 views

Ways to make Emacs feel snappy as Vim? [closed]

When I switched to Emacs from Vim, I really loved the extensibility of Emacs. But compared with Vim, Emacs still feels somewhat sluggish. Especially when I moved my pointer/cursor around, and typing ...
1
vote
1answer
890 views

How to get fixed-pitch code blocks in variable-pitch Spacemacs org-mode?

I like to use variable-pitch mode when working with prose in org-mode, but I have to turn it off when I involve tables or code blocks. Using answers found elsewhere, such as https://stackoverflow.com/...
0
votes
1answer
88 views

Programming syntax highlighting and validation when regex is not sufficient?

I am proficient in developing basic syntax highlighting modes based on font-lock-defaults and regex (even with font-lock-multiline and font-lock-extend-region-functions). Today I faced with format of ...
1
vote
2answers
348 views

How to prevent font-lock from being lazy?

Related to this question. Here's my current font lock setup for python-mode: (require 'org) (defconst lpy-font-lock-keywords '(("^#\\(\\* .*\\)$" 1 'org-level-1 prepend) ("^#\\(\\*\\* .*\\)$" ...
10
votes
2answers
656 views

How to add complex syntax highlighting in a minor mode?

I'd like to highlight code with various faces in a minor mode. Here's a screenshot that's close to what I want: One thing that I'm missing is having the comment chars # in font-lock-comment-face. ...
7
votes
1answer
615 views

Line highlighting canceling out syntax highlighting

I use hl-line-mode and I really like the built-in misterioso theme. However, the way that lines are highlighted with this theme cancels out syntax highlighting or any other properties of the ...
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 ...
1
vote
1answer
240 views

setting comment face in major mode on multi-line word-delimited comments

I am working on a major mode for an input file format I am interested in and want to set multi-line comments with the delimiters skip and noskip like skip larb noskip or skip GRID TYPE ...
0
votes
1answer
91 views

Function call inside mode hook has no effect but manual execution of function from buffer works

I use AucTeX as my latex major mode. I have been trying to setup the minor mode latex-pretty-symbols which is available from melpa. I did: ;; Install from package-list-packages (require 'latex-pretty-...
5
votes
1answer
1k views

Easiest way to render an overline in org mode?

Org mode has support for showing unicode in place of latex commands through org-pretty-entities. Org mode also has support for underlining through font locks that are activated through the _ character....
3
votes
1answer
222 views

highlight-chars and magit is conflicting

first time StackExchange user here. I'm having trouble with highlight-chars (probably font-lock) and magit. Enabling hc-toggle-highlight-* functions will remove the coloring from magit buffers. ...
2
votes
1answer
277 views

Part II -- Colorizing `functions/variables' within comments in `c-mode'

I have implemented the solution of Yasushi Shoji in a previous thread -- Colorizing `functions/variables' within comments in `c-mode' -- to highlight Lisp function/variable names in c-mode ...
2
votes
1answer
214 views

How to match more than one instance of a single subexpression?

I'm trying to use a regular expression of the form "foo\\(?:\\(bar\\)\\(baz\\)\\)*\\(quux\\)", but I want the inner two subexpressions to retain all of their matches, not just the first one. I ...
3
votes
1answer
380 views

Colorizing `functions/variables' within comments in `c-mode'

I am working with the C-source code of Emacs using the built-in c-mode, and would like Emacs to automatically highlight functions and variables within comments with a different color: In the ...
6
votes
1answer
398 views

Echo Area font face?

Is there any way to set a custom face for the echo area (and, by extension, the Isearch input text)? So far my searching hasn't turned up anything, except that it seems like there isn't a way to ...
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. **) ...
3
votes
1answer
181 views

How would you customize a subsection of keywords in a major mode in Emacs?

Is it possible to customize some, not all, of keywords in a major mode? (Pardon my vocabulary, since this is still new to me.) For example, let's say these are keywords: function, new, throw, return. ...