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

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

bug#28621: Proposed patch for doc of posn-window and code of posn-set-po


From: Eli Zaretskii
Subject: bug#28621: Proposed patch for doc of posn-window and code of posn-set-point to handle frame arguments
Date: Fri, 29 Sep 2017 22:41:42 +0300

> From: Robert Weiner <address@hidden>
> Date: Wed, 27 Sep 2017 12:01:50 -0400
> 
> The doc for posn-window is incomplete.  posn-set-point does not handle drag
> events whose end point argument is a frame, rather than a window.
> This patch fixes both of these.  Read the code of posn-set-point to ensure
> the logic is right in terms of using frame-selected-window.
> 
> This diff is against subr.el in Emacs 25.3 but I see none of this has yet
> changed in Emacs 26 either, so it is still applicable.

Thanks.  Some comments below.

> ! `posn-window': The window the event is in.
>   `posn-area': A symbol identifying the area the event occurred in,
>   or nil if the event occurred in the text area.
>   `posn-point': The buffer position of the event.
> --- 1090,1096 ----
>   The following accessor functions are used to access the elements
>   of the position:
> 
> ! `posn-window': The window or frame of the event end.

I think we should say a bit more about this.  For example:

 `posn-window': The window of the event end, or its frame if event
                end point belongs to no window.

>   (defun posn-set-point (position)
>     "Move point to POSITION.
>   Select the corresponding window as well."
> !   (if (not (windowp (posn-window position)))
> !       (error "Position not in text area of window"))
> !   (select-window (posn-window position))
>     (if (numberp (posn-point position))
>         (goto-char (posn-point position))))
> 
> --- 1170,1182 ----
>   (defun posn-set-point (position)
>     "Move point to POSITION.
>   Select the corresponding window as well."
> !   (if (framep (posn-window position))
> !       (progn (if (not (windowp (frame-selected-window (posn-window
> position))))
> ! (error "Position not in text area of window"))
> !      (select-window (frame-selected-window (posn-window position))))

Why should we select the selected-window on that frame in this case?
Can you describe a use case where this would be a useful behavior?

In any case, the change in posn-set-point's behavior, if we agree on
it, should be described in NEWS.  The changes also lack a log entry.

I'm okay with installing the documentation changes in the release
branch, but the change in posn-set-point should be discussed first, as
I'm not sure we want that.  If we agree on making that change, it
should go to master, I think.





reply via email to

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