emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IDEA] Add function clean-buffer


From: Stefan Kangas
Subject: Re: [IDEA] Add function clean-buffer
Date: Sun, 10 Sep 2023 01:19:35 -0700

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 via email to

[Prev in Thread] Current Thread [Next in Thread]