Emacs: Bold, Underline, Color Texts (Persistent Highlight)

By Xah Lee. Date: . Last updated: .

You can use emacs to bold, italic, underline, text. Also, when saving, these will be preserved.

emacs enriched-mode 2015-09-19 36863f28
emacs enriched-mode

Press Alt+o Ctrl+h to see complete list of keys.

enriched-mode

Alt+x enriched-mode minor mode, to make emacs save the bold etc text.

  1. Open a new file
  2. Alt+x enriched-mode
  3. type “abc xyz”, select the word “abc”, then Alt+o b to make it bold.
  4. save it, close it.
  5. reopen it.

You can see the text is still bold.

“Enriched text” file format

The file format used is Enriched text format. This is a old format dating to early 1990s.

Here's sample enriched format file.

Content-Type: text/enriched
Text-Width: 80

<bold>abc</bold> xyz

The features of the format is pretty minimal. You can bold, slant, underline, color, texts, but that's about it. Emacs's enriched-mode is written originally in 1994.

Show File Raw Content

You can use emacs to show the file's raw content.

Sample enriched file: emacs_enriched_text_sample_file.txt

Alt+x find-file-literally then give the file path.

richard stallman emacs as word processor 2013-11-17
Richard Stallman on emacs as word processor .

Thanks to Jan from Oslo.

Emacs Org Mode

I recommend you use org-mode instead if you want persistent highlighting. Because, almost nobody uses the emacs enriched-mode, and the enriched text format is also long dead. Emacs org-mode is widely used, and far more rich.

See: Emacs: Org Mode Markup Cheatsheet

Emacs Persistent Highlight