all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
@ 2020-11-28 20:40 Juri Linkov
  2020-11-29  8:22 ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2020-11-28 20:40 UTC (permalink / raw)
  To: 44932

[-- Attachment #1: Type: text/plain, Size: 894 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: window-in-direction-minibuf.patch --]
[-- Type: text/x-diff, Size: 3370 bytes --]

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)

^ permalink raw reply related	[flat|nested] 10+ messages in thread
[parent not found: <<87r1odtdtx.fsf@mail.linkov.net>]

end of thread, other threads:[~2020-12-01 15:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-28 20:40 bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction Juri Linkov
2020-11-29  8:22 ` martin rudalics
2020-11-29 19:49   ` Juri Linkov
2020-11-30  9:05     ` martin rudalics
2020-11-30 20:49       ` Juri Linkov
2020-11-30 21:09         ` Drew Adams
2020-12-01  3:24           ` Eli Zaretskii
2020-12-01  9:34         ` martin rudalics
     [not found] <<87r1odtdtx.fsf@mail.linkov.net>
     [not found] ` <<342c23a3-e379-452c-6c5e-29dab7592c28@gmx.at>
     [not found]   ` <<87h7p8zeim.fsf@mail.linkov.net>
     [not found]     ` <<5dbd99a5-a51e-318f-0c9d-81dae921af96@gmx.at>
     [not found]       ` <<87eekaa8au.fsf@mail.linkov.net>
     [not found]         ` <<27c3eec9-5675-47ae-937e-b5440becf6b6@default>
     [not found]           ` <<83sg8qi4yy.fsf@gnu.org>
2020-12-01  3:49             ` Drew Adams
2020-12-01 15:38               ` Eli Zaretskii

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.