From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs 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-ID: <87vam26amc.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1501898114 6840 195.159.176.226 (5 Aug 2017 01:55:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 5 Aug 2017 01:55:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 22819@debbugs.gnu.org To: Kaushal Modi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 05 03:55:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ddoJ1-0001Mb-E1 for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Aug 2017 03:55:07 +0200 Original-Received: from localhost ([::1]:55030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddoJ7-0001bA-4w for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Aug 2017 21:55:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddoJ1-0001Zn-SD for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 21:55:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddoIx-00060m-0M for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 21:55:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39547) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddoIw-00060g-Rm for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 21:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ddoIw-0001Yy-HG for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 21:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Aug 2017 01:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22819 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 22819-submit@debbugs.gnu.org id=B22819.15018980785962 (code B ref 22819); Sat, 05 Aug 2017 01:55:02 +0000 Original-Received: (at 22819) by debbugs.gnu.org; 5 Aug 2017 01:54:38 +0000 Original-Received: from localhost ([127.0.0.1]:42221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddoIY-0001Y6-I0 for submit@debbugs.gnu.org; Fri, 04 Aug 2017 21:54:38 -0400 Original-Received: from mail-io0-f193.google.com ([209.85.223.193]:36336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddoIW-0001Xr-Ij for 22819@debbugs.gnu.org; Fri, 04 Aug 2017 21:54:36 -0400 Original-Received: by mail-io0-f193.google.com with SMTP id j32so2118262iod.3 for <22819@debbugs.gnu.org>; Fri, 04 Aug 2017 18:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=K5adcaWk/+3M32QwqDYhg/M/Xym/+kqd48kL10e+l9k=; b=FX9XFg4664pkQCZro7hJe2xmG7Ar42jhhRwJyioVwllAhibHKKYHEYpAekkEmUvtnQ 8gVxbwNJPcO1kepBLY+57Z0LCEYKirFlSr96K9q9sjxRtu+dZO9zh6QLnJjt5Vm+hxrq LBl0hJZ9xwdsg0V5/z4v1A48MtyFa64OHrxp+g9dW6+VMAG4tB+dhKAsjXis/4rtpXGH XHw1mxB2ygIH73z/Q9zKjYFDGCvHotBVbgm2FMSHu3hIAzUZw0ZjIR8pLTv8aQvPiJ02 L1Mp3trOlg8/tVb/B9dLpsb8Nv3cnVGctGE4AV6HwwrFilhbeHIdVcDkkN1THyNHT8Ua dY5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=K5adcaWk/+3M32QwqDYhg/M/Xym/+kqd48kL10e+l9k=; b=fl4l5qfPSpNncntOjGzlV6vjVBQxIRJMIOR5Pcwtqm8jiwq1TK+Ui7J5sfjus/4abz mDMuad4x2zfPYEPl8YV/X51rRCghWWxAUAwQQ5jU27SFGY7OczrV9Z+ZGRdYOwSI6KLf bj//e+PPqIK7qgRNCwio+FbKEYYGrpN2GOjlnNrdZtqCt0RiTkTnflqLXCh72bTVkZst x86vSF828GZ4VmLYjXMv0Z56XhaiyDIpZhYIZ3GFKizs2eGFYLhrrDIPJ6ful2TYEdXs VluK5+73+/ovh3aNU46G4oZ+hB9nmgahxXKYw2UyN7Xx71DZV9ahHL93E0yTptCNNQNQ yQkQ== X-Gm-Message-State: AIVw113FPCjcMUxZL+nxN44w/1+CKM4jdcZuL5BPn/owRF+dM/2fzxcP aW+x2RgPs/sX5wHG X-Received: by 10.107.157.144 with SMTP id g138mr4901063ioe.200.1501898070827; Fri, 04 Aug 2017 18:54:30 -0700 (PDT) Original-Received: from zony ([45.2.119.48]) by smtp.googlemail.com with ESMTPSA id b185sm1388549itc.1.2017.08.04.18.54.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Aug 2017 18:54:30 -0700 (PDT) In-Reply-To: (Kaushal Modi's message of "Fri, 26 Feb 2016 08:54:20 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135372 Archived-At: --=-=-= Content-Type: text/plain Kaushal Modi 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-indent.el-indent-region-Fail-fast-if-read-only-.patch Content-Description: patch >From 54d1b5cd62572dc35eaed6f07ab9d254313c8a58 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--