unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* question about narrowed behavior of next-property-change et al.
@ 2003-01-23  8:50 Miles Bader
  2003-01-23 16:12 ` Stefan Monnier
  2003-01-24  5:43 ` Richard Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: Miles Bader @ 2003-01-23  8:50 UTC (permalink / raw)


Info contains the following check to avoid refontifying fontified nodes:

   (defun Info-fontify-node ()
     ;; Only fontify the node if it hasn't already been done.
     (unless (next-property-change (point-min))
        ...

However, this often doesn't always work properly because it assumes that
`next-property-change' will return nil if there's no property change
before the narrowed end of the buffer, and in fact if there's a
property change _beyond_ the narrowed end, it will return (point-max),
even though the user passed a LIMIT arg of nil.

It's easy enough to change Info-fontify-node to be more paranoid, but to
me, the current behavior of `next-property-change' seems wrong in this
case -- I think if there's no property change before (point-max), and
the user passed LIMIT == nil, then it should return nil, regardless of
whether (point-max) is due to narrowing or not.

Any comments before I make such a change?

-Miles
-- 
`...the Soviet Union was sliding in to an economic collapse so comprehensive
 that in the end its factories produced not goods but bads: finished products
 less valuable than the raw materials they were made from.'  [The Economist]

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-23  8:50 question about narrowed behavior of next-property-change et al Miles Bader
@ 2003-01-23 16:12 ` Stefan Monnier
  2003-01-24  5:43 ` Richard Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2003-01-23 16:12 UTC (permalink / raw)
  Cc: emacs-devel

> It's easy enough to change Info-fontify-node to be more paranoid, but to
> me, the current behavior of `next-property-change' seems wrong in this
> case -- I think if there's no property change before (point-max), and
> the user passed LIMIT == nil, then it should return nil, regardless of
> whether (point-max) is due to narrowing or not.

100% agreement (obviously, for those who've looked at the changelog ;-)


	Stefan

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-23  8:50 question about narrowed behavior of next-property-change et al Miles Bader
  2003-01-23 16:12 ` Stefan Monnier
@ 2003-01-24  5:43 ` Richard Stallman
  2003-01-24  6:06   ` Miles Bader
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2003-01-24  5:43 UTC (permalink / raw)
  Cc: emacs-devel

    It's easy enough to change Info-fontify-node to be more paranoid, but to
    me, the current behavior of `next-property-change' seems wrong in this
    case -- I think if there's no property change before (point-max), and
    the user passed LIMIT == nil, then it should return nil, regardless of
    whether (point-max) is due to narrowing or not.

    Any comments before I make such a change?

It is certainly more logical that way--the question is, what will it
break?  It would be necessary to check all the programs that use
next-property-change and make sure they are still going to work.

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-24  5:43 ` Richard Stallman
@ 2003-01-24  6:06   ` Miles Bader
  2003-01-25 19:23     ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Miles Bader @ 2003-01-24  6:06 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:
>     I think if there's no property change before (point-max), and the
>     user passed LIMIT == nil, then it should return nil, regardless of
>     whether (point-max) is due to narrowing or not.
> 
> It is certainly more logical that way--the question is, what will it
> break?  It would be necessary to check all the programs that use
> next-property-change and make sure they are still going to work.

Since the suggested change would only effect narrowed buffers, and only
to make them act more like a normal non-narrowed buffer, I would think
that only code that explicitly uses narrowing is potentially a problem
(under the assumption that a narrowed buffer should usually appear to
lisp code as if it were a normal buffer containing only the narrowed
region).

Since most code is written assume a `normal' buffer, I suspect the net
effect of the current wierd behavior is to cause problems with such code
expecting the usual non-narrowed behavior in the rare case where it is
used with a narrowed buffer.

-Miles
-- 
Come now, if we were really planning to harm you, would we be waiting here, 
 beside the path, in the very darkest part of the forest?

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-24  6:06   ` Miles Bader
@ 2003-01-25 19:23     ` Richard Stallman
  2003-01-26  1:12       ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2003-01-25 19:23 UTC (permalink / raw)
  Cc: emacs-devel

    Since the suggested change would only effect narrowed buffers, and only
    to make them act more like a normal non-narrowed buffer, I would think
    that only code that explicitly uses narrowing is potentially a problem
    (under the assumption that a narrowed buffer should usually appear to
    lisp code as if it were a normal buffer containing only the narrowed
    region).

This reasoning is plausible indeed, but I still think that whoever
changes this should also check the callers one buy one.

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-25 19:23     ` Richard Stallman
@ 2003-01-26  1:12       ` Stefan Monnier
  2003-01-27  2:31         ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2003-01-26  1:12 UTC (permalink / raw)
  Cc: Miles Bader

>     Since the suggested change would only effect narrowed buffers, and only
>     to make them act more like a normal non-narrowed buffer, I would think
>     that only code that explicitly uses narrowing is potentially a problem
>     (under the assumption that a narrowed buffer should usually appear to
>     lisp code as if it were a normal buffer containing only the narrowed
>     region).
> 
> This reasoning is plausible indeed, but I still think that whoever
> changes this should also check the callers one buy one.

Instead of spending this time, I'd rather bet $1000 that Miles's change will
not introduce any new bug: it might make an existing bug show up more
often, but introducing a new bug with his suggested change seems incredibly
unlikely.


	Stefan

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-26  1:12       ` Stefan Monnier
@ 2003-01-27  2:31         ` Richard Stallman
  2003-01-27 13:33           ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2003-01-27  2:31 UTC (permalink / raw)
  Cc: miles

    Instead of spending this time, I'd rather bet $1000 that Miles's change will
    not introduce any new bug:

Thanks for the offer, but I don't know who we could pay to do
this checking with that $1000.  It needs to be checked.

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-27  2:31         ` Richard Stallman
@ 2003-01-27 13:33           ` Stefan Monnier
  2003-01-27 14:52             ` Miles Bader
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2003-01-27 13:33 UTC (permalink / raw)
  Cc: Stefan Monnier

>     Instead of spending this time, I'd rather bet $1000 that Miles's change will
>     not introduce any new bug:
> 
> Thanks for the offer, but I don't know who we could pay to do
> this checking with that $1000.  It needs to be checked.

No, it doesn't, because if you think about the possible case where
Miles's change can impact the behavior of code, you'll realize that
it can only do so for code that is already flawed.


	Stefan

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-27 13:33           ` Stefan Monnier
@ 2003-01-27 14:52             ` Miles Bader
  2003-01-29  0:06               ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Miles Bader @ 2003-01-27 14:52 UTC (permalink / raw)
  Cc: emacs-devel

On Mon, Jan 27, 2003 at 08:33:32AM -0500, Stefan Monnier wrote:
> No, it doesn't, because if you think about the possible case where
> Miles's change can impact the behavior of code, you'll realize that
> it can only do so for code that is already flawed.

... and I suspect in most cases where it has any effect, it will to _fix_ a
(yet undiscovered) bug, rather than creating one.  So even without any
checking, the net effect is likely to be positive rather than negative.

I did a grep for "{next,prev}{,-single}-property-change" (which I think is
the set of functions effect), and there are over 200 occurances (most of
which are actually the `-single' variants).  This seems enough that doing any
kind of thorough check is a fair burden, and I really don't think it's worth
the time.

What about just doing some spot checks, just to see if there appear to be any
cases where the current undocumented behavior is relied upon?

-Miles
-- 
Ich bin ein Virus. Mach' mit und kopiere mich in Deine .signature.

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

* Re: question about narrowed behavior of next-property-change et al.
  2003-01-27 14:52             ` Miles Bader
@ 2003-01-29  0:06               ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2003-01-29  0:06 UTC (permalink / raw)
  Cc: monnier+gnu/emacs

    I did a grep for "{next,prev}{,-single}-property-change" (which I think is
    the set of functions effect), and there are over 200 occurances (most of
    which are actually the `-single' variants).  This seems enough that doing any
    kind of thorough check is a fair burden, and I really don't think it's worth
    the time.

I think you can check them all in an hour.  Why not?

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

end of thread, other threads:[~2003-01-29  0:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-23  8:50 question about narrowed behavior of next-property-change et al Miles Bader
2003-01-23 16:12 ` Stefan Monnier
2003-01-24  5:43 ` Richard Stallman
2003-01-24  6:06   ` Miles Bader
2003-01-25 19:23     ` Richard Stallman
2003-01-26  1:12       ` Stefan Monnier
2003-01-27  2:31         ` Richard Stallman
2003-01-27 13:33           ` Stefan Monnier
2003-01-27 14:52             ` Miles Bader
2003-01-29  0:06               ` 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).