Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I use `font-lock.el?

font
0
10 Posted

How can I use `font-lock.el?

0

Include lines like the following in your .emacs file for each mode in which you want to enable font-lock: (setq emacs-lisp-mode-hook ‘(lambda () (font-lock-mode 1))) By default, font-lock does not display in colour. If you want colour strings, specify the face as follows: (add-hook ‘font-lock-mode-hook ‘(lambda () (make-face ‘keyword-face) (set-face-foreground ‘keyword-face “tomato”) (setq font-lock-keyword-face ‘keyword-face) (make-face ‘comment-face) (set-face-foreground ‘comment-face “violetred4”) (setq font-lock-comment-face ‘comment-face) (make-face ‘string-face) (set-face-foreground ‘string-face “darkgreen”) (setq font-lock-string-face ‘string-face) (make-face ‘function-face) (set-face-foreground ‘function-face “blueviolet”) (setq font-lock-function-name-face ‘function-face) (make-face ‘c-type-face) (set-face-foreground ‘c-type-face “darkolivegreen”) (setq font-lock-type-face ‘c-type-face) )) There are improved versions of font-lock: face-lock can handle colours and grey scales;

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123