From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction Date: Sat, 28 Nov 2020 22:40:20 +0200 Organization: LINKOV.NET Message-ID: <87r1odtdtx.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4261"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) To: 44932@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 28 21:57:14 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 1kj7HN-0000y8-24 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Nov 2020 21:57:13 +0100 Original-Received: from localhost ([::1]:53414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kj7HL-0002MI-Fa for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Nov 2020 15:57:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kj7HC-0002Lq-1Y for bug-gnu-emacs@gnu.org; Sat, 28 Nov 2020 15:57:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kj7HB-0006pg-Py for bug-gnu-emacs@gnu.org; Sat, 28 Nov 2020 15:57:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kj7HB-0003dU-NF for bug-gnu-emacs@gnu.org; Sat, 28 Nov 2020 15:57:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Nov 2020 20:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44932 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.160659701213960 (code B ref -1); Sat, 28 Nov 2020 20:57:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Nov 2020 20:56:52 +0000 Original-Received: from localhost ([127.0.0.1]:49212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kj7H2-0003d5-6P for submit@debbugs.gnu.org; Sat, 28 Nov 2020 15:56:52 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:52790) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kj7H0-0003cy-MU for submit@debbugs.gnu.org; Sat, 28 Nov 2020 15:56:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kj7H0-0002Km-EO for bug-gnu-emacs@gnu.org; Sat, 28 Nov 2020 15:56:50 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:43737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kj7Gx-0006k6-Pd for bug-gnu-emacs@gnu.org; Sat, 28 Nov 2020 15:56:50 -0500 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id C2770100004 for ; Sat, 28 Nov 2020 20:56:42 +0000 (UTC) Received-SPF: pass client-ip=217.70.178.231; envelope-from=juri@linkov.net; helo=relay11.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:194510 Archived-At: --=-=-= Content-Type: text/plain I've lost all my changes in the edited file because of the wrong input arguments for window-in-direction. Here's is what happened: I forgot that the minibuffer was activated, and in the buffer called the command windmove-display-down. But it displayed the text buffer in the minibuffer window. Then I noticed this and exited the minibuffer. But exiting the minibuffer wiped off the contents of the minibuffer window, i.e. cleared the text buffer that was displayed in the minibuffer window. This is because currently windmove-display-in-direction doesn't send the arg 'nomini' to window-in-direction. And it can't send this arg, because currently window-in-direction ignores the value 'nomini', and doesn't send its MINIBUF arg to walk-window-tree unchanged. So here is a patch to avoid such accidents. It sends MINIBUF arg from window-in-direction to MINIBUF arg of walk-window-tree: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=window-in-direction-minibuf.patch diff --git a/lisp/windmove.el b/lisp/windmove.el index 6557960064..5db13cf6b3 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -485,7 +485,7 @@ windmove-display-in-direction (t (window-in-direction dir nil nil (and arg (prefix-numeric-value arg)) - windmove-wrap-around))))) + windmove-wrap-around 'nomini))))) (unless window (setq window (split-window nil nil dir) type 'window)) (cons window type))) @@ -569,7 +569,7 @@ windmove-delete-in-direction When `windmove-wrap-around' is non-nil, takes the window from the opposite side of the frame." (let ((other-window (window-in-direction dir nil nil arg - windmove-wrap-around t))) + windmove-wrap-around 'nomini))) (cond ((null other-window) (user-error "No window %s from selected window" dir)) (t @@ -637,7 +637,7 @@ windmove-swap-states-in-direction When `windmove-wrap-around' is non-nil, takes the window from the opposite side of the frame." (let ((other-window (window-in-direction dir nil nil nil - windmove-wrap-around t))) + windmove-wrap-around 'nomini))) (cond ((or (null other-window) (window-minibuffer-p other-window)) (user-error "No window %s from selected window" dir)) (t diff --git a/lisp/window.el b/lisp/window.el index d564ec5546..82976bf836 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2309,7 +2309,7 @@ window--in-direction-2 ;; Neither of these allow one to selectively ignore specific windows ;; (windows whose `no-other-window' parameter is non-nil) as targets of ;; the movement. -(defun window-in-direction (direction &optional window ignore sign wrap mini) +(defun window-in-direction (direction &optional window ignore sign wrap minibuf) "Return window in DIRECTION as seen from WINDOW. More precisely, return the nearest window in direction DIRECTION as seen from the position of `window-point' in window WINDOW. @@ -2332,10 +2332,11 @@ window-in-direction frame and DIRECTION `above' the minibuffer window if the frame has one, and a window at the bottom of the frame otherwise. -Optional argument MINI nil means to return the minibuffer window -if and only if it is currently active. MINI non-nil means to -return the minibuffer window even when it's not active. However, -if WRAP is non-nil, always act as if MINI were nil. +Optional argument MINIBUF t means to return the minibuffer +window even if it isn't active. MINIBUF nil or omitted means +to return the minibuffer window if and only if it is currently active. +MINIBUF neither nil nor t means never return the minibuffer window. +However, if WRAP is non-nil, always act as if MINIBUF were nil. Return nil if no suitable window can be found." (setq window (window-normalize-window window t)) @@ -2451,7 +2452,7 @@ window-in-direction (setq best-edge-2 w-top) (setq best-diff-2 best-diff-2-new) (setq best-2 w))))) - frame nil (and mini t)) + frame nil minibuf) (or best best-2))) (defun get-window-with-predicate (predicate &optional minibuf all-frames default) --=-=-=--