From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mario Lang Newsgroups: gmane.emacs.devel Subject: Re: Whats the idiomatic way to erase a buffer? Date: Tue, 10 Dec 2019 18:47:15 +0100 Message-ID: <87h828ax98.fsf@blind.guru> References: <87wob4jmsh.fsf@blind.guru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="125924"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 10 18:48:13 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 1iejcL-000We9-GH for ged-emacs-devel@m.gmane.org; Tue, 10 Dec 2019 18:48:13 +0100 Original-Received: from localhost ([::1]:60496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iejcK-00048L-66 for ged-emacs-devel@m.gmane.org; Tue, 10 Dec 2019 12:48:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iejbX-00046K-2y for emacs-devel@gnu.org; Tue, 10 Dec 2019 12:47:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iejbW-00040G-1f for emacs-devel@gnu.org; Tue, 10 Dec 2019 12:47:22 -0500 Original-Received: from familiekainz.at ([37.187.20.171]:50132 helo=ns3035380.ip-37-187-20.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iejbV-0003zh-RS for emacs-devel@gnu.org; Tue, 10 Dec 2019 12:47:21 -0500 Original-Received: by ns3035380.ip-37-187-20.eu (Postfix, from userid 110) id 4F7441215; Tue, 10 Dec 2019 17:47:19 +0000 (UTC) Original-Received: from x1.blind.guru (84-115-55-45.cable.dynamic.surfer.at [84.115.55.45]) by ns3035380.ip-37-187-20.eu (Postfix) with ESMTPSA id 7EE2D957 for ; Tue, 10 Dec 2019 17:47:17 +0000 (UTC) Original-Received: by x1.blind.guru (Postfix, from userid 1000) id 9F977E82BFB; Tue, 10 Dec 2019 18:47:15 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Tue, 10 Dec 2019 09:17:43 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 37.187.20.171 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:243285 Archived-At: Stefan Monnier writes: >> (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 is not an error I'm afraid. First time around, C-h k q gives me q runs the command bury-buffer (found in sclang-scdoc-mode-map) but the second time around I get q runs the command self-insert-command (found in global-map) However, major-mode evalutes to sclang-scdoc-mode in both cases. And sclang-scdoc-mode is defined as: (defvar sclang-scdoc-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map widget-browse-mode-map) (define-key map (kbd "C-c C-f") #'sclang-scdoc-find-schelp) (define-key map (kbd "C-c C-h") #'sclang-find-scdoc) (define-key map (kbd "C-c C-s") #'sclang-main-stop) (define-key map (kbd "C-c C-w") #'sclang-switch-to-workspace) (define-key map (kbd "C-M-x") 'sclang-eval-defun) map)) (define-derived-mode sclang-scdoc-mode widget-browse-mode "SCDoc" "Major mode for displaying SuperCollider Documentation." (sclang-init-document) (sclang-make-document)) > It may be that the buffer has overlays that survive the erasure (as > 0-length overlays) and then re-grow as text is inserted. Since I am using `widget-create' a lot, that might be a possibility. How do I eliminate overlays in a buffer? --=20 CYa, =E2=A1=8D=E2=A0=81=E2=A0=97=E2=A0=8A=E2=A0=95