GNU bug report logs - #44932
28.0.50; MINIBUF 'nomini' for window-in-direction

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sat, 28 Nov 2020 20:57:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44932 in the body.
You can then email your comments to 44932 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Sat, 28 Nov 2020 20:57:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 28 Nov 2020 20:57:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Sat, 28 Nov 2020 22:40:20 +0200
[Message part 1 (text/plain, inline)]
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:

[window-in-direction-minibuf.patch (text/x-diff, inline)]
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)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Sun, 29 Nov 2020 08:23:01 GMT) Full text and rfc822 format available.

Message #8 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>, 44932 <at> debbugs.gnu.org
Subject: Re: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Sun, 29 Nov 2020 09:22:12 +0100
> So here is a patch to avoid such accidents.  It sends MINIBUF arg
> from window-in-direction to MINIBUF arg of walk-window-tree:

One day we should make up our mind whether we want this arg to be called
MINI, MINIBUF or MINIBUFFER.  I have no personal preference but the
current state (in particular on the C-level) confuses the hell out of
me.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Sun, 29 Nov 2020 19:50:02 GMT) Full text and rfc822 format available.

Message #11 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 44932 <at> debbugs.gnu.org
Subject: Re: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Sun, 29 Nov 2020 21:49:12 +0200
tags 44932 fixed
close 44932 28.0.50
quit

> One day we should make up our mind whether we want this arg to be called
> MINI, MINIBUF or MINIBUFFER.  I have no personal preference but the
> current state (in particular on the C-level) confuses the hell out of
> me.

I think MINIBUF is the shortest that is still unambiguous.
Now at least renaming in window-in-direction is pushed to master.




Added tag(s) fixed. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Sun, 29 Nov 2020 19:50:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.0.50, send any further explanations to 44932 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Sun, 29 Nov 2020 19:50:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Mon, 30 Nov 2020 09:06:02 GMT) Full text and rfc822 format available.

Message #18 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 44932 <at> debbugs.gnu.org
Subject: Re: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Mon, 30 Nov 2020 10:05:41 +0100
>> One day we should make up our mind whether we want this arg to be called
>> MINI, MINIBUF or MINIBUFFER.  I have no personal preference but the
>> current state (in particular on the C-level) confuses the hell out of
>> me.
>
> I think MINIBUF is the shortest that is still unambiguous.

It gives the impression that it stands for a buffer where it means a
window that may also display the echo area.  'resize-mini-windows' and
'max-mini-window-height' tried to establish the "mini-windows (the
minibuffer and the echo area)" nomenclature and we now take a step back
in the other direction?

> Now at least renaming in window-in-direction is pushed to master.

And left MINI in the .texi file.  I spent some time trying to make
manual and doc-strings congruent in this regard ...

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Mon, 30 Nov 2020 20:59:01 GMT) Full text and rfc822 format available.

Message #21 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 44932 <at> debbugs.gnu.org
Subject: Re: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Mon, 30 Nov 2020 22:49:12 +0200
>>> One day we should make up our mind whether we want this arg to be called
>>> MINI, MINIBUF or MINIBUFFER.  I have no personal preference but the
>>> current state (in particular on the C-level) confuses the hell out of
>>> me.
>>
>> I think MINIBUF is the shortest that is still unambiguous.
>
> It gives the impression that it stands for a buffer where it means a
> window that may also display the echo area.  'resize-mini-windows' and
> 'max-mini-window-height' tried to establish the "mini-windows (the
> minibuffer and the echo area)" nomenclature and we now take a step back
> in the other direction?

I don't know why MINI-WINDOW would be better than MINIBUF.
Is this distinction significant here?

Anyway, what I did is made all window functions consistent
in regard to their MINIBUF arg.  So now they are all have
the same arg name MINIBUF:

