all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: rswgnu@gmail.com
Cc: 28621@debbugs.gnu.org
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	[thread overview]
Message-ID: <83k20h5m2x.fsf@gnu.org> (raw)
In-Reply-To: <CA+OMD9ieLvVUCu6ubaHohNso+s9TGK+oJcnRVkdyZ4+2JtM41g@mail.gmail.com> (message from Robert Weiner on Wed, 27 Sep 2017 12:01:50 -0400)

> From: Robert Weiner <rsw@gnu.org>
> 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.





  parent reply	other threads:[~2017-09-29 19:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 16:01 bug#28621: Proposed patch for doc of posn-window and code of posn-set-point to handle frame arguments Robert Weiner
2017-09-27 21:34 ` John Wiegley
2017-09-29  8:34 ` martin rudalics
2017-09-29 16:48   ` Robert Weiner
2017-09-29 19:42   ` Eli Zaretskii
2017-09-29 19:41 ` Eli Zaretskii [this message]
2017-09-29 20:11   ` Robert Weiner
2017-09-30  8:32     ` martin rudalics
2017-09-30 12:45       ` Robert Weiner
2017-09-30 12:52         ` Robert Weiner
2017-09-30 17:12         ` martin rudalics
2017-09-30 21:56           ` bug#28620: " Robert Weiner
2017-09-30 23:34             ` Robert Weiner
2017-10-16 15:11             ` bug#28620: Emacs bug#28620: (PARTIAL SOLUTION) mouse-position wrong on macOS and Windows 7 after mouse-1 click Bob Weiner
2019-06-24 16:08     ` bug#28621: Proposed patch for doc of posn-window and code of posn-set-point to handle frame arguments Lars Ingebrigtsen
2019-06-27  2:20       ` Robert Weiner
2019-06-27 10:39         ` Lars Ingebrigtsen
2019-06-27 12:27         ` Robert Weiner
2020-08-24 13:28           ` Lars Ingebrigtsen
2020-08-24 13:29           ` Lars Ingebrigtsen
2020-10-11  2:06             ` Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2017-09-27 15:44 bug#28620: Mouse drag event records wrong window for release when crossing frames Robert Weiner
2017-10-03 20:54 ` bug#28620: (mouse-position_ wrong on macOS after mouse-1 click (Was: Interact directly on Emacs bug#28620: mouse drag event records wrong release window) Robert Weiner
2017-10-16 15:57 ` bug#28620: (PARTIAL SOLUTION) Mouse drag event records wrong window for release when crossing frames Bob Weiner
2019-07-27  9:26 ` bug#36269: bug#28620: " martin rudalics
2019-07-27 10:08   ` Eli Zaretskii
2019-07-28  7:34     ` martin rudalics
2019-07-29 23:21       ` Robert Weiner
2019-07-30  7:00         ` bug#36269: " martin rudalics
2019-08-03 11:25       ` Eli Zaretskii
2019-08-04  7:59         ` martin rudalics
2020-08-18 11:31           ` bug#28620: bug#36269: " Stefan Kangas
2020-08-18 12:15             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83k20h5m2x.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=28621@debbugs.gnu.org \
    --cc=rswgnu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.