emacs-devel
[Top][All Lists]
Advanced

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

Re: problem of released-button style mode-line


From: Miles Bader
Subject: Re: problem of released-button style mode-line
Date: Thu, 26 Oct 2000 15:20:55 +0900 (JST)

Kenichi Handa <address@hidden> writes:
> > Thank you, but it seems that:
> >   (pos-visible-in-window-p POS nil t)
> > returns t even if the upper part of line at POS is
> > non-visible.
> 
> It seems that this function can be used only for the current
> buffer, but the docstring is vague about this restriction.

I don't understand what you mean by this.

pos-visible-in-window-p doesn't use the current buffer at all, except to
default the value of POS.

> In the code of pos_visible_p, you calls start_display but
> I thought that the arg W (window) should be that of the
> current buffer.

What do you mean?  Buffers don't point to windows, windows point to
buffers, so the current buffer doesn't *have* a window...

BTW, the fact that the POS and WINDOW arguments of
pos-visible-in-window-p default separately seems slightly odd to me.
What do people think of the following change:

--- window.c.#1.315#    Thu Oct 26 09:25:08 2000
+++ window.c    Thu Oct 26 15:14:27 2000
@@ -299,7 +299,7 @@ DEFUN ("pos-visible-in-window-p", Fpos_v
   "Return t if position POS is currently on the frame in WINDOW.\n\
 Return nil if that position is scrolled vertically out of view.\n\
 If FULLY is non-nil, then only return t when POS is completely visible.\n\
-POS defaults to point; WINDOW defaults to the selected window.")
+POS defaults to point in WINDOW; WINDOW defaults to the selected window.")
   (pos, window, fully)
      Lisp_Object pos, window, fully;
 {
@@ -310,17 +310,19 @@ POS defaults to point; WINDOW defaults t
   Lisp_Object in_window;
   int fully_p;
 
-  if (NILP (pos))
-    posint = PT;
-  else
+  w = decode_window (window);
+  buf = XBUFFER (w->buffer);
+  SET_TEXT_POS_FROM_MARKER (top, w->start);
+
+  if (!NILP (pos))
     {
       CHECK_NUMBER_COERCE_MARKER (pos, 0);
       posint = XINT (pos);
     }
-
-  w = decode_window (window);
-  buf = XBUFFER (w->buffer);
-  SET_TEXT_POS_FROM_MARKER (top, w->start);
+  else if (w == XWINDOW (selected_window))
+    posint = PT;
+  else
+    posint = XMARKER (w->pointm)->charpos;
 
   /* If position is above window start, it's not visible.  */
   if (posint < CHARPOS (top))


-Miles
-- 
Love is a snowmobile racing across the tundra.  Suddenly it flips over,
pinning you underneath.  At night the ice weasels come.  --Nietzsche



reply via email to

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