all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: 22819@debbugs.gnu.org
Subject: bug#22819: 25.0.91; Don't try to indent region if the buffer is read-only
Date: Fri, 04 Aug 2017 21:56:11 -0400	[thread overview]
Message-ID: <87vam26amc.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CAFyQvY2fpSRWG=fBzt=A7ufUZx2vGuD5ghgVKV1J7yNCjr-1GQ@mail.gmail.com> (Kaushal Modi's message of "Fri, 26 Feb 2016 08:54:20 -0500")

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

Kaushal Modi <kaushal.modi@gmail.com> writes:

> The current behavior of indent-region function is that it will first indent
> the buffer and then throw an error at the end that it couldn't apply the
> indentation. Instead the below patch checks if the buffer if read-only
> first before trying to indent.

I wonder if someone will complain that they were relying on this
behaviour to check indentation in read-only buffers (currently if the
indentation is already correct there is no error).

The patch could be even simpler:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 852 bytes --]

From 54d1b5cd62572dc35eaed6f07ab9d254313c8a58 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 6 Jul 2017 20:04:43 -0400
Subject: [PATCH] * lisp/indent.el (indent-region): Fail fast if read-only
 (Bug#22819).

---
 lisp/indent.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/indent.el b/lisp/indent.el
index e7a30b885d..e9ed385faa 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -508,7 +508,7 @@ (defun indent-region (start end &optional column)
 Called from a program, START and END specify the region to indent.
 If the third argument COLUMN is an integer, it specifies the
 column to indent to; if it is nil, use one of the three methods above."
-  (interactive "r\nP")
+  (interactive "*r\nP")
   (cond
    ;; If a numeric prefix is given, indent to that column.
    (column
-- 
2.11.1


  reply	other threads:[~2017-08-05  1:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 13:54 bug#22819: 25.0.91; Don't try to indent region if the buffer is read-only Kaushal Modi
2017-08-05  1:56 ` npostavs [this message]
2017-08-05  6:52   ` Eli Zaretskii
2017-08-05 11:50     ` Kaushal Modi
2017-08-05 12:10       ` Eli Zaretskii
2017-08-05 12:29         ` Kaushal Modi
2017-08-05 12:37           ` Eli Zaretskii
2017-08-05 12:47         ` npostavs
2017-08-05 13:13           ` Eli Zaretskii
2017-08-07 17:45       ` Kaushal Modi
2017-08-07 17:53         ` Noam Postavsky
2017-08-07 18:02           ` Kaushal Modi
2017-08-07 18:11             ` Noam Postavsky
2017-08-08 13:06               ` Kaushal Modi
2017-08-08 13:15                 ` npostavs
2017-08-08 19:05                 ` Eli Zaretskii
2017-08-08 19:19                   ` Kaushal Modi
2017-08-08 21:31                     ` John Wiegley
2017-08-09 11:03                       ` Kaushal Modi
2017-08-09 21:14                         ` John Wiegley
2019-06-25 14:33                   ` Lars Ingebrigtsen
2019-06-25 14:35                     ` Kaushal Modi

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=87vam26amc.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=22819@debbugs.gnu.org \
    --cc=kaushal.modi@gmail.com \
    /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.