[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Whats the idiomatic way to erase a buffer?
From: |
Stefan Monnier |
Subject: |
Re: Whats the idiomatic way to erase a buffer? |
Date: |
Tue, 10 Dec 2019 09:17:43 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> (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