GNU bug report logs - #22819
25.0.91; Don't try to indent region if the buffer is read-only

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Fri, 26 Feb 2016 13:56:02 UTC

Severity: wishlist

Tags: patch, wontfix

Found in version 25.0.91

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 22819 <at> 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
[Message part 1 (text/plain, inline)]
Kaushal Modi <kaushal.modi <at> 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:

[0001-lisp-indent.el-indent-region-Fail-fast-if-read-only-.patch (text/x-diff, inline)]
From 54d1b5cd62572dc35eaed6f07ab9d254313c8a58 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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


This bug report was last modified 5 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.