Subject: 23.0.50; (pos-visible-in-window-p) returns error with 'before-string overlay

From: Yoshiaki Kasahara <[email-masked]>
Date: Wed, 02 Apr 2008 02:17:17 +0900 (JST)

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

When there is an overlay with 'before-string property at the beginning
of a line in a buffer, the point in the buffer is on the overlay, and
both the overlay and the point are placed at the bottom of the window,
(pos-visible-in-window-p) returns 'Args out of range: 0'.

To reproduce, insert some blank lines to *scratch* buffer, and eval
the following:

(overlay-put (make-overlay (point-max) (point-max)) 'before-string "[before-string]")

Then place the overlay and the point at the bottom of the window like
this, and eval (pos-visible-in-window-p):

--------------

[before-string]<- point is here
-EEJ:**--....  <- modeline
Eval: (pos-visible-in-window-p)
--------------

Currently I'm using emacs before-merge-unicode-to-trunk.  I reproduced
the same symptom in CVS HEAD (23.0.60) of today.  It doesn't happen in
emacs-21.3 (it returns t).

In some cases the emacs process starts to consume 100% CPU and doesn't
respond to keyboard-quit after the error.  I have to kill the process.
But I cannot reliably reproduce the lock-up.  Nexttime I'll try to
attach GDB to get a backtrace.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/local/share/emacs/23.0.50/etc/DEBUG for instructions.

In GNU Emacs 23.0.50.2 (x86_64-unknown-freebsd7.0, X toolkit, Xaw3d scroll bars)
 of 2008-03-04 on elvenbow.cc.kyushu-u.ac.jp
configured using `configure  '--with-x-toolkit=lucid' '--without-xim' '--without-gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: ja_JP.eucJP
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: C
  value of $LANG: ja_JP.eucJP
  locale-coding-system: japanese-iso-8bit
  default-enable-multibyte-characters: t

Major mode: Apropos

Minor modes in effect:
  show-paren-mode: t
  iswitchb-mode: t
  icomplete-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-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