5

The function remove-text-properties requires a list for the third argument props -- e.g., (remove-text-properties start end '(face nil))

How can I remove all text properties in a buffer in one fell swoop, without necessarily knowing what all of those properties are?

2
  • Sheesh. The answer is on the same page of the Elisp manual that describes remove-text-properties. You should be asking Emacs...
    – Drew
    Commented May 20, 2015 at 1:08
  • @Drew -- you are correct -- I missed it by skimming a little too quickly. The upshot is that I learned the trick of using inhibit-read-only in conjunction with set-text-properties.
    – lawlist
    Commented May 20, 2015 at 2:57

1 Answer 1

8

Maybe this:

(let ((inhibit-read-only t))
  (set-text-properties (point-min) (point-max) nil))
1
  • Yes, that works -- thank you very much. I am adding your snippet to my custom version of a fundamental-mode to essentially restore everything in the buffer to just raw plain text.
    – lawlist
    Commented May 19, 2015 at 20:25

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.