emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: before- and after-string issues


From: Richard Stallman
Subject: Re: before- and after-string issues
Date: Fri, 20 May 2005 17:56:52 -0400

    (let ((B (make-overlay (point) (1+ (point))))
           (A (make-overlay (point) (1+ (point)))))
       (overlay-put B 'before-string "B")
       (overlay-put A 'after-string "A"))

    should get you two overlays covering one character with "B" appearing
    before and "A" after the character.  Deleting that character will cause
    the overlays to change places resulting in something like "AB".

Now I see what you mean.  However, I am coming to the conclusion
that the problem is overdetermined--that there is no solution
that will DTRT in all the cases we have considered.

In most cases we want after-strings to come before before-strings.
The after-strings are associated with the previous character(s) while
the before-strings are associated with the following character(s).

In your case, we would like the before-string to come first because of
history which is not represented in the actual buffer status.  I don't
see how we could DTRT in this case based on current buffer status
without making the behavior incorrect for other cases.

Consider this code:

    (let ((B (make-overlay (point) (1+ (point))))
           (A (make-overlay (1- (point)) (point))))
       (overlay-put B 'before-string "B")
       (overlay-put A 'after-string "A"))

Here it is proper for A to precede B.  If we delete the two
characters around point, we get a situation of exactly the same
sort that your example produces.  Except that in this case
we would want A to still precede B.

I think this proves that the only way to get "correct" results
in all cases involving empty overlays is to record something about
their history when they were nonempty.  Exactly what sort of
history information would do the job, I am not sure.

Would you like to start experimenting with such solutions,
and report back later if you find one that seems to work?




reply via email to

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