unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* get-text-property error if narrowed
@ 2007-12-28 20:24 Lennart Borgman (gmail)
  2007-12-29 13:51 ` Richard Stallman
  2007-12-29 17:47 ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-28 20:24 UTC (permalink / raw)
  To: Emacs Devel

get-text-property signals an error if the position argument is outside a 
narrowed region. That is very inconvenient. It would be much better if 
it behaved like get-char-property which does not do this.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: get-text-property error if narrowed
  2007-12-28 20:24 get-text-property error if narrowed Lennart Borgman (gmail)
@ 2007-12-29 13:51 ` Richard Stallman
  2007-12-29 15:14   ` Lennart Borgman (gmail)
  2007-12-29 17:47 ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-12-29 13:51 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

    get-text-property signals an error if the position argument is outside a 
    narrowed region. That is very inconvenient. It would be much better if 
    it behaved like get-char-property which does not do this.

I just tried (get-char-property 1 'face) in my Rmail buffer and got an
error, so I think the two functions are alike in this regard.
I think that an error is the correct result in that case.
(buffer-substring also gives an error when the positions are out of range.)
Why do you think otherwise?

Is there a case in which get-char-property fails to give this error?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: get-text-property error if narrowed
  2007-12-29 13:51 ` Richard Stallman
@ 2007-12-29 15:14   ` Lennart Borgman (gmail)
  2007-12-30  1:37     ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-29 15:14 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:
>     get-text-property signals an error if the position argument is outside a 
>     narrowed region. That is very inconvenient. It would be much better if 
>     it behaved like get-char-property which does not do this.
> 
> I just tried (get-char-property 1 'face) in my Rmail buffer and got an
> error, so I think the two functions are alike in this regard.
> I think that an error is the correct result in that case.
> (buffer-substring also gives an error when the positions are out of range.)
> Why do you think otherwise?
> 
> Is there a case in which get-char-property fails to give this error?

I think it happens when there is a property on an overlay. 
get-char-property finds that and returns it. If there is no overlay with 
the tested property then I get an error. (Note that I am using a CVS 
version from 2007-06-04.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: get-text-property error if narrowed
  2007-12-28 20:24 get-text-property error if narrowed Lennart Borgman (gmail)
  2007-12-29 13:51 ` Richard Stallman
@ 2007-12-29 17:47 ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2007-12-29 17:47 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

    get-text-property signals an error if the position argument is outside a 
    narrowed region. That is very inconvenient. It would be much better if 
    it behaved like get-char-property which does not do this.

I just tried (get-char-property 1 'face) in my Rmail buffer and got an
error, so I think the two functions are alike in this regard.
I think that an error is the correct result in that case.
(buffer-substring also gives an error when the positions are out of range.)
Why do you think otherwise?

Is there a case in which get-char-property fails to give this error?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: get-text-property error if narrowed
  2007-12-29 15:14   ` Lennart Borgman (gmail)
@ 2007-12-30  1:37     ` Richard Stallman
  2007-12-30  1:47       ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-12-30  1:37 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

    I think it happens when there is a property on an overlay. 
    get-char-property finds that and returns it. If there is no overlay with 
    the tested property then I get an error. (Note that I am using a CVS 
    version from 2007-06-04.)

I think it is a bug not to get an error in that case.

However, you said you prefer that behavior.  Could you tell me why?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: get-text-property error if narrowed
  2007-12-30  1:37     ` Richard Stallman
@ 2007-12-30  1:47       ` Lennart Borgman (gmail)
  2007-12-30 14:02         ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-30  1:47 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:
>     I think it happens when there is a property on an overlay. 
>     get-char-property finds that and returns it. If there is no overlay with 
>     the tested property then I get an error. (Note that I am using a CVS 
>     version from 2007-06-04.)
> 
> I think it is a bug not to get an error in that case.
> 
> However, you said you prefer that behavior.  Could you tell me why?

It is just that I prefer consistency.

I made a mistake when I said that no error should be raised. It is 
clearly better to get an error since in many cases it would be a mistake 
to access a point outside the narrowed region.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: get-text-property error if narrowed
  2007-12-30  1:47       ` Lennart Borgman (gmail)
@ 2007-12-30 14:02         ` Richard Stallman
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2007-12-30 14:02 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

I made get-char-property give the proper error.
Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-12-30 14:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-28 20:24 get-text-property error if narrowed Lennart Borgman (gmail)
2007-12-29 13:51 ` Richard Stallman
2007-12-29 15:14   ` Lennart Borgman (gmail)
2007-12-30  1:37     ` Richard Stallman
2007-12-30  1:47       ` Lennart Borgman (gmail)
2007-12-30 14:02         ` Richard Stallman
2007-12-29 17:47 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).