emacs-devel
[Top][All Lists]
Advanced

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

Re: Signaling text-read-only


From: Deniz Dogan
Subject: Re: Signaling text-read-only
Date: Tue, 15 Feb 2011 11:38:03 +0100

2011/2/15 Leo <address@hidden>:
> 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?
>

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.

-- 
Deniz Dogan



reply via email to

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