Using emacs for coloring text display

I have a log file in which there is a lot of information about tagging, that is, "ERROR", "WARNING", "***". I want to show log information with different colors / fonts based on tag information. How can i do this?

Should I come up with my own primary / secondary modes? Is there any elisp code that I can reuse?

+3
source share
3 answers

You can do this interactively:

M-s h r regexp <RET> FACE <RET>

or

C-x w h regexp <RET> FACE <RET>

. . . , Hi-Lock M-x global-hi-lock-mode.

, fixme-mode .

Faces , , .

+5

, .

+4

, :

(defun add-watchwords ()
  (font-lock-add-keywords
   nil '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):"
          1 font-lock-warning-face t))))

, , , .

+3

Source: https://habr.com/ru/post/1765876/


All Articles