all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Joseph Turner <joseph@breatheoutbreathe.in>
Cc: philipk@posteo.net, emacs-devel@gnu.org, mail+gh@daniel-mendler.de
Subject: Re: [IDEA] Add function clean-buffer
Date: Wed, 06 Sep 2023 14:59:19 +0300	[thread overview]
Message-ID: <83cyyv342w.fsf@gnu.org> (raw)
In-Reply-To: <87a5u0tmwd.fsf@breatheoutbreathe.in> (message from Joseph Turner on Tue, 05 Sep 2023 12:37:30 -0700)

> 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.



  reply	other threads:[~2023-09-06 11:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-03 22:18 [IDEA] Add function clean-buffer Joseph Turner
2023-09-04 16:02 ` Philip Kaludercic
2023-09-05 19:37   ` Joseph Turner
2023-09-06 11:59     ` Eli Zaretskii [this message]
2023-09-08  4:55       ` Joseph Turner
2023-09-08  9:13         ` David Ponce
2023-09-08 17:21           ` Joseph Turner
2023-09-09  0:38       ` Richard Stallman
2023-09-09  0:59         ` Joseph Turner
2023-09-09  7:00           ` Eli Zaretskii
2023-09-10  8:19             ` Stefan Kangas
2023-09-12  0:29               ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83cyyv342w.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    --cc=mail+gh@daniel-mendler.de \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.