From dfb0ac3d7ae03d8e9dffd1d447afe0a604a49960 Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Tue, 5 Sep 2023 12:34:23 -0700 Subject: [PATCH 2/2] Refactor clean-mode to use clean-buffer * lisp/simple.el (clean-mode): Use clean-mode internally. Clarify docstring. --- lisp/simple.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 05a3c4b93d6..37d76c174dc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -546,13 +546,11 @@ Other major modes are defined by comparison with this one." (run-mode-hooks)) (define-derived-mode clean-mode fundamental-mode "Clean" - "A mode that removes all overlays and text properties." - (kill-all-local-variables t) - (let ((inhibit-read-only t)) - (dolist (overlay (overlays-in (point-min) (point-max))) - (delete-overlay overlay)) - (set-text-properties (point-min) (point-max) nil) - (setq-local yank-excluded-properties t))) + "Mode removing all local variables, overlays, and text properties. +This mode is intended for debugging purposes. For non-interactive +use, see `clean-buffer'." + (clean-buffer) + (setq-local yank-excluded-properties t)) ;; Special major modes to view specially formatted data rather than files. -- 2.41.0