Книга: Learning GNU Emacs, 3rd Edition
10.3.2.2 Buffer highlighting
10.3.2.2 Buffer highlighting
The easiest way to use fonts and colors is to load the Lisp package font-lock.el (included with the Emacs distribution). This mode tries to highlight interesting features of your text buffers using color and different faces. As an example, try picking out comments in C and Lisp buffers, and painting them in a color that contrasts with the basic black of the code.
;; Turn on font lock mode every time Emacs initializes a buffer
;; for Lisp or C.
(add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
(add-hook 'c-mode-hook 'turn-on-font-lock)
Font-lock mode tends to be especially helpful for colorizing programming language code or outline mode text but also gives useful results for HTML files and Dired buffers. In fact, we find it useful in so you may want to turn it on globally instead, as we did in "A Sample .emacs file" earlier in this chapter. If you want more examples using font-lock mode, refer back to Chapter 9 on some of the various programming language modes supported by Emacs.
- 10.3.2 Automatic Highlighting and Coloring
- Page buffers
- TCP REMOTE BUFFER
- DirectX Tutorial 4: Full Screen and Depth Buffers
- Measuring Key Buffer Usage
- 14.5.2. Dumping the printk Log Buffer
- 2.3.5. Buffered versus Unbuffered Primitives
- 4.2.1 Switching Buffers
- 4.2 Working with Multiple Buffers
- 7.5.2 Private Buffers
- BufferedStream
- 11.3.1 Buffers, Text, and Regions