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 17:56:44 +0000 Message-ID: References: <798abe90-2eb4-46e3-a897-1dc75c959880@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114a73aa80713605562d92ed" X-Trace: blaine.gmane.org 1502128642 20621 195.159.176.226 (7 Aug 2017 17:57:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 Aug 2017 17:57:22 +0000 (UTC) To: Drew Adams , Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 07 19:57:08 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 1demH5-0004cB-4P for ged-emacs-devel@m.gmane.org; Mon, 07 Aug 2017 19:57:07 +0200 Original-Received: from localhost ([::1]:38747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1demHB-0008G0-3s for ged-emacs-devel@m.gmane.org; Mon, 07 Aug 2017 13:57:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1demH0-0008F8-1o for emacs-devel@gnu.org; Mon, 07 Aug 2017 13:57:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1demGv-0005HQ-27 for emacs-devel@gnu.org; Mon, 07 Aug 2017 13:57:02 -0400 Original-Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]:33068) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1demGu-0005H0-QQ for emacs-devel@gnu.org; Mon, 07 Aug 2017 13:56:56 -0400 Original-Received: by mail-lf0-x236.google.com with SMTP id d17so5183080lfe.0 for ; Mon, 07 Aug 2017 10:56:56 -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=cQYu/uyGRXdXXrko7V1XIGEtnjkuMjYJ5siBcch6yXA=; b=TnCLG70HtoaJwd8k0eRGMMf6jriYejaaOCM0xiN755TGkU+4847KV0tcyq26+ZCgKF QfIbFxDDH3uskKmxNvFc16mvXFUYy7SwswD6LM3ll/NCuqFjLnp7JzOCAR6mxpqmGBxK JCtC13wkDdEQ3VkLj4Cm6M64ETlz7KW70t9Fmf7rhZ0bO5AbLolhgB6lCOdFV00a0SIB lK02+rm2dn7npdj6WHK1zFXDyYTEHbBwzkQkSmfIFfymOfnQBPNyRA9GJSTODdBpJokn fROIJNI99n5rfW8wOzz/gPLlCuLXPC3MkYEhuf3uTEcH85uUElCZC57HVcrDM8bnVCTx USBg== 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=cQYu/uyGRXdXXrko7V1XIGEtnjkuMjYJ5siBcch6yXA=; b=d7ZDP2YuvfsS+W4VxWtpR6qVD0+rw403mDs/yigJJOMhDMcg0nx4DY8KazR0xpRM6e PyBm+J6Snz3eFo0zRUVfzpcU4C9F9RW4rFgZXD7/aAKfroRSbjtM0C8WbY/+zDO3Ind/ rp9U7Wf/bBAWaxQbVv45aFKw4IYDyFjKsrZR5qiFEkculjDA+iEBT/axLqyoO6G1f14g uBTOUF1cz4BcRKzzpiRe8/DOVH/HeLdZrCY9Zekm0LZ6jEjCytJny+crP4H8h//eZZkl ZmbbEfTu1kIhgPFrXdOe8Nun/xpw5cNIR+SOZGtdXSM6WsJK8EVTnw2fisIeiqq9QsEO 6oEQ== X-Gm-Message-State: AHYfb5i1+jCIRjaVvbg19nsifU8Pny+7nguX3naRTr0cSdePPSW1PX19 8eZe8JQOpoWRhyvLgogSQ+iv6nBicA== X-Received: by 10.25.204.86 with SMTP id c83mr497091lfg.245.1502128614958; Mon, 07 Aug 2017 10:56:54 -0700 (PDT) In-Reply-To: <798abe90-2eb4-46e3-a897-1dc75c959880@default> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::236 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:217362 Archived-At: --001a114a73aa80713605562d92ed Content-Type: text/plain; charset="UTF-8" On Mon, Aug 7, 2017 at 1:47 PM Drew Adams wrote: > > - Are there any objections to doing the buffer read-only check before > > doing the indent? > > Dunno what the right approach/solution is in this particular case. > > But note that we don't do what you suggest in general - we don't do it > for most other editing operations: insert or delete a character, yank > a string, kill the region,... Instead, we let an error be raised, > telling the user that the buffer is read-only. > This case feels a bit different because the operation can be very expensive.. a few seconds or couple of minutes long indentation, based on the major mode and file size. So a user would find it tremendously helpful to know that the operation is useless on a read-only buffer before spending that amount of time. With the cases of insert/delete char, yank string, kill region, I have never noticed any tangible delay (read: even a second).. so in those, it do not matter if you "do and then flag error" or "flag an error and then do". Also there are many cases of commands meant for buffer editing (like keep-lines, flush-lines, etc.) where barf-if-buffer-read-only is used for the same purpose. The purpose of this email thread is to understand if there's a workflow someone uses that would break if this read-only check were done at the beginning of the indentation operation. As Eli states his concern in the Bug#22819, do people rely on side-effects other than the actual buffer-editing indentation operation? -- Kaushal Modi --001a114a73aa80713605562d92ed Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Aug 7,= 2017 at 1:47 PM Drew Adams <dr= ew.adams@oracle.com> wrote:
= > - Are there any objections to doing the buffer read-only check before<= br> >=C2=A0 =C2=A0doing the indent?

Dunno what the right approach/solution is in this particular case.

But note that we don't do what you suggest in general - we don't do= it
for most other editing operations: insert or delete a character, yank
a string, kill the region,...=C2=A0 Instead, we let an error be raised,
telling the user that the buffer is read-only.

This case feels a bit different because the operation can be very e= xpensive.. a few seconds or couple of minutes long indentation, based on th= e major mode and file size. So a user would find it tremendously helpful to= know that the operation is useless on a read-only buffer before spending t= hat amount of time.

With the cases of insert/delet= e char, yank string, kill region, I have never noticed any tangible delay (= read: even a second).. so in those, it do not matter if you "do and th= en flag error" or "flag an error and then do".
Also there are many cases of commands meant for buffer editing = (like keep-lines, flush-lines, etc.) where barf-if-buffer-read-only is used= for the same purpose.

The purpose of this email t= hread is to understand if there's a workflow someone uses that would br= eak if this read-only check were done at the beginning of the indentation o= peration. As Eli states his concern in the Bug#22819, do people rely on sid= e-effects other than the actual buffer-editing indentation operation?
--

Kaushal Modi

--001a114a73aa80713605562d92ed--