I'm totally new to the wonderful world of Emacs. I started to use it some weeks ago and i'm find myself to use it more and more... I would like to use it not only as a code editor, but also as a word processor like MS Word, Apple Pages, etc, however, i cant find a practical way to color text, highlight text (like a physical highlighter not like a code editor), and so on. I use M-x highlight-syntax-at-point and M-x highlight-phrase but is temporary and anyway, highlights only, e.g. i cant simply make a word or a phrase green. I hope i was clear in my question. Thanks anyway!

  • Take a look at enriched-mode.
    – user12563
    Commented Jul 31, 2018 at 15:55
  • Thanks, any guide? I looked at it and seems really hard to understand...
    – wing
    Commented Jul 31, 2018 at 16:24
  • Related: stackoverflow.com/questions/20016634/…
    – Tobias
    Commented Jul 31, 2018 at 16:51
  • @wing take a look at this guide: git.savannah.gnu.org/cgit/emacs.git/tree/etc/enriched.txt. You should be able to find it in your Emacs installation as well.
    – user12563
    Commented Jul 31, 2018 at 16:57
  • 5
    While there may be a way to use Emacs like you want to, Emacs is more friendly to "what you see is what you mean" kind of editing (as opposed to "what you see is what you get", like MS Word). I.e. you would find better support for LaTeX, all kinds of markup languages, restructured text, nroff, PostScript etc. I use Org mode for the purposes someone else might use MS Word, for example. It certainly doesn't match feature for feature, but it serves me perfectly well.
    – wvxvw
    Commented Jul 31, 2018 at 19:16

2 Answers 2


If you want to get a well formatted text document, you can use emacs and others packages like LaTeX, ConTeXt, org-mode, or markdown (and pandoc) to get a beautiful and well structured pdf/html/ePub document. Emacs is very efficient for coding any markup language. On the other hand, if you want organizing your notes with syntax highlighting, you can use org-mode or enriched-mode.

To learn several options to work with plain text in emacs, I recommend to read this tutorial http://www.emacs.uniyar.ac.ru/doc/emacs-for-writers.pdf.


It is remarkable that also Elisp files can be saved with the minor mode enriched-mode enabled.

The formatting information saved by enriched-mode in the Elisp file works more like an encoding and does not influence the actual Elisp code.

Enriched mode is not appropriate for source files with programming languages that are executed or compiled by external tools.

The following Elisp code works well with the library highlight.el when hlt-use-overlays-flag is set to non-nil.

If the list of file-local variables contains the variable txt-hlt-overlays the highlight overlays created by the highlight library are saved in that variable and the variable is updated as file local variable.

Next time the the file is read into a buffer the highlight overlays in txt-hlt-overlays are reapplied to the buffer.

(require 'highlight)

(defvar-local txt-hlt-overlays nil
  "File local variable holding intervals with hlt text props.")

(defun txt-start-hlt-overlays (&optional stop)
  "Start saving hlt overlays for the current buffer file.
Stop if STOP is non-nil."
  (interactive "P")
    (if stop
    (delete-file-local-variable 'txt-hlt-overlays)
      (add-file-local-variable 'txt-hlt-overlays nil))))

(defun txt-hlt-overlay-list ()
  "Return list of text overlays with non-nil 'hlt-highlight property."
   for ol being the overlays
   if (overlay-get ol 'hlt-highlight)
   collect (cons (overlay-start ol) (cons (overlay-end ol) (overlay-properties ol)))))

(defun txt-update-hlt-overlays-list ()
  "Update file local variable `txt-hlt-overlays'."
  (when (assoc 'txt-hlt-overlays file-local-variables-alist)
      (add-file-local-variable 'txt-hlt-overlays (txt-hlt-overlay-list)))))

(defun txt-apply-hlt-overlays ()
  "Apply hlt properties stored in `txt-hlt-overlays'."
     with ol
     for ol-props in txt-hlt-overlays do
     (setq ol (make-overlay (nth 0 ol-props) (nth 1 ol-props)))
     (cl-loop for ptr on (nthcdr 2 ol-props) by #'cddr do
          (overlay-put ol (car ptr) (cadr ptr))))))

(add-hook 'before-save-hook #'txt-update-hlt-overlays-list)
(add-hook 'find-file-hook #'txt-apply-hlt-overlays)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.