[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [IDEA] Add function clean-buffer
From: |
Joseph Turner |
Subject: |
Re: [IDEA] Add function clean-buffer |
Date: |
Thu, 07 Sep 2023 21:55:23 -0700 |
Eli Zaretskii <eliz@gnu.org> writes:
>> 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".
Thanks for the corrections. See patches.
0001-Add-new-function-clean-buffer.patch
Description: Text Data
0002-Refactor-clean-mode-to-use-clean-buffer.patch
Description: Text Data
- [IDEA] Add function clean-buffer, Joseph Turner, 2023/09/03
- Re: [IDEA] Add function clean-buffer, Philip Kaludercic, 2023/09/04
- Re: [IDEA] Add function clean-buffer, Richard Stallman, 2023/09/08
- Re: [IDEA] Add function clean-buffer, Joseph Turner, 2023/09/09
- Re: [IDEA] Add function clean-buffer, Eli Zaretskii, 2023/09/09
- Re: [IDEA] Add function clean-buffer, Stefan Kangas, 2023/09/10
- Re: [IDEA] Add function clean-buffer, Richard Stallman, 2023/09/11