From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs Subject: bug#22819: 25.0.91; Don't try to indent region if the buffer is read-only Date: Fri, 26 Feb 2016 08:54:20 -0500 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0115f28e1e3baa052caca545 X-Trace: ger.gmane.org 1456494985 28542 80.91.229.3 (26 Feb 2016 13:56:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Feb 2016 13:56:25 +0000 (UTC) To: 22819@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 26 14:56:15 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aZIsM-0000zu-Dh for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 14:56:10 +0100 Original-Received: from localhost ([::1]:49929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIsL-0006Fj-OJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 08:56:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIsG-0006FF-8R for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 08:56:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZIsF-0007Px-2g for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 08:56:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIsE-0007Pi-V8 for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 08:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aZIsE-00049j-QK for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 08:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Feb 2016 13:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22819 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Original-Received: via spool by submit@debbugs.gnu.org id=B.145649491115898 (code B ref -1); Fri, 26 Feb 2016 13:56:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Feb 2016 13:55:11 +0000 Original-Received: from localhost ([127.0.0.1]:47038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZIrP-00048M-65 for submit@debbugs.gnu.org; Fri, 26 Feb 2016 08:55:11 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52601) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZIrN-000485-85 for submit@debbugs.gnu.org; Fri, 26 Feb 2016 08:55:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZIrH-00072E-5U for submit@debbugs.gnu.org; Fri, 26 Feb 2016 08:55:04 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIrH-00072A-2C for submit@debbugs.gnu.org; Fri, 26 Feb 2016 08:55:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIrG-00064U-27 for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 08:55:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZIrF-00071I-05 for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 08:55:02 -0500 Original-Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]:35936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZIrE-000710-Q5 for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 08:55:00 -0500 Original-Received: by mail-ob0-x229.google.com with SMTP id s6so28110514obg.3 for ; Fri, 26 Feb 2016 05:55:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=wGkRYaNHMQcUevlFG1Fp297FydPl2lS3roGVAScQJsQ=; b=G7soRSZFtj0yvB3jyMuwg23QXLEAO23QlCghqAdPvb7lhEPsL3Nv8G/adIxTlDr/j6 /bWoWTyQutA9O/lz6ZllzsKuFID3PlF/NtZxcdgG4Wam+tLGu0KFgpAyEgeMvbkI2fe4 ponx0p+AKPpF96rH6CtIXKW9SbNMzDoS6LXZn5HFFuYaLOdYKIhZZ/468sL1lsOGWnhD /DjUPV4kDFZnsm2O3f3oEfKCoY3eblQSoeDW2Xse9Fow/RC9dnlq0UXkAjYDsuJeGjU6 kTx62r2KGnupAKO2Lu86COpLkhsbPsSPm5uqg7RUUgJB0ornPJPFOFLXPMvFrXPG4kpl 4hTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wGkRYaNHMQcUevlFG1Fp297FydPl2lS3roGVAScQJsQ=; b=Mi4Y9lnwFwChIpey4Ev0MuOubN9Q82I34lZnAz6Plno9PpsS5f1rTiKdkbhDt9Doxz JsnT1hfWcaWWD6r2+2OuKGD335b40u3U8uGSCfY9Mc0Ah6D7TrR9YfXwLAfA3rS0LeNo EwQUr9GaBqSJCvZUdr5wUHhXWohXuF7PBZL06r/U/eyfr3KNkoj3gBIFGFJwJTWAGj69 SxEJx2haesYWG6SqrhYy/4qzt+SNCDgHtQ07MFEzGdqtEUorR5/dpBYzAEA6wsjHQXTr 1TmQlRyW9KdW+9rEts0tQmdtgUcwZ1WhlrbfSUV4iGZjxFtugfGt27Wzw7Lo+clfsXUF QY4A== X-Gm-Message-State: AD7BkJInn0hS/CQRTFj7t4+IirLNWyoYsGI8ynsN8Zba/3LUW4bopXkOLZaMxrrX08TXgZgjywV7QWFfVtbcFQ== X-Received: by 10.60.116.169 with SMTP id jx9mr1206004oeb.30.1456494899769; Fri, 26 Feb 2016 05:54:59 -0800 (PST) Original-Received: by 10.202.172.198 with HTTP; Fri, 26 Feb 2016 05:54:20 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113883 Archived-At: --089e0115f28e1e3baa052caca545 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable --text follows this line-- 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. diff --git a/lisp/indent.el b/lisp/indent.el index 0bbb520..d525511 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -509,6 +509,7 @@ indent-region 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") + (barf-if-buffer-read-only) (cond ;; If a numeric prefix is given, indent to that column. (column In GNU Emacs 25.0.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2016-02-25 built on ... Repository revision: d2dd614716e34edb5891e58c029741cd6b32217d Windowing system distributor 'The X.Org Foundation', version 11.0.60900000 System Description: Red Hat Enterprise Linux Workstation release 6.6 (Santiago) Configured using: 'configure --prefix=3D/home/kmodi/usr_local/apps/6/emacs/emacs-25 'CPPFLAGS=3D-fgnu89-inline -I/home/kmodi/usr_local/6/include -I/usr/include/freetype2 -I/usr/include' 'CFLAGS=3D-ggdb3 -O0' 'CXXFLAGS=3D-ggdb3 -O0' 'LDFLAGS=3D-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64 -ggdb3' PKG_CONFIG_PATH=3D/home/kmodi/usr_local/6/lib/pkgconfig:/home/kmodi/usr_lo= cal/6/lib64/pkgconfig:/cad/adi/apps/gnu/linux/x86_64/6/lib/pkgconfig:/cad/a= di/apps/gnu/linux/x86_64/6/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pk= gconfig:/usr/share/pkgconfig:/lib/pkgconfig:/lib64/pkgconfig' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK2 X11 --089e0115f28e1e3baa052caca545 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
--text follows this line--

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


diff --git a/lisp/indent.el b/lisp/indent.el
index 0bbb520..d5= 25511 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el<= /div>
@@ -509,6 +509,7 @@ indent-region
=C2=A0If the third ar= gument COLUMN is an integer, it specifies the
=C2=A0column to ind= ent to; if it is nil, use one of the three methods above."
= =C2=A0 =C2=A0(interactive "r\nP")
+ =C2=A0(barf-if-buff= er-read-only)
=C2=A0 =C2=A0(cond
=C2=A0 =C2=A0 ;; If a = numeric prefix is given, indent to that column.
=C2=A0 =C2=A0 (co= lumn



In GNU Em= acs 25.0.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
= =C2=A0of 2016-02-25 built on ...
Repository revision: d2dd614716e= 34edb5891e58c029741cd6b32217d
Windowing system distributor 'T= he X.Org Foundation', version 11.0.60900000
System Descriptio= n: Red Hat Enterprise Lin= ux Workstation release 6.6 (Santiago)

Configured u= sing:
=C2=A0'configure --prefix=3D/home/kmodi/usr_local/apps/= 6/emacs/emacs-25
=C2=A0'CPPFLAGS=3D-fgnu89-inline -I/home/kmo= di/usr_local/6/include
=C2=A0-I/usr/include/freetype2 -I/usr/incl= ude' 'CFLAGS=3D-ggdb3 -O0'
=C2=A0'CXXFLAGS=3D-ggd= b3 -O0' 'LDFLAGS=3D-L/home/kmodi/usr_local/6/lib
=C2=A0-L= /home/kmodi/usr_local/6/lib64 -ggdb3'
=C2=A0PKG_CONFIG_PATH= =3D/home/kmodi/usr_local/6/lib/pkgconfig:/home/kmodi/usr_local/6/lib64/pkgc= onfig:/cad/adi/apps/gnu/linux/x86_64/6/lib/pkgconfig:/cad/adi/apps/gnu/linu= x/x86_64/6/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/sha= re/pkgconfig:/lib/pkgconfig:/lib64/pkgconfig'

= Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND= GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FR= EETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11
--089e0115f28e1e3baa052caca545--