all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Drew Adams <drew.adams@oracle.com>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: [RFC] Do indent-region only on editable buffers
Date: Mon, 07 Aug 2017 17:56:44 +0000	[thread overview]
Message-ID: <CAFyQvY3CehRmgn78vPaoH4gzzn2YLbwS2arWKL11DHaDGNEsnQ@mail.gmail.com> (raw)
In-Reply-To: <798abe90-2eb4-46e3-a897-1dc75c959880@default>

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

On Mon, Aug 7, 2017 at 1:47 PM Drew Adams <drew.adams@oracle.com> 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

[-- Attachment #2: Type: text/html, Size: 2061 bytes --]

  reply	other threads:[~2017-08-07 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 17:36 [RFC] Do indent-region only on editable buffers Kaushal Modi
2017-08-07 17:46 ` Drew Adams
2017-08-07 17:56   ` Kaushal Modi [this message]
2017-08-07 18:13   ` Noam Postavsky
2017-08-07 19:55 ` Stefan Monnier
2017-08-07 20:07   ` Kaushal Modi
2017-08-07 23:03   ` John Wiegley

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=CAFyQvY3CehRmgn78vPaoH4gzzn2YLbwS2arWKL11DHaDGNEsnQ@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@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.