From: Joseph Turner <joseph@breatheoutbreathe.in>
Cc: Emacs Devel Mailing List <emacs-devel@gnu.org>, mail+gh@daniel-mendler.de
Date: Tue, 05 Sep 2023 12:37:30 -0700
+(defun clean-buffer (&optional buffer)
+ "Remove all local variables, overlays, and text properties in BUFFER.
+ When BUFFER is nil, act on current buffer."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Our usual style is to say
BUFFER defaults to the current buffer.
or
If BUFFER is omitted or nil, it defaults to the current buffer.
+ (with-current-buffer (or buffer (current-buffer))
+ (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))))
(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.
Why not the original "Mode that removes"?
+This mode is intended for debugging purposes. For non-interactive
^^
Two spaces between sentences, please.
Also, why "For non-interactive use"? The opposite of "debugging
purposes" is something like "for other purposes".