unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1176: redisplay bugs
@ 2008-10-15 16:10 ` Richard M. Stallman
  2008-10-21  2:12   ` Glenn Morris
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Richard M. Stallman @ 2008-10-15 16:10 UTC (permalink / raw)
  To: emacs-pretest-bug

I found this while reviewing old mail.

I think I may have fixed one or two of these bugs, but most of them
probably still exist.  There are four messages included below.

X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: bug-gnu-emacs@gnu.org
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Wed, 19 Sep 2007 14:18:07 +0100
Message-ID: <86ps0ebxps.fsf@macs.hw.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: anomalies of overlays and before-string and display properties

There are a number of strange anomalies (some clearly bugs) in the
behavior of overlays and before-string and display properties.

1. Faces on a display property on a before-string behave differently
   depending on where the display property is in the before-string.
   For a display property at the beginning of the before-string, its
   face is used and the before-string's face is ignored (I think this
   is correct).  For a display property not at the beginning of the
   before-string, its face is completely ignored, and the face of the
   before-string is used instead.  This is fairly clearly a bug.

2. When a substring of a before-string beginning at offset O has a
   display property which is a string S, the first O characters of S
   are not displayed.  If S is not at least O+1 characters long, then
   disastrous things start to happen.  This is clearly a bug.

3. The before-string somehow œÎòÌinheritsœÎòÜ face attributes from the face
   of the character that follows the start of the overlay.  (If the
   overlay is of length zero, this character is not even in the
   overlay.  See the recent discussion of how this problem is
   affecting linum.el.)  This means that in practice a before-string
   needs to use completely specified faces, which is obviously a real
   pain.

4. The display property of an overlay somehow œÎòÌinheritsœÎòÜ face
   attributes from the face of the character that follows the start of
   the overlay.  This has similar disadvantages to anomaly #3
   mentioned above.

5. The help-echo and mouse-face properties of an overlay with both a
   before-string and a display property only affect the material
   displayed by the overlay's display property.  One can work around
   the issue by copying these properties to the various display
   properties inside the before-string; however, this workaround is a
   pain and in the case of mouse-face it doesn't get the entire
   overlay highlighted at once but instead only the pieces are
   highlighted one at a time.  It would be nice to be able to set a
   single help-echo or a single mouse-face property that would affect
   the _entire_ overlay.

You can reproduce all of these anomalies with this function:

  (defun illustrate-anomalies ()
    (let ((s #1=#("\\abcd{VWXYZ}"
                  0 5 (face (:foreground "Purple" :background "yellow"))
                  5 12
                  (face
                   (:foreground
                    "DarkOliveGreen"
                    :weight bold :slant oblique :height 0.8))))
          (props
           '(help-echo
             #1#
             ;;face (:slant italic :foreground "red")
             display "]"
             before-string
             #("  "
               0 1
               (display
                #("|["
                  0 2 (;; help-echo #1#
                       face #2=(:strike-through t :background "white")))
                ;; help-echo #1#
                face #3=(:underline t))
               1 2
               (display
                #("||VWXYZ"
                  0 7 (;; help-echo #1#
                       ;; mouse-face (:background "darkseagreen2")
                       face #2#))
                ;; help-echo #1#
                face #3#))
             mouse-face (:background "darkseagreen2")))
          (buf (get-buffer-create "xyzzy")))
      (with-current-buffer buf
        (display-buffer buf)
        (erase-buffer)
        (dolist (o (overlays-in (point-min) (point-max)))
          (delete-overlay o))
        (insert s)
        (let ((o (make-overlay (point-min) (point-max))))
          (while props
            (overlay-put o (car props) (cadr props))
            (setq props (nthcdr 2 props)))))))

This example is derived from some work where I was trying to get
AUCTeX's folding mode to show the fontified and latex-previewed
contents of macro arguments.

I hope this problem report is useful.

Joe

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: jbw
  value of $LANG: nil
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Minor modes in effect:
  outline-minor-mode: t
  desktop-save-mode: t
  url-handler-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t



X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: bug-gnu-emacs@gnu.org
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Wed, 19 Sep 2007 14:27:22 +0100
In-Reply-To: <86ps0ebxps.fsf@macs.hw.ac.uk> (Joe Wells's message of "Wed\,
	19 Sep 2007 14\:18\:07 +0100")
Message-ID: <86lkb2bxad.fsf@macs.hw.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: Re: anomalies of overlays and before-string and display properties

By the way, with one exception, these problems also occur with
after-string properties.

The exception is that the overlay's mouse-face property does correctly
cover both the overlays display and after-string properties.  This is
more evidence that not covering the before-string property is a bug.

Strangely, the after-string also œÎòÌinheritsœÎòÜ face attributes from the
character after the beginning of the overlay, not the character just
before the _end_ of the overlay.  This is more evidence that this is a
bug and not a feature.

Joe

Joe Wells <jbw@macs.hw.ac.uk> writes:

> There are a number of strange anomalies (some clearly bugs) in the
> behavior of overlays and before-string and display properties.
>
> 1. Faces on a display property on a before-string behave differently
>    depending on where the display property is in the before-string.
>    For a display property at the beginning of the before-string, its
>    face is used and the before-string's face is ignored (I think this
>    is correct).  For a display property not at the beginning of the
>    before-string, its face is completely ignored, and the face of the
>    before-string is used instead.  This is fairly clearly a bug.
>
> 2. When a substring of a before-string beginning at offset O has a
>    display property which is a string S, the first O characters of S
>    are not displayed.  If S is not at least O+1 characters long, then
>    disastrous things start to happen.  This is clearly a bug.
>
> 3. The before-string somehow œÎòÌinheritsœÎòÜ face attributes from the face
>    of the character that follows the start of the overlay.  (If the
>    overlay is of length zero, this character is not even in the
>    overlay.  See the recent discussion of how this problem is
>    affecting linum.el.)  This means that in practice a before-string
>    needs to use completely specified faces, which is obviously a real
>    pain.
>
> 4. The display property of an overlay somehow œÎòÌinheritsœÎòÜ face
>    attributes from the face of the character that follows the start of
>    the overlay.  This has similar disadvantages to anomaly #3
>    mentioned above.
>
> 5. The help-echo and mouse-face properties of an overlay with both a
>    before-string and a display property only affect the material
>    displayed by the overlay's display property.  One can work around
>    the issue by copying these properties to the various display
>    properties inside the before-string; however, this workaround is a
>    pain and in the case of mouse-face it doesn't get the entire
>    overlay highlighted at once but instead only the pieces are
>    highlighted one at a time.  It would be nice to be able to set a
>    single help-echo or a single mouse-face property that would affect
>    the _entire_ overlay.
>
> You can reproduce all of these anomalies with this function:
>
>   (defun illustrate-anomalies ()
>     (let ((s #1=#("\\abcd{VWXYZ}"
>                   0 5 (face (:foreground "Purple" :background "yellow"))
>                   5 12
>                   (face
>                    (:foreground
>                     "DarkOliveGreen"
>                     :weight bold :slant oblique :height 0.8))))
>           (props
>            '(help-echo
>              #1#
>              ;;face (:slant italic :foreground "red")
>              display "]"
>              before-string
>              #("  "
>                0 1
>                (display
>                 #("|["
>                   0 2 (;; help-echo #1#
>                        face #2=(:strike-through t :background "white")))
>                 ;; help-echo #1#
>                 face #3=(:underline t))
>                1 2
>                (display
>                 #("||VWXYZ"
>                   0 7 (;; help-echo #1#
>                        ;; mouse-face (:background "darkseagreen2")
>                        face #2#))
>                 ;; help-echo #1#
>                 face #3#))
>              mouse-face (:background "darkseagreen2")))
>           (buf (get-buffer-create "xyzzy")))
>       (with-current-buffer buf
>         (display-buffer buf)
>         (erase-buffer)
>         (dolist (o (overlays-in (point-min) (point-max)))
>           (delete-overlay o))
>         (insert s)
>         (let ((o (make-overlay (point-min) (point-max))))
>           (while props
>             (overlay-put o (car props) (cadr props))
>             (setq props (nthcdr 2 props)))))))
>
> This example is derived from some work where I was trying to get
> AUCTeX's folding mode to show the fontified and latex-previewed
> contents of macro arguments.
>
> I hope this problem report is useful.
>
> Joe
>
> ======================================================================
> In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
>  of 2007-06-27 on artemis
> Windowing system distributor `The X.Org Foundation', version 11.0.70000000
> configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: en_US.UTF-8
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: jbw
>   value of $LANG: nil
>   locale-coding-system: utf-8
>   default-enable-multibyte-characters: t
>
> Minor modes in effect:
>   outline-minor-mode: t
>   desktop-save-mode: t
>   url-handler-mode: t
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   unify-8859-on-encoding-mode: t
>   utf-translate-cjk-mode: t
>   auto-compression-mode: t
>   temp-buffer-resize-mode: t
>   size-indication-mode: t
>   line-number-mode: t
>   transient-mark-mode: t



X-Spam-Status: No, score=0.7 required=5.0 tests=SUBJ_HAS_SPACES autolearn=no 
	version=3.1.0
To: rms@gnu.org
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Fwd: overlay face property not used for after-string 	property
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Mon, 29 Oct 2007 09:57:59 +0000
In-Reply-To: <E1ImQpD-0001Si-VV@fencepost.gnu.org> (Richard Stallman's message of "Mon\, 29 Oct 2007 05\:22\:23 -0400")
Message-ID: <86bqaixmxk.fsf@macs.hw.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8

Richard Stallman <rms@gnu.org> writes:

>     > Can someone write a patch so that the overlay's face property (and
>     > other display-related properties) won't apply to its before-string?
>     >
>     > Joe, what do you think about that as a solution?
>
>     I think that would be an improvement.  I think the best solution would
>     be for the face property of an overlay (and similar properties) to not
>     apply to the before-string, the after-string, _and_ the display
>     property of the overlay.
>
> Can someone implement that?  It should not be fundamentally hard;
> making the properties apply is what is hard.
>
>     Note that there are additional problems.  One example (which I have
>     already reported) is that the face of the character in the buffer
>     after the overlay start location (which is not even in the overlay if
>     the overlay is of length zero) is applied to the before-string and
>     display properties of the overlay.
>
> The fix we are discussing will get rid of this problem, right?

No, the problem with the before-string/display/after-string properties
being affected by a face from the buffer appears to be a completely
unrelated issue which will need to be debugged separately.

> 					Another example (which I think I
>     have not previously reported) is that the face of the character in the
>     buffer _after_ the overlay end location (which is _never_ in the
>     overlay) is applied to the after-string property.
>
> Let's consider that after this fix is done; perhaps this will
> solve that other problem as a byproduct.

I can't see any way that the change proposed here will help with that
problem.




By the way, changing topic to something else I mentioned in my earlier
message:  Johan Bockgård pointed out in another message that the
convenience functions font-lock-prepend-text-property and
font-lock-append-text-property already exist for the purpose of adding
faces to text (strings or buffer contents) that already have face
properties.  However, I have pointed out in a new bug report that
these functions don't work correctly for all possible face property
values (and indeed they sometimes raise errors).

-- 
Joe

X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: bug-gnu-emacs@gnu.org
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Tue, 18 Sep 2007 23:20:07 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: redisplay goes horribly wrong when a before-string contains
	multiple display properties

Redisplay goes horribly wrong when a before-string contains multiple
display properties.

Reproduce by evaluating this expression:

  (let ((buf (get-buffer-create "foo")))
    (with-current-buffer buf
      (display-buffer buf)
      (erase-buffer)
      (dolist (o (overlays-in (point-min) (point-max)))
        (delete-overlay o))
      (insert "ABC")
      (let ((o (make-overlay 2 3))
            (s (make-string 5 ?X)))
        (put-text-property 0 1 'display "1" s)
        (put-text-property 1 2 'display "2" s)
        (put-text-property 2 3 'display "3" s)
        (put-text-property 3 4 'display "4" s)
        (put-text-property 4 5 'display "5" s)
        (overlay-put o 'display "Y")
        (overlay-put o 'before-string s))))

The correct behavior would be to see the buffer ?foo? pop up
displaying the characters ?A12345YC?.  The horribly wrong behavior
that actually happens is that redisplay of the buffer stops completely
after ?A1? is shown.  Strangely, the ?XXXXX? (which should not be
displayed anywhere) will be displayed in the echo area.  Scary errors
start occurring if one tries to do work in the buffer after this.

By the way, it would be really nice if this worked, because it would
be an easy way to display a number of display specifications for a
single overlay, which would make it much easier to get the features of
AUCTeX's tex-fold.el to work together with the features of
latex-preview.  (What is needed is being able to display strings
interleaved with images.)

Joe

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: jbw
  value of $LANG: nil
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  TeX-source-specials-mode: t
  auto-fill-function: do-auto-fill
  shell-dirtrack-mode: t
  outline-minor-mode: t
  desktop-save-mode: t
  url-handler-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t







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

* bug#1176: redisplay bugs
  2008-10-15 16:10 ` bug#1176: redisplay bugs Richard M. Stallman
@ 2008-10-21  2:12   ` Glenn Morris
  2008-10-21  2:48   ` Glenn Morris
  2008-10-22  1:55   ` bug#1176: marked as done (redisplay bugs) Emacs bug Tracking System
  2 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2008-10-21  2:12 UTC (permalink / raw)
  To: 1176


> Redisplay goes horribly wrong when a before-string contains multiple
> display properties.
>
> Reproduce by evaluating this expression:
>
>   (let ((buf (get-buffer-create "foo")))
>     (with-current-buffer buf
>       (display-buffer buf)
>       (erase-buffer)
>       (dolist (o (overlays-in (point-min) (point-max)))
>         (delete-overlay o))
>       (insert "ABC")
>       (let ((o (make-overlay 2 3))
>             (s (make-string 5 ?X)))
>         (put-text-property 0 1 'display "1" s)
>         (put-text-property 1 2 'display "2" s)
>         (put-text-property 2 3 'display "3" s)
>         (put-text-property 3 4 'display "4" s)
>         (put-text-property 4 5 'display "5" s)
>         (overlay-put o 'display "Y")
>         (overlay-put o 'before-string s))))
>
> The correct behavior would be to see the buffer ?foo? pop up
> displaying the characters ?A12345YC?.  The horribly wrong behavior
> that actually happens is that redisplay of the buffer stops completely
> after ?A1? is shown.


This piece appears to be fixed in 22.2 and up.






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

* bug#1176: redisplay bugs
  2008-10-15 16:10 ` bug#1176: redisplay bugs Richard M. Stallman
  2008-10-21  2:12   ` Glenn Morris
@ 2008-10-21  2:48   ` Glenn Morris
  2008-10-22  1:55   ` bug#1176: marked as done (redisplay bugs) Emacs bug Tracking System
  2 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2008-10-21  2:48 UTC (permalink / raw)
  To: 1176



I found all this rather hard to understand. "I expected to see", "I
actually saw", never mind separate bugs, would have made it a lot
easier.


> 1. Faces on a display property on a before-string behave differently
>    depending on where the display property is in the before-string.
>    For a display property at the beginning of the before-string, its
>    face is used and the before-string's face is ignored (I think this
>    is correct).  For a display property not at the beginning of the
>    before-string, its face is completely ignored, and the face of the
>    before-string is used instead.

Appears to be fixed in 22.2 and up.

I base this on the strike-through face appearing on the whole
before-string in 22.2, but only on the first two chars in 22.1.

And on the background of only the first two characters being white in
22.1 (the rest being yellow), but all being white in 22.2

> 2. When a substring of a before-string beginning at offset O has a
>    display property which is a string S, the first O characters of S
>    are not displayed.  If S is not at least O+1 characters long, then
>    disastrous things start to happen.  This is clearly a bug.

Appears to be fixed in 22.2 and up.

I base this on seeing only one "|" before VWXYZ in 22.1, but two in 22.2.

> 3. The before-string somehow inherits face attributes from the face
> of the character that follows the start of the overlay.

Appears to be fixed in 22.2 and up.

I base this on seeing underlining and a yellow background on "VWXYZ"
in 22.1, but not 22.2.

> 4. The display property of an overlay somehow inherits face
> attributes from the face of the character that follows the start of
> the overlay.

I think this one still applies. The "]" in the example has a yellow
background.

> 5. The help-echo and mouse-face properties of an overlay with both a
> before-string and a display property only affect the material
> displayed by the overlay's display property.

This appears to still be the case. Only the "]" in the example has
mouse-face and help-echo.






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

* bug#1176: marked as done (redisplay bugs)
  2008-10-15 16:10 ` bug#1176: redisplay bugs Richard M. Stallman
  2008-10-21  2:12   ` Glenn Morris
  2008-10-21  2:48   ` Glenn Morris
@ 2008-10-22  1:55   ` Emacs bug Tracking System
  2 siblings, 0 replies; 4+ messages in thread
From: Emacs bug Tracking System @ 2008-10-22  1:55 UTC (permalink / raw)
  To: Glenn Morris

[-- Attachment #1: Type: text/plain, Size: 796 bytes --]


Your message dated Tue, 21 Oct 2008 21:43:32 -0400
with message-id <t1ej29flq3.fsf@fencepost.gnu.org>
and subject line Re: redisplay bugs
has caused the Emacs bug report #1176,
regarding redisplay bugs
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
1176: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1176
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 20816 bytes --]

From: "Richard M. Stallman" <rms@gnu.org>
To: emacs-pretest-bug@gnu.org
Subject: redisplay bugs
Date: Wed, 15 Oct 2008 12:10:01 -0400
Message-ID: <E1Kq8wj-0004Qb-Lq@fencepost.gnu.org>

I found this while reviewing old mail.

I think I may have fixed one or two of these bugs, but most of them
probably still exist.  There are four messages included below.

X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: bug-gnu-emacs@gnu.org
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Wed, 19 Sep 2007 14:18:07 +0100
Message-ID: <86ps0ebxps.fsf@macs.hw.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: anomalies of overlays and before-string and display properties

There are a number of strange anomalies (some clearly bugs) in the
behavior of overlays and before-string and display properties.

1. Faces on a display property on a before-string behave differently
   depending on where the display property is in the before-string.
   For a display property at the beginning of the before-string, its
   face is used and the before-string's face is ignored (I think this
   is correct).  For a display property not at the beginning of the
   before-string, its face is completely ignored, and the face of the
   before-string is used instead.  This is fairly clearly a bug.

2. When a substring of a before-string beginning at offset O has a
   display property which is a string S, the first O characters of S
   are not displayed.  If S is not at least O+1 characters long, then
   disastrous things start to happen.  This is clearly a bug.

3. The before-string somehow œÎòÌinheritsœÎòÜ face attributes from the face
   of the character that follows the start of the overlay.  (If the
   overlay is of length zero, this character is not even in the
   overlay.  See the recent discussion of how this problem is
   affecting linum.el.)  This means that in practice a before-string
   needs to use completely specified faces, which is obviously a real
   pain.

4. The display property of an overlay somehow œÎòÌinheritsœÎòÜ face
   attributes from the face of the character that follows the start of
   the overlay.  This has similar disadvantages to anomaly #3
   mentioned above.

5. The help-echo and mouse-face properties of an overlay with both a
   before-string and a display property only affect the material
   displayed by the overlay's display property.  One can work around
   the issue by copying these properties to the various display
   properties inside the before-string; however, this workaround is a
   pain and in the case of mouse-face it doesn't get the entire
   overlay highlighted at once but instead only the pieces are
   highlighted one at a time.  It would be nice to be able to set a
   single help-echo or a single mouse-face property that would affect
   the _entire_ overlay.

You can reproduce all of these anomalies with this function:

  (defun illustrate-anomalies ()
    (let ((s #1=#("\\abcd{VWXYZ}"
                  0 5 (face (:foreground "Purple" :background "yellow"))
                  5 12
                  (face
                   (:foreground
                    "DarkOliveGreen"
                    :weight bold :slant oblique :height 0.8))))
          (props
           '(help-echo
             #1#
             ;;face (:slant italic :foreground "red")
             display "]"
             before-string
             #("  "
               0 1
               (display
                #("|["
                  0 2 (;; help-echo #1#
                       face #2=(:strike-through t :background "white")))
                ;; help-echo #1#
                face #3=(:underline t))
               1 2
               (display
                #("||VWXYZ"
                  0 7 (;; help-echo #1#
                       ;; mouse-face (:background "darkseagreen2")
                       face #2#))
                ;; help-echo #1#
                face #3#))
             mouse-face (:background "darkseagreen2")))
          (buf (get-buffer-create "xyzzy")))
      (with-current-buffer buf
        (display-buffer buf)
        (erase-buffer)
        (dolist (o (overlays-in (point-min) (point-max)))
          (delete-overlay o))
        (insert s)
        (let ((o (make-overlay (point-min) (point-max))))
          (while props
            (overlay-put o (car props) (cadr props))
            (setq props (nthcdr 2 props)))))))

This example is derived from some work where I was trying to get
AUCTeX's folding mode to show the fontified and latex-previewed
contents of macro arguments.

I hope this problem report is useful.

Joe

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: jbw
  value of $LANG: nil
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Minor modes in effect:
  outline-minor-mode: t
  desktop-save-mode: t
  url-handler-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t



X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: bug-gnu-emacs@gnu.org
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Wed, 19 Sep 2007 14:27:22 +0100
In-Reply-To: <86ps0ebxps.fsf@macs.hw.ac.uk> (Joe Wells's message of "Wed\,
	19 Sep 2007 14\:18\:07 +0100")
Message-ID: <86lkb2bxad.fsf@macs.hw.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: Re: anomalies of overlays and before-string and display properties

By the way, with one exception, these problems also occur with
after-string properties.

The exception is that the overlay's mouse-face property does correctly
cover both the overlays display and after-string properties.  This is
more evidence that not covering the before-string property is a bug.

Strangely, the after-string also œÎòÌinheritsœÎòÜ face attributes from the
character after the beginning of the overlay, not the character just
before the _end_ of the overlay.  This is more evidence that this is a
bug and not a feature.

Joe

Joe Wells <jbw@macs.hw.ac.uk> writes:

> There are a number of strange anomalies (some clearly bugs) in the
> behavior of overlays and before-string and display properties.
>
> 1. Faces on a display property on a before-string behave differently
>    depending on where the display property is in the before-string.
>    For a display property at the beginning of the before-string, its
>    face is used and the before-string's face is ignored (I think this
>    is correct).  For a display property not at the beginning of the
>    before-string, its face is completely ignored, and the face of the
>    before-string is used instead.  This is fairly clearly a bug.
>
> 2. When a substring of a before-string beginning at offset O has a
>    display property which is a string S, the first O characters of S
>    are not displayed.  If S is not at least O+1 characters long, then
>    disastrous things start to happen.  This is clearly a bug.
>
> 3. The before-string somehow œÎòÌinheritsœÎòÜ face attributes from the face
>    of the character that follows the start of the overlay.  (If the
>    overlay is of length zero, this character is not even in the
>    overlay.  See the recent discussion of how this problem is
>    affecting linum.el.)  This means that in practice a before-string
>    needs to use completely specified faces, which is obviously a real
>    pain.
>
> 4. The display property of an overlay somehow œÎòÌinheritsœÎòÜ face
>    attributes from the face of the character that follows the start of
>    the overlay.  This has similar disadvantages to anomaly #3
>    mentioned above.
>
> 5. The help-echo and mouse-face properties of an overlay with both a
>    before-string and a display property only affect the material
>    displayed by the overlay's display property.  One can work around
>    the issue by copying these properties to the various display
>    properties inside the before-string; however, this workaround is a
>    pain and in the case of mouse-face it doesn't get the entire
>    overlay highlighted at once but instead only the pieces are
>    highlighted one at a time.  It would be nice to be able to set a
>    single help-echo or a single mouse-face property that would affect
>    the _entire_ overlay.
>
> You can reproduce all of these anomalies with this function:
>
>   (defun illustrate-anomalies ()
>     (let ((s #1=#("\\abcd{VWXYZ}"
>                   0 5 (face (:foreground "Purple" :background "yellow"))
>                   5 12
>                   (face
>                    (:foreground
>                     "DarkOliveGreen"
>                     :weight bold :slant oblique :height 0.8))))
>           (props
>            '(help-echo
>              #1#
>              ;;face (:slant italic :foreground "red")
>              display "]"
>              before-string
>              #("  "
>                0 1
>                (display
>                 #("|["
>                   0 2 (;; help-echo #1#
>                        face #2=(:strike-through t :background "white")))
>                 ;; help-echo #1#
>                 face #3=(:underline t))
>                1 2
>                (display
>                 #("||VWXYZ"
>                   0 7 (;; help-echo #1#
>                        ;; mouse-face (:background "darkseagreen2")
>                        face #2#))
>                 ;; help-echo #1#
>                 face #3#))
>              mouse-face (:background "darkseagreen2")))
>           (buf (get-buffer-create "xyzzy")))
>       (with-current-buffer buf
>         (display-buffer buf)
>         (erase-buffer)
>         (dolist (o (overlays-in (point-min) (point-max)))
>           (delete-overlay o))
>         (insert s)
>         (let ((o (make-overlay (point-min) (point-max))))
>           (while props
>             (overlay-put o (car props) (cadr props))
>             (setq props (nthcdr 2 props)))))))
>
> This example is derived from some work where I was trying to get
> AUCTeX's folding mode to show the fontified and latex-previewed
> contents of macro arguments.
>
> I hope this problem report is useful.
>
> Joe
>
> ======================================================================
> In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
>  of 2007-06-27 on artemis
> Windowing system distributor `The X.Org Foundation', version 11.0.70000000
> configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: en_US.UTF-8
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: jbw
>   value of $LANG: nil
>   locale-coding-system: utf-8
>   default-enable-multibyte-characters: t
>
> Minor modes in effect:
>   outline-minor-mode: t
>   desktop-save-mode: t
>   url-handler-mode: t
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   unify-8859-on-encoding-mode: t
>   utf-translate-cjk-mode: t
>   auto-compression-mode: t
>   temp-buffer-resize-mode: t
>   size-indication-mode: t
>   line-number-mode: t
>   transient-mark-mode: t



X-Spam-Status: No, score=0.7 required=5.0 tests=SUBJ_HAS_SPACES autolearn=no 
	version=3.1.0
To: rms@gnu.org
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Fwd: overlay face property not used for after-string 	property
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Mon, 29 Oct 2007 09:57:59 +0000
In-Reply-To: <E1ImQpD-0001Si-VV@fencepost.gnu.org> (Richard Stallman's message of "Mon\, 29 Oct 2007 05\:22\:23 -0400")
Message-ID: <86bqaixmxk.fsf@macs.hw.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8

Richard Stallman <rms@gnu.org> writes:

>     > Can someone write a patch so that the overlay's face property (and
>     > other display-related properties) won't apply to its before-string?
>     >
>     > Joe, what do you think about that as a solution?
>
>     I think that would be an improvement.  I think the best solution would
>     be for the face property of an overlay (and similar properties) to not
>     apply to the before-string, the after-string, _and_ the display
>     property of the overlay.
>
> Can someone implement that?  It should not be fundamentally hard;
> making the properties apply is what is hard.
>
>     Note that there are additional problems.  One example (which I have
>     already reported) is that the face of the character in the buffer
>     after the overlay start location (which is not even in the overlay if
>     the overlay is of length zero) is applied to the before-string and
>     display properties of the overlay.
>
> The fix we are discussing will get rid of this problem, right?

No, the problem with the before-string/display/after-string properties
being affected by a face from the buffer appears to be a completely
unrelated issue which will need to be debugged separately.

> 					Another example (which I think I
>     have not previously reported) is that the face of the character in the
>     buffer _after_ the overlay end location (which is _never_ in the
>     overlay) is applied to the after-string property.
>
> Let's consider that after this fix is done; perhaps this will
> solve that other problem as a byproduct.

I can't see any way that the change proposed here will help with that
problem.




By the way, changing topic to something else I mentioned in my earlier
message:  Johan Bockgård pointed out in another message that the
convenience functions font-lock-prepend-text-property and
font-lock-append-text-property already exist for the purpose of adding
faces to text (strings or buffer contents) that already have face
properties.  However, I have pointed out in a new bug report that
these functions don't work correctly for all possible face property
values (and indeed they sometimes raise errors).

-- 
Joe

X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: bug-gnu-emacs@gnu.org
From: Joe Wells <jbw@macs.hw.ac.uk>
Date: Tue, 18 Sep 2007 23:20:07 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: redisplay goes horribly wrong when a before-string contains
	multiple display properties

Redisplay goes horribly wrong when a before-string contains multiple
display properties.

Reproduce by evaluating this expression:

  (let ((buf (get-buffer-create "foo")))
    (with-current-buffer buf
      (display-buffer buf)
      (erase-buffer)
      (dolist (o (overlays-in (point-min) (point-max)))
        (delete-overlay o))
      (insert "ABC")
      (let ((o (make-overlay 2 3))
            (s (make-string 5 ?X)))
        (put-text-property 0 1 'display "1" s)
        (put-text-property 1 2 'display "2" s)
        (put-text-property 2 3 'display "3" s)
        (put-text-property 3 4 'display "4" s)
        (put-text-property 4 5 'display "5" s)
        (overlay-put o 'display "Y")
        (overlay-put o 'before-string s))))

The correct behavior would be to see the buffer ?foo? pop up
displaying the characters ?A12345YC?.  The horribly wrong behavior
that actually happens is that redisplay of the buffer stops completely
after ?A1? is shown.  Strangely, the ?XXXXX? (which should not be
displayed anywhere) will be displayed in the echo area.  Scary errors
start occurring if one tries to do work in the buffer after this.

By the way, it would be really nice if this worked, because it would
be an easy way to display a number of display specifications for a
single overlay, which would make it much easier to get the features of
AUCTeX's tex-fold.el to work together with the features of
latex-preview.  (What is needed is being able to display strings
interleaved with images.)

Joe

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: jbw
  value of $LANG: nil
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  TeX-source-specials-mode: t
  auto-fill-function: do-auto-fill
  shell-dirtrack-mode: t
  outline-minor-mode: t
  desktop-save-mode: t
  url-handler-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t




[-- Attachment #3: Type: message/rfc822, Size: 5224 bytes --]

From: Glenn Morris <rgm@gnu.org>
To: 1176-done@emacsbugs.donarmstrong.com
Subject: Re: redisplay bugs
Date: Tue, 21 Oct 2008 21:43:32 -0400
Message-ID: <t1ej29flq3.fsf@fencepost.gnu.org>


I am closing this extremely confusing (to me) uber-bug. I have opened
separate reports for the outstanding issues.

> 1. Faces on a display property on a before-string behave differently
>    depending on where the display property is in the before-string.
>    For a display property at the beginning of the before-string, its
>    face is used and the before-string's face is ignored (I think this
>    is correct).  For a display property not at the beginning of the
>    before-string, its face is completely ignored, and the face of the
>    before-string is used instead.

As mentioned before, this seems fixed. Here is a simpler test-case
(which still looks crazy to me...):

(let ((buff (generate-new-buffer "overlay test"))
      o)
  (with-current-buffer buff
    (insert "text")
    (setq o (make-overlay (point-min) (point-max)))
    (overlay-put o 'display "display")
    (overlay-put o 'before-string
                 (concat
                  (propertize "before-"
                              'face '(:background "green")
                              'display
                              (propertize "BEFORE-" 'face '(:background "red")))
                  (propertize "string"
                              'face '(:background "yellow")
                              'display
                              (propertize "STRING" 'face '(:background "blue")))))
    (pop-to-buffer buff)))


One sees "BEFORE-" with a red background and "STRING" with a blue background.


> 2. When a substring of a before-string beginning at offset O has a
>    display property which is a string S, the first O characters of S
>    are not displayed.  If S is not at least O+1 characters long, then
>    disastrous things start to happen.

I have difficulty understanding this ("the first 0 characters" are not
displayed?), but as I said before it seems to be fixed.


> 3. The before-string somehow inherits face attributes from the face
> of the character that follows the start of the overlay.

It seems I was mistaken before, this still occurs. Opened as bug#1222.


> 4. The display property of an overlay somehow inherits face
> attributes from the face of the character that follows the start of
> the overlay.

Opened as bug#1222.


> 5. The help-echo and mouse-face properties of an overlay with both a
>    before-string and a display property only affect the material
>    displayed by the overlay's display property.

Opened as bugs #1220 and #1221.


> The exception is that the overlay's mouse-face property does
> correctly cover both the overlays display and after-string
> properties.

Mentioned in bug #1220.


> Strangely, the after-string also inherits face attributes from the
> character after the beginning of the overlay, not the character just
> before the _end_ of the overlay.

Mentioned in bug#1222.


>>> Can someone write a patch so that the overlay's face property (and
>>> other display-related properties) won't apply to its before-string?

In Emacs 22.2 and up, overlay faces no longer apply to the before- and
after- strings. They still affect the display part, which seems
reasonable to me.

Example:

(let ((buff (generate-new-buffer "overlay test"))
      o)
  (with-current-buffer buff
    (insert "text")
    (setq o (make-overlay (point-min) (point-max)))
    (overlay-put o 'display "display")
    (overlay-put o 'face '(:background "blue"))
    (overlay-put o 'before-string "before")
    (overlay-put o 'after-string "after")
    (pop-to-buffer buff)))

Only "display" has a blue background in 22.2 and up.

This was also discussed on emacs-devel:

http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01360.html


> Redisplay goes horribly wrong when a before-string contains multiple
> display properties.

As mentioned before, this is fixed.


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

end of thread, other threads:[~2008-10-22  1:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <t1ej29flq3.fsf@fencepost.gnu.org>
2008-10-15 16:10 ` bug#1176: redisplay bugs Richard M. Stallman
2008-10-21  2:12   ` Glenn Morris
2008-10-21  2:48   ` Glenn Morris
2008-10-22  1:55   ` bug#1176: marked as done (redisplay bugs) Emacs bug Tracking System

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).