Subject: bug#349: show-paren-mode overlay extending onto new text

From: Kevin Ryde <[email-masked]>
Date: Mon, 02 Jun 2008 11:46:20 +1000

In show-paren-mode, when point is after a closing paren so it and the
opener are highlighted, sometimes newly inserted text is covered with
the paren colour too, for a little while.

This doesn't happen all the time, but I've noticed in particular in
program output from M-x compile.  So from "emacs -Q",

    M-x show-paren-mode
    M-x compile
    echo -n '(hello)'; sleep 6; yes
    C-x o    # to *compilation* buffer
    M->      # go to end of buffer

    => the (hello) parens are highlighted

    => but then the output of "yes" is highlighted too

The "sleep 6" gives you a chance to switch to the compilation buffer,
the "echo -n" is so there's no trailing newline in the buffer yet.

An "echo" like this is of course a contrivance, but I've struck the
effect in real program output when switching to the buffer at a random
point or when a close paren is a genuine last bit of its output so far.

I guess for most insertions the timer or whatever gets a chance to reset
or hide the overlay, but for heavy running compile output maybe that
doesn't happen.  I wondered if the make-overlay in show-paren-function
might have the "rear-advance" arg nil, unless there's ever a time it
ought to extend.

In GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2008-04-27 on raven, modified by Debian
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

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: en_AU
  locale-coding-system: iso-8859-1
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  gnus-undo-mode: t
  show-paren-mode: t
  encoded-kbd-mode: t
  file-name-shadow-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t