bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#50256: thing-at-mouse


From: martin rudalics
Subject: bug#50256: thing-at-mouse
Date: Thu, 2 Sep 2021 16:43:02 +0200

>>   >> pos_visible_p already does
>>   >>
>>   >>     if (XBUFFER (w->contents) != current_buffer)
>>   >>       {
>>   >>         old_buffer = current_buffer;
>>   >>         set_buffer_internal_1 (XBUFFER (w->contents));
>>   >>       }
>>   >
>>   > I'm asking if this is the desired behavior, when Lisp runs this inside
>>   > with-current-buffer?
>>
>> It is the _necessary_ behavior when WINDOW is not the selected window
>> and its buffer is not current.
>
> But in the case in point, WINDOWS _was_ the selected window.  That's
> why pos-visible-in-window-p used PT.  Which is what you said was the
> bug.  Or am I missing something?

No.  The above was meant in response to your earlier:

  If we want to support the current documentation to the letter, the
  only way of doing that I know of is to force WINDOW to display the
  current buffer, at least internally, i.e. to switch to the WINDOW's
  buffer for the duration of pos-visible-in-window-p.

I mean that we needn't do that because pos_visible_p already does it.
So I'd just propose to do the trivial (line numbers are not trunk's);

diff --git a/src/window.c b/src/window.c
index cb8fe5fcdb..bfbed01749 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2199,8 +2199,6 @@ DEFUN ("pos-visible-in-window-p", 
Fpos_visible_in_window_p,
     posint = -1;
   else if (!NILP (pos))
     posint = fix_position (pos);
-  else if (w == XWINDOW (selected_window))
-    posint = PT;
   else
     posint = marker_position (w->pointm);

martin





reply via email to

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