Emacs: Make Whitespaces Visible
Alt+x whitespace-mode (in emacs 23 or later), to make all whitespaces visible.
Alt+x whitespace-newline-mode to make (only) newline visible.
whitespace-mode.
Different placement and mix of whitespaces are rendered with different colors. Also, long lines are colored dark purple.whitespace-mode renders {spaces, tabs, newlines} characters with a visible glyph.
To use it, call:
whitespace-mode→ toggle on/off, for current file.global-whitespace-mode→ toggle on/off globally for current emacs session.
There is also whitespace-newline-mode and global-whitespace-newline-mode. They only show newline chars.
Setting Up whitespace-mode
whitespace-mode.Download sample test file: whitespace_sample_file.txt
For a simple and clean whitespace mode setup, put the following in your emacs init.
(progn ;; Make whitespace-mode with very basic background coloring for whitespaces. ;; http://ergoemacs.org/emacs/whitespace-mode.html (setq whitespace-style (quote (face spaces tabs newline space-mark tab-mark newline-mark ))) ;; Make whitespace-mode and whitespace-newline-mode use “¶” for end of line char and “▷” for tab. (setq whitespace-display-mappings ;; all numbers are unicode codepoint in decimal. e.g. (insert-char 182 1) '( (space-mark 32 [183] [46]) ; SPACE 32 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」 (newline-mark 10 [182 10]) ; LINE FEED, (tab-mark 9 [9655 9] [92 9]) ; tab )))
In the above, the numbers are Unicode codepoint in decimal. Depending on your choice of font, some glyphs may not show up or correctly. If so, you can try the following glyphs.
| Glyph | Unicode Code Point (Decimal) | Unicode Name |
|---|---|---|
| · | 183 | MIDDLE DOT |
| ¶ | 182 | PILCROW SIGN |
| ↵ | 8629 | DOWNWARDS ARROW WITH CORNER LEFTWARDS |
| ↩ | 8617 | LEFTWARDS ARROW WITH HOOK |
| ⏎ | 9166 | RETURN SYMBOL |
| ▷ | 9655 | WHITE RIGHT POINTING TRIANGLE |
| ▶ | 9654 | BLACK RIGHT-POINTING TRIANGLE |
| → | 8594 | RIGHTWARDS ARROW |
| ↦ | 8614 | RIGHTWARDS ARROW FROM BAR |
| ⇥ | 8677 | RIGHTWARDS ARROW TO BAR |
| ⇨ | 8680 | RIGHTWARDS WHITE ARROW |
See also: Unicode: ASCII Character Symbols ␀  ␠ ␣ ¶ ↩
Whitespace Topic
Font/Unicode Topic
- Emacs: Unicode Tutorial
- Emacs File Encoding FAQ
- Unicode Basics: What's Character Set, Character Encoding, UTF-8?
- Emacs: Xah Math Input Mode
- Emacs: Xah Unicode Browser Mode
Rectangle Edit Topic
Liket it? Put $1 at
patreon.
Or Buy Xah Emacs Tutorial. Thanks.