3

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?

  • Sheesh. The answer is on the same page of the Elisp manual that describes remove-text-properties. You should be asking Emacs... – Drew May 20 '15 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 May 20 '15 at 2:57
5

Maybe this:

(let ((inhibit-read-only t))
  (set-text-properties (point-min) (point-max) nil))
  • 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 May 19 '15 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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