From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#28621: Proposed patch for doc of posn-window and code of posn-set-point to handle frame arguments Date: Mon, 24 Aug 2020 15:29:13 +0200 Message-ID: <87zh6kb2ae.fsf@gnus.org> References: <83k20h5m2x.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21122"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 28621@debbugs.gnu.org, Robert Weiner To: Robert Weiner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 24 15:30:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kACY7-0005PO-9n for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Aug 2020 15:30:11 +0200 Original-Received: from localhost ([::1]:47100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kACY6-0000Eq-Cg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Aug 2020 09:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kACXy-0000E9-TO for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2020 09:30:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kACXy-0002zK-KK for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2020 09:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kACXy-0001Ll-GX for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2020 09:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Aug 2020 13:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28621 X-GNU-PR-Package: emacs Original-Received: via spool by 28621-submit@debbugs.gnu.org id=B28621.15982757655110 (code B ref 28621); Mon, 24 Aug 2020 13:30:02 +0000 Original-Received: (at 28621) by debbugs.gnu.org; 24 Aug 2020 13:29:25 +0000 Original-Received: from localhost ([127.0.0.1]:56570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kACXM-0001KL-Le for submit@debbugs.gnu.org; Mon, 24 Aug 2020 09:29:25 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:57258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kACXL-0001K8-0S for 28621@debbugs.gnu.org; Mon, 24 Aug 2020 09:29:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LK8SGZ3W+jCB3RPdwYnia8M1jg2xFpF2lL1ZUmdEqJk=; b=KHMlFYvWlg/bTc8gPoPnmJo6V6 X9i48ss27BieJqN41QSCiGkwJCrwdjjUUgauHvGpXNDZwKFthlOOA494UDEk/+Tq1mThSTbMByzAA Bbs1E91ngmZfOup1IZbK9PiDNn77BH/AVp1s20rfMFPByYCK0D94Nz0jY9DROGqbI6/A=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kACXC-0006hS-Jp; Mon, 24 Aug 2020 15:29:17 +0200 X-Now-Playing: Various's _Alefa Madagascar_: "Charles Maurin Poty - Amboliako Fary" In-Reply-To: (Robert Weiner's message of "Thu, 27 Jun 2019 08:27:49 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186140 Archived-At: (This is the patch itself -- it didn't apply because it was posted as HTML.) diff --git a/lisp/subr.el b/lisp/subr.el index a58a873a33..12d7383600 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1364,7 +1364,7 @@ event-start The following accessor functions are used to access the elements of the position: -`posn-window': The window the event is in. +`posn-window': The window or frame of the event end. `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. @@ -1420,8 +1420,9 @@ posnp (defsubst posn-window (position) "Return the window in POSITION. -POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +If POSITION is outside the frame where the event was initiated, +return that frame instead. POSITION should be a list of the form +returned by the `event-start' and `event-end' functions." (nth 0 position)) (defsubst posn-area (position) @@ -1448,9 +1449,14 @@ posn-point (defun posn-set-point (position) "Move point to POSITION. Select the corresponding window as well." - (if (not (windowp (posn-window position))) + (if (framep (posn-window position)) + (progn + (unless (windowp (frame-selected-window (posn-window position))) + (error "Position not in text area of window")) + (select-window (frame-selected-window (posn-window position)))) + (unless (windowp (posn-window position)) (error "Position not in text area of window")) - (select-window (posn-window position)) + (select-window (posn-window position))) (if (numberp (posn-point position)) (goto-char (posn-point position)))) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no