From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: Signaling text-read-only Date: Tue, 15 Feb 2011 12:52:55 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1297745610 14222 80.91.229.12 (15 Feb 2011 04:53:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Feb 2011 04:53:30 +0000 (UTC) Cc: Emacs-Devel devel To: Deniz Dogan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 15 05:53:19 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 1PpCud-0001i0-7R for ged-emacs-devel@m.gmane.org; Tue, 15 Feb 2011 05:53:19 +0100 Original-Received: from localhost ([127.0.0.1]:35762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpCuc-0005vz-CX for ged-emacs-devel@m.gmane.org; Mon, 14 Feb 2011 23:53:18 -0500 Original-Received: from [140.186.70.92] (port=51536 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpCuV-0005tH-FN for emacs-devel@gnu.org; Mon, 14 Feb 2011 23:53:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpCuT-0000zu-NU for emacs-devel@gnu.org; Mon, 14 Feb 2011 23:53:11 -0500 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:65194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpCuT-0000zn-IW for emacs-devel@gnu.org; Mon, 14 Feb 2011 23:53:09 -0500 Original-Received: by gyd10 with SMTP id 10so2679024gyd.0 for ; Mon, 14 Feb 2011 20:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=ZZ9VtsEBdDJQukjg0ZmcPtPfmgtiBcykR4EWUEfYF1E=; b=pp5v3IP754QPfIsLJ1z+N06TXzdPF68wTasp2+0lrERiqzn85sb+zwRdtSj28tpcH2 LiZ6+mUqXJSYyIuD2QVvxOnU4k5N0QUfC2hAKUxsMW73M8+3cgGB0mzOIeloEwfFDXw0 eC7wNrqlT4UkOFkEjLFHthrDOhb63gbEBAuYc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=lKnRwr9W8MsSmD7oshJuumng53mnqAakMwPFd5/7Bmk01CtbUgejLafFSYNQeJV5JZ VYeuaF+A1qwhx81MUnrD2TZN957r5xFHOPd30vEXMBb2j0u/cF5ih6Dl3IypHLJqbU+9 SW/dZDarBmfOHXOfevt/VpeUEh1Ay7PLAdNbM= Original-Received: by 10.150.144.15 with SMTP id r15mr5446584ybd.74.1297745588536; Mon, 14 Feb 2011 20:53:08 -0800 (PST) Original-Received: from Victoria.local ([124.72.187.49]) by mx.google.com with ESMTPS id k1sm2067983ybj.0.2011.02.14.20.53.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Feb 2011 20:53:07 -0800 (PST) In-Reply-To: (Deniz Dogan's message of "Tue, 15 Feb 2011 04:35:12 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.93 (Mac OS X 10.6.6) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.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:136034 Archived-At: 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) > (error (error-message-string (list 'text-read-only))) > > or: > > (unless (rcirc-looking-at-input) > (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) (error "Point not located after rcirc prompt")) to be added at the very beginning of rcirc-complete function body. What do you think? Leo