From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Whats the idiomatic way to erase a buffer? Date: Tue, 10 Dec 2019 09:17:43 -0500 Message-ID: References: <87wob4jmsh.fsf@blind.guru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="269824"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Mario Lang Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 10 15:18:05 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iegKu-0017wp-Hk for ged-emacs-devel@m.gmane.org; Tue, 10 Dec 2019 15:18:00 +0100 Original-Received: from localhost ([::1]:57374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iegKt-0001CM-7f for ged-emacs-devel@m.gmane.org; Tue, 10 Dec 2019 09:17:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52013) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iegKm-0001Bu-HQ for emacs-devel@gnu.org; Tue, 10 Dec 2019 09:17:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iegKk-0001N5-Pc for emacs-devel@gnu.org; Tue, 10 Dec 2019 09:17:51 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:50425) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iegKk-0001MT-Ig for emacs-devel@gnu.org; Tue, 10 Dec 2019 09:17:50 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B1F0B81895; Tue, 10 Dec 2019 09:17:49 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5EEFE8125C; Tue, 10 Dec 2019 09:17:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1575987467; bh=6WefDjkbGYzeoWN4X1BWR2ATZPiSJWBKNRemZfQq4Vs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RRnKRIkmictCOBr49OeoRuyo8Qw+P8+NHwXAylb/gLJtoztYNTO6MOMQ1T3tJ6dI0 AR3MP8gDAads1Zqi4lKLY8DnRTclsjXdGd4BqEdntcbLY1pXwY+4V/i1TUpOR+9sDT 2T7HPOKw4+OWZ4FrI4qwTe9syqKpaR/ofWNmdhTKLKdM/nBc2qIOczz59QXlQRR503 cUuFM2MGjVfQgC4w/6Dw/cdG16weEOIFeeyYJ7ufH0iy0kCiKhe0EpQTkV5X26YWL/ gmZgbMT8g4IIL31cQPBpd5YR+IFuMcGj8YuvnLcIdYyj/5FU/ZavukcgAMbYzZ6O41 y5ltKn/gVwi8w== Original-Received: from pastel (unknown [157.52.13.227]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3C81E121300; Tue, 10 Dec 2019 09:17:47 -0500 (EST) In-Reply-To: <87wob4jmsh.fsf@blind.guru> (Mario Lang's message of "Tue, 10 Dec 2019 15:08:30 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243281 Archived-At: > (defun my-func (name) > (with-current-buffer (get-buffer-create name) > (let ((inhibit-read-only t)) > (erase-buffer)) That look OK. > When I bury the buffer with 'q' and create the same > buffer, 'q' now complains: > > Text is read-only: "Attempt to change text outside editable field" I think you want to M-x toggle-debug-on-error RET, then reproduce the bug so we can see the backtrace which will hopefully clarify what's going on. It may be that the buffer has overlays that survive the erasure (as 0-length overlays) and then re-grow as text is inserted. Stefan