all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>,
	Joseph Turner <joseph@breatheoutbreathe.in>
Cc: rms@gnu.org, emacs-devel@gnu.org, mail+gh@daniel-mendler.de
Subject: Re: [IDEA] Add function clean-buffer
Date: Sun, 10 Sep 2023 01:19:35 -0700	[thread overview]
Message-ID: <CADwFkmnL-o0p0gKVNbucMWhLBoNLq0TtjKuveimBfhZmFsGbRg@mail.gmail.com> (raw)
In-Reply-To: <83o7ibvnj9.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

>> I'm also concerned that clean-buffer is too vague a function name,
>> and so the scope of its behavior is not clear. I can see that some
>> programs may want to "clean a buffer" by eliminating text properties
>> and overlays but not killing local variables, whereas others may want
>> to do all three and potentially something else.
>>
>> At this point, I'm open to letting this patch go ignored.
>
> Stefan, what is your view on this?

I agree with Richard that invoking fundamental-mode is the way to kill
local variables.  I don't see that job as tightly connected to killing
overlays and text properties, mostly because I often find it useful to
keep the latter.

Perhaps a command `clean-buffer' that just gets rid of overlays and text
properties, without killing local variables, would make more sense.  But
if this is a specific need only for hyperdrive.el, such a command might
belong in that package?

Richard Stallman <rms@gnu.org> writes:

> Should `fundamental-mode' eliminate text properties?  Or perhaps only
> some text properties?

It's worth considering the case `read-only'.  I often find it
inconvenient in situations like, e.g.

    (progn
      (pop-to-buffer "test")
      (insert (propertize "foo" 'read-only t))
      (fundamental-mode)
      (insert (propertize "bar")))     ; errors out

I'm not so sure about other text properties though.  I guess they'd each
need to be considered separately.

> Should `clean-buffer' eliminate only the text properties and overlays
> that do NOT come from the major mode?

How could one know where they "come from"?



  reply	other threads:[~2023-09-10  8:19 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
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 [this message]
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=CADwFkmnL-o0p0gKVNbucMWhLBoNLq0TtjKuveimBfhZmFsGbRg@mail.gmail.com \
    --to=stefankangas@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    --cc=mail+gh@daniel-mendler.de \
    --cc=rms@gnu.org \
    /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.