From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.devel Subject: Re: Signaling text-read-only Date: Tue, 15 Feb 2011 11:38:03 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1297766320 10335 80.91.229.12 (15 Feb 2011 10:38:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Feb 2011 10:38:40 +0000 (UTC) Cc: Emacs-Devel devel To: Leo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 15 11:38:36 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PpIIm-0004At-8y for ged-emacs-devel@m.gmane.org; Tue, 15 Feb 2011 11:38:36 +0100 Original-Received: from localhost ([127.0.0.1]:53096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpIIl-0001Ah-RS for ged-emacs-devel@m.gmane.org; Tue, 15 Feb 2011 05:38:35 -0500 Original-Received: from [140.186.70.92] (port=37111 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpIIb-00019i-LI for emacs-devel@gnu.org; Tue, 15 Feb 2011 05:38:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpIIa-0000cr-A8 for emacs-devel@gnu.org; Tue, 15 Feb 2011 05:38:25 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:41261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpIIa-0000cf-3D for emacs-devel@gnu.org; Tue, 15 Feb 2011 05:38:24 -0500 Original-Received: by iyi20 with SMTP id 20so6348646iyi.0 for ; Tue, 15 Feb 2011 02:38:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=RAuG26PgWtsID8WDPUK341pEwCb7ubzHWpJpLpBEJlk=; b=TiwSRFCWY/1mi13bw6lgj5Tc64bYfypd8ykcLhXF9YNionHa4hXhXtsyPJxdyc3zXy 0bLtlUakSNZKvTlC+mSNQwgWy+DiNLFNODv9MzA+h02egCZJbKZp12kESEtB5Js1COoD fTSqsLyMFZmNDrsgzELbH10SG/+LC2Y8Lhjus= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=X3u0tsEBrlkNW68D4e8vmHUxFSm179dCqWbzz62y+lWLiecjyx9B/AnGFJugt5n7V+ reuMoMa4DB3+Elb2LCGzmIW2PaFYdL6F7FyqO22Hp23nZkzQrvKIzHRI40sLQqUYZulZ Spe43nH1U4HKiQIY1dfx/T9yJDlRslYo8p6R0= Original-Received: by 10.231.11.77 with SMTP id s13mr3907562ibs.18.1297766303221; Tue, 15 Feb 2011 02:38:23 -0800 (PST) Original-Received: by 10.231.19.67 with HTTP; Tue, 15 Feb 2011 02:38:03 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136041 Archived-At: 2011/2/15 Leo : > On 2011-02-15 11:35 +0800, Deniz Dogan wrote: >> I have a situation here where I need to tell the user that the part of >> the buffer where point is located is read-only. This is what I am >> thinking right now: >> >> (unless (rcirc-looking-at-input) >> =A0 (error (error-message-string (list 'text-read-only))) >> >> or: >> >> (unless (rcirc-looking-at-input) >> =A0 (signal 'text-read-only nil))) >> >> I haven't found any examples of this explicit sort of signaling in the >> other Lisp files in Emacs, but I might have missed something. >> >> The reason why I need this is that `rcirc-complete' shouldn't be >> called in read-only areas of the buffer. >> >> What is the right way to do this? > > The question arose when Deniz and I discussed the patch here: > http://paste.pocoo.org/raw/gUNWgGTy4zMSI0ApR3vZ/ in #emacs. > > As required by completion-at-point-functions, it makes sense for > rcirc-completion-at-point to return nil when re-search-backward errs and > therefore for rcirc-complete to handle the case when completion table is > nil so I think the patch is applicable regardless of whether or not to > signal an error. > > I think it is good idea to give some feedback to user but I think > text-read-only is not the right one (the error is not caused by > text-read-only). It should probably be something like: > > (unless (rcirc-looking-at-input) > =A0(error "Point not located after rcirc prompt")) > > to be added at the very beginning of rcirc-complete function body. > > What do you think? > I'm fine with your error suggestion as well. I just figured it would make sense to signal text-read-only, since whatever the command completed to wouldn't be inserted at point, as that part of the buffer is read-only. --=20 Deniz Dogan