Emacs: Uncolor Region/Buffer

By Xah Lee. Date: . Last updated: .

Normally, you can Alt+x font-lock-mode to turn off syntax coloring.

But if you copied some text from another buffer into a new buffer, turning off font-lock-mode won't remove existing coloring.

Here's a command that lets removes syntax coloring.

(defun xah-unfontify-region-or-buffer ()
  "Unfontify text selection or buffer.
URL `http://ergoemacs.org/emacs/elisp_uncolor_region.html'
Version 2017-05-31"
  (if (use-region-p)
      (font-lock-unfontify-region (region-beginning) (region-end))

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys


ELisp Examples

ELisp Write Major Mode

ELisp Examples

Xah Commands

Text Transform Under Cursor

Commands Do thing-at-point

Command to Insert Things

Script Examples