From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: [RFC] Do indent-region only on editable buffers Date: Mon, 07 Aug 2017 20:07:42 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1142b58cdb83f405562f6682" X-Trace: blaine.gmane.org 1502136502 32314 195.159.176.226 (7 Aug 2017 20:08:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 Aug 2017 20:08:22 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 07 22:08:09 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deoJs-0007dm-8B for ged-emacs-devel@m.gmane.org; Mon, 07 Aug 2017 22:08:08 +0200 Original-Received: from localhost ([::1]:39381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deoJy-0001vq-FM for ged-emacs-devel@m.gmane.org; Mon, 07 Aug 2017 16:08:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deoJj-0001sB-AN for emacs-devel@gnu.org; Mon, 07 Aug 2017 16:08:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1deoJe-00078u-7a for emacs-devel@gnu.org; Mon, 07 Aug 2017 16:07:59 -0400 Original-Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]:35348) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1deoJe-00078G-0E for emacs-devel@gnu.org; Mon, 07 Aug 2017 16:07:54 -0400 Original-Received: by mail-lf0-x22d.google.com with SMTP id t128so6442709lff.2 for ; Mon, 07 Aug 2017 13:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=yWn2xcH3wcTSUGdOpGxAhAHCSO+yCxZG7tKV18xPh18=; b=rTHMUipWXZIP1NSnehVm/YUNq3QW3WSABFt0FOhb42bQ/2BD1FB4VJa/D5KSw7eVrv 4GXGykUHN/Hdt4zfL71TSesCQre+rmdy8rASQUaej2rj8sAEeyD72224alru3/GsZcGU gOrvWOz9dLjhtTiOQXmdgCIxM7QurBfh8qywLP7VFgT9FqnRC4NfCfXRKcRkM3AEr6zT bQVjjjdGfgPdl1yHniVgJiqMOJntKUoiNjpfyZlxBOv+/df7WdAR55p01fH3O3SQApGZ 3lN3RqzVFYe0wH4huG3BNdSV9B9P/zwbnAGzA3G1AqBgHQrkx+kkUS9FU25BMG0fugXV QDiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=yWn2xcH3wcTSUGdOpGxAhAHCSO+yCxZG7tKV18xPh18=; b=HCO/3O4siEvDE84VMVmrBACaxqA89V6O2sKddfNRc5KV/qk7VSX0FvHiN996aDGxuz J8gspV9k5Ifxtc+F5+HjVn0hXx0Za65Z1Di7Bsu7f9nVmELMqxUaveCG8Ym4LJCnASGo wcTykWmAveIE4TFF2OJEgrjPtQ1CbWVYI5aZmT2Dc8j70GxuFcECrLFevgfoeAKJp1ZF XmlA6IuaYV6YzDV6OK4GHYXe0OOJIsz9A32u87pQOpUtkxOBXBCVrhGoHHf4w3RcRFNo tfmiEnOAcaTDydMnkNnknU8byjlgQcYX9clS+11Dr/iCeLefZlP3+FXsq8QbmBt4K6wi kg3w== X-Gm-Message-State: AHYfb5ilAX1fHu80V9RVlkaIx0vDx0SKkTG0tvOOQLlMPCDMqfZXH8Ng QW8o7/pva+BSxmSTWHLUdJgurBhjeA== X-Received: by 10.46.0.134 with SMTP id e6mr588614lji.68.1502136472665; Mon, 07 Aug 2017 13:07:52 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217366 Archived-At: --001a1142b58cdb83f405562f6682 Content-Type: text/plain; charset="UTF-8" On Mon, Aug 7, 2017 at 3:55 PM Stefan Monnier 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 --001a1142b58cdb83f405562f6682 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Aug 7,= 2017 at 3:55 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> The proposal is to call (barf-if-buffer-read-only) before at= tempting to do
> the indent.

No objection here.

Thanks.
= =C2=A0
> change is required? Here= 9;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. Us= er: Make

Indentation of a region isn't done by computing the complete result and=
then "saving" it into the buffer.=C2=A0 So the error will be sign= aled 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 explain= ing the behavior. That explains why the read-only buffer error is not throw= n if the buffer is already indented.=C2=A0
--

Kaushal Modi

--001a1142b58cdb83f405562f6682--