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: J. David Boyd
Subject: Re: Problem with simple script to clean out an ERC buffer
Date: Wed, 06 Jun 2018 08:29:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (cygwin)

Jonathan Kyle Mitchell <kyle@jonathanmitchell.org> writes:

> 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


Thanks, that did the trick.  Always grateful the help that is available here!

Dave in Hudson, FL




reply via email to

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