From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: dboyd2@mmm.com (J. David Boyd) Newsgroups: gmane.emacs.help Subject: Re: Problem with simple script to clean out an ERC buffer Date: Wed, 06 Jun 2018 08:29:40 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528288118 4530 195.159.176.226 (6 Jun 2018 12:28:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 6 Jun 2018 12:28:38 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (cygwin) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 06 14:28:34 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQXYI-00015f-5g for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Jun 2018 14:28:34 +0200 Original-Received: from localhost ([::1]:52126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQXaP-0002Z7-9A for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Jun 2018 08:30:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQXZY-0002DP-Jt for help-gnu-emacs@gnu.org; Wed, 06 Jun 2018 08:29:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQXZV-0007Pi-G0 for help-gnu-emacs@gnu.org; Wed, 06 Jun 2018 08:29:52 -0400 Original-Received: from [195.159.176.226] (port=56592 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQXZV-0007NJ-9h for help-gnu-emacs@gnu.org; Wed, 06 Jun 2018 08:29:49 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fQXXM-0008OU-1z for help-gnu-emacs@gnu.org; Wed, 06 Jun 2018 14:27:36 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:OMYDSifhgH4Nkd4S586Ei5hWZVM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116985 Archived-At: Jonathan Kyle Mitchell writes: > On Tue, Jun 5, 2018 at 4:21 PM, J. David Boyd 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