]> code.delx.au - gnu-emacs/blobdiff - lisp/font-core.el
.
[gnu-emacs] / lisp / font-core.el
index 39d8daad1ec02545db21dfa17af0cf8af7b148f6..0554d65749791438859461e10e87c6122ac8869a 100644 (file)
@@ -220,6 +220,18 @@ your own function which is called when `font-lock-mode' is toggled via
 (defun font-lock-change-mode ()
   (font-lock-mode -1))
 
+(defun font-lock-defontify ()
+  "Clear out all `font-lock-face' properties in current buffer.
+A major mode that uses `font-lock-face' properties should put
+this function onto `change-major-mode-hook'."
+  (let ((modp (buffer-modified-p))
+       (inhibit-read-only t))
+    (save-restriction
+      (widen)
+      (remove-list-of-text-properties (point-min) (point-max)
+                                     '(font-lock-face)))
+    (set-buffer-modified-p modp)))
+
 (defun font-lock-default-function (mode)
   ;; Turn on Font Lock mode.
   (when mode