help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with simple script to clean out an ERC buffer


From: Jonathan Kyle Mitchell
Subject: Re: Problem with simple script to clean out an ERC buffer
Date: Tue, 5 Jun 2018 20:18:44 -0500

On Tue, Jun 5, 2018 at 4:21 PM, J. David Boyd <dboyd2@mmm.com> wrote:
>
>
> I've put this together:
>
>
> (defun clearERCbuffer()
> (interactive)
> (previous-line)
> (end-of-line)
> (set-mark(point))
> (beginning-of-buffer)
> (exchange-point-and-mark)
> ; (set-text-properties (point-min) (point-max) nil nil )
> (delete-region (point-min) (point-max)))
>
> (bind-key (kbd "H-C-c") 'clearERCbuffer)
>
>
> So I go into an ERC buffer, put the cursor at the prompt, hit H-C-c, and it
> always tells me that "Text is read-only"
>
> But, if I manually execute the commands above, and press C-w when I get to the
> delete-region command, it works fine.
>
> I tried the set-text-properties to remove any read-only attributes, but that
> makes no difference.
>
> What stupidly obvious item am I overlooking?
>
> Thanks,
>
> Dave in Hudson, FL


How about just:

(let ((inhibit-read-only t))
  (erase-buffer))

[1] 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Read-Only-Buffers.html

--
Jonathan Kyle Mitchell



reply via email to

[Prev in Thread] Current Thread [Next in Thread]