[Top][All Lists]

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

Re: Signaling text-read-only

From: Leo
Subject: Re: Signaling text-read-only
Date: Tue, 15 Feb 2011 12:52:55 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.93 (Mac OS X 10.6.6)

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?


reply via email to

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