(defun walk-window-tree (fun &optional frame any MINIBUF)
(defun window-with-parameter (parameter &optional value frame any MINIBUF)
(defun walk-windows (fun &optional MINIBUF all-frames)
(defun window-in-direction (direction &optional window ignore sign wrap MINIBUF)
(defun get-window-with-predicate (predicate &optional MINIBUF all-frames default)
(defun get-buffer-window-list (&optional buffer-or-name MINIBUF all-frames)
(defun count-windows (&optional MINIBUF all-frames)

>> Now at least renaming in window-in-direction is pushed to master.
>
> And left MINI in the .texi file.  I spent some time trying to make
> manual and doc-strings congruent in this regard ...

Sorry, will update the manual soon.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Mon, 30 Nov 2020 21:10:02 GMT) Full text and rfc822 format available.

Message #24 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>, martin rudalics <rudalics <at> gmx.at>
Cc: 44932 <at> debbugs.gnu.org
Subject: RE: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Mon, 30 Nov 2020 13:09:07 -0800 (PST)
> >> I think MINIBUF is the shortest that is still unambiguous.
> >
> > It gives the impression that it stands for a buffer where it means a
> > window that may also display the echo area.  'resize-mini-windows'
> > and 'max-mini-window-height' tried to establish the "mini-windows (the
> > minibuffer and the echo area)" nomenclature and we now take a step
> > back in the other direction?
> 
> I don't know why MINI-WINDOW would be better than MINIBUF.
> Is this distinction significant here?

IMHO, MINI-WINDOW would be worse.  It's not
about a small window.  If someone wants to
be extra clear with the name (not needed,
if the rest of the doc string is clear about
what this is), then just use a longer name:

  MINIBUF-WINDOW

or if that's not clear enough (it should be):

  MINIBUFFER-WINDOW




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Tue, 01 Dec 2020 03:25:01 GMT) Full text and rfc822 format available.

Message #27 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: rudalics <at> gmx.at, 44932 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Tue, 01 Dec 2020 05:24:05 +0200
> Date: Mon, 30 Nov 2020 13:09:07 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 44932 <at> debbugs.gnu.org
> 
> > I don't know why MINI-WINDOW would be better than MINIBUF.
> > Is this distinction significant here?
> 
> IMHO, MINI-WINDOW would be worse.  It's not
> about a small window.

"Mini-window" is accepted terminology in Emacs, it is used, e.g., in
resize-mini-windows.  So there's nothing wrong with using that.  (And
yes, usually that window _is_ small.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Tue, 01 Dec 2020 03:50:02 GMT) Full text and rfc822 format available.

Message #30 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Drew Adams <drew.adams <at> oracle.com>
Cc: rudalics <at> gmx.at, 44932 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: RE: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Mon, 30 Nov 2020 19:49:44 -0800 (PST)
> > > I don't know why MINI-WINDOW would be better than
> > > MINIBUF. Is this distinction significant here?
> >
> > IMHO, MINI-WINDOW would be worse.  It's not
> > about a small window.
> 
> "Mini-window" is accepted terminology in Emacs, it is used, e.g., in
> resize-mini-windows.  So there's nothing wrong with using that.  (And
> yes, usually that window _is_ small.)

You're discussing only how to refer to this
parameter in doc strings.  I contributed my 2 cents.

As for the "accepted terminology" of "mini-window",
I've also given my opinion about that unfortunate
name more generally:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=11276#24

  "it is wrong to use only "mini" here.  This is not
   just a mini-window, i.e., a small window - it is a
   minibuffer window.  See bug #3320, deemed "wont-fix"
   by Lars:

   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3320.

   Perhaps now that others consider that
   `resize-mini-windows' is a misnomer (for
   additional reasons), this misuse of "mini" can
   be reconsidered."

Bug #3320 was filed at the request of another who also
felt that such "accepted terminology" is unfortunate:

  "these misleading names have bitten me too."

> it is used, e.g., in resize-mini-windows"

And now what was discussed as a bad-name bug has
been canonized as a model of good naming.

You have a chance now, when considering parameter
names, to start to put things on the right track,
even if you don't rename `resize-mini-windows'.

Multiplying wrongs doesn't make a right.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Tue, 01 Dec 2020 09:35:03 GMT) Full text and rfc822 format available.

Message #33 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 44932 <at> debbugs.gnu.org
Subject: Re: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Tue, 1 Dec 2020 10:34:24 +0100
>> It gives the impression that it stands for a buffer where it means a
>> window that may also display the echo area.  'resize-mini-windows' and
>> 'max-mini-window-height' tried to establish the "mini-windows (the
>> minibuffer and the echo area)" nomenclature and we now take a step back
>> in the other direction?
>
> I don't know why MINI-WINDOW would be better than MINIBUF.
> Is this distinction significant here?
>
> Anyway, what I did is made all window functions consistent
> in regard to their MINIBUF arg.  So now they are all have
> the same arg name MINIBUF:
>
> (defun walk-window-tree (fun &optional frame any MINIBUF)
> (defun window-with-parameter (parameter &optional value frame any MINIBUF)
> (defun walk-windows (fun &optional MINIBUF all-frames)
> (defun window-in-direction (direction &optional window ignore sign wrap MINIBUF)
> (defun get-window-with-predicate (predicate &optional MINIBUF all-frames default)
> (defun get-buffer-window-list (&optional buffer-or-name MINIBUF all-frames)
> (defun count-windows (&optional MINIBUF all-frames)

OK.

>> And left MINI in the .texi file.  I spent some time trying to make
>> manual and doc-strings congruent in this regard ...
>
> Sorry, will update the manual soon.

Thanks in advance.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44932; Package emacs. (Tue, 01 Dec 2020 15:39:02 GMT) Full text and rfc822 format available.

Message #36 received at 44932 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: rudalics <at> gmx.at, 44932 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#44932: 28.0.50; MINIBUF 'nomini' for window-in-direction
Date: Tue, 01 Dec 2020 17:38:39 +0200
> Date: Mon, 30 Nov 2020 19:49:44 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: juri <at> linkov.net, rudalics <at> gmx.at, 44932 <at> debbugs.gnu.org
> 
> Multiplying wrongs doesn't make a right.

This is a logical fallacy: I don't agree that the name is wrong to
begin with.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Dec 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 229 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.