emacs-devel
[Top][All Lists]
Advanced

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

Re: [RFC] Do indent-region only on editable buffers


From: Kaushal Modi
Subject: Re: [RFC] Do indent-region only on editable buffers
Date: Mon, 07 Aug 2017 20:07:42 +0000

On Mon, Aug 7, 2017 at 3:55 PM Stefan Monnier <address@hidden> wrote:
> The proposal is to call (barf-if-buffer-read-only) before attempting to do
> the indent.

No objection here.

Thanks.
 
> change is required? Here's what's will happen: 1. User: Try indentation
> (C-x h M-x indent-region) 2. User: Could take several seconds or few
> minutes (depending on major mode and file size) 3. Emacs: "Bummer, couldn't
> save all that indentation because the buffer is read-only". 4. User: Make

Indentation of a region isn't done by computing the complete result and
then "saving" it into the buffer.  So the error will be signaled as soon
as the indent-region finds a line whose indentation should be changed.
Usually that's almost instantaneous, but indeed in some cases it can
take a while (e.g. in large regions that are already indented except for
the last few lines).

Thanks for explaining the behavior. That explains why the read-only buffer error is not thrown if the buffer is already indented. 
--

Kaushal Modi


reply via email to

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