Subject: bug#1336: after-string not displayed when overlay has a before-string and image display property

From: "Tim Toolan" <[email-masked]>
Date: Thu, 13 Nov 2008 08:08:53 -0500

When an overlay has both a before-string and an after-string, and it
has a display property which is an image, the after-string will not be
displayed.

I'm assuming this macro of Joe Wells' in my reproduction code below:

  (defmacro test-in-fresh-buffer-and-window (&rest body)
    `(progn
       (delete-other-windows)
       (kill-buffer (get-buffer-create "xyzzy"))
       (let ((xyzzy-buf (get-buffer-create "xyzzy")))
         (set-buffer xyzzy-buf)
         (display-buffer xyzzy-buf)
         ,@body
         )))

Reproduce this problem with:

  (test-in-fresh-buffer-and-window
   (insert "ABCD \n")
   (let ((o1 (make-overlay 2 3)))
     (overlay-put o1 'before-string "B1")
     (overlay-put o1 'after-string "A1")
     (overlay-put o1 'display '(image :data "#define x_width 8\n#define x_height 8\nstatic unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };" :type xbm))))

The above expression should display "ABB1(image)A1CD".
The above expression wrongly displays "ABB1(image)CD".

Note that the problem goes away when any of the following conditions 
are met:
 1) The display property is something other than an image (like a string).
 2) There is no before-string, only an after-string.
 3) There is another overlay that covers the same region and has a
    before-string (if it only has an after-string that will not be
    displayed either).
 4) If there is a higher priority overlay that covers the same region,
    and has a display property set which is not an image.

Note that this problem also exists in the current CVS version of emacs.

Regards,

Tim

In GNU Emacs 22.2.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2008-06-12 on aquarius
Windowing system distributor `The X.Org Foundation', version 11.0.10300000
configured using `configure  '--prefix=/usr' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=-emacs-22' '--infodir=/usr/share/info/emacs-22' '--without-carbon' '--with-sound' '--with-x' '--with-toolkit-scroll-bars' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png' '--with-xpm' '--with-x-toolkit=athena' '--without-gtk' '--without-hesiod' '--with-kerberos' '--with-kerberos5' '--libdir=/usr/lib64' '--build=x86_64-pc-linux-gnu' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu' 'CFLAGS=-march=nocona -pipe -O2' 'LDFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: C
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t