From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.help
Subject: Re: What should I use to unrestrict a buffer?
Date: Thu, 25 Jan 2024 21:03:33 +0200
Message-ID: <86y1cdb5h6.fsf@gnu.org>
References: <4df85194384c642c3cda3289cd1ac1a20ee42bcc.camel@adminart.net>
 <86r0i5dgvh.fsf@gnu.org>
 <cdec1d74bb1c3570eb30f3152d30ebbb09740402.camel@adminart.net>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="18503"; mail-complaints-to="usenet@ciao.gmane.io"
To: help-gnu-emacs@gnu.org
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 25 20:04:17 2024
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1rT51N-0004Yr-Iw
	for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 25 Jan 2024 20:04:17 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <help-gnu-emacs-bounces@gnu.org>)
	id 1rT50k-0003Sc-V9; Thu, 25 Jan 2024 14:03:38 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>) id 1rT50j-0003SE-2v
 for help-gnu-emacs@gnu.org; Thu, 25 Jan 2024 14:03:37 -0500
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>) id 1rT50i-0005sD-R7
 for help-gnu-emacs@gnu.org; Thu, 25 Jan 2024 14:03:36 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=JM1GIbHywepirqgcCIO6OUW6tvPriR8JBs7v1xH5tzk=; b=erJeJl14HxEA
 bszfvWQZCG01FVDsQhL87ywDM88UCLvxEVkZB6Nxbu5Q7N8ztvZrvzLY78czxatDVTsGrFca6g4rT
 F5re+qSmCh0ReRfMY6yZ7ALCrjyRTwB/quP+hRDsxlsah2AYnN7F5fKvJz7uLl4+qO9oLYGerfKr3
 5fgrfteBdoTm7MpN9f6SEen0OBKvYRbKDETgiwRtQUqFiUJFEOovWfANoyrGN0iDXj37omfNn9A69
 00LWyMZ4c6LlrBYGAtR23MSND1nEMaOh+OIkZYx2f+kWeUnqnOjSvUqT7DsofmLTHC5eCqDOsHpBh
 pHE9F/5wdqPf9OM4t/qBJQ==;
In-Reply-To: <cdec1d74bb1c3570eb30f3152d30ebbb09740402.camel@adminart.net>
 (message from hw on Thu, 25 Jan 2024 19:30:17 +0100)
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.help:145805
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/145805>

> From: hw <hw@adminart.net>
> Date: Thu, 25 Jan 2024 19:30:17 +0100
> 
> On Thu, 2024-01-25 at 09:14 +0200, Eli Zaretskii wrote:
> > > From: hw <hw@adminart.net>
> > > Date: Wed, 24 Jan 2024 21:12:56 +0100
> > > 
> > > Also, I don't want possible restrictions to be restored, like
> > > (without-restriction) would do.
> > 
> > Why not?  After you do whatever you need to do with the widened
> > buffer, you are supposed to return the restrictions to their previous
> > state, and that includes restoring the restrictions present before the
> > widening.  Why would you need to avoid restoring them, and thus change
> > the restrictions behind some other Lisp program which doesn't expect
> > its restrictions to be lifted?
> 
> I want to behold the whole buffer after the operation was performed to
> see if the outcome looks ok.  And if the external program has found an
> error, it puts a message into the first line of its output (the
> buffer) which I'm unlikely to be able to see when the buffer is
> restricted.
> 
> Keeping or restoring restrictions wouldn't be useful.

The restrictions that cannot be lifted via a call to 'widen' aren't
supposed to be lifted.  IOW, a Lisp program that calls 'widen' is not
allowed to look beyond those restrictions that 'widen' cannot remove.
So what you want to do is not supposed to be done, and this is a
protocol of using restrictions in Emacs.

The problem is not serious, btw, since it is a very rare situation to
see such restrictions in practice.  So you can simply disregard that
possibility.