unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: "Óscar Fuentes" <ofv@wanadoo.es>, emacs-devel@gnu.org
Subject: Re: emacs-25 3722a69: Fix bugs in window resizing code
Date: Tue, 01 Mar 2016 09:07:16 +0100	[thread overview]
Message-ID: <56D54DB4.1080502@gmx.at> (raw)
In-Reply-To: <87si0bj85l.fsf@wanadoo.es>

 >>      (shrink-window, enlarge-window): Fix bug#22723 where windows
 >>      with preserved size would not get resized.  Also now signal an
 >>      error when the window cannot be shrunk or enlarged as requested.
 >
 > [snip]
 >
 >> +      (error "Cannot shrink selected window")))))
 >
 > I was surprised to see my code failing because of this change. Throwing
 > an error on a case where previously nothing was done amounts to an API
 > change. My code was fixed by wrapping the call to enlarge-window with
 > ignore-errors, but I'm worried about all the code out there.

Sorry, but this fix was motivated by the following explanation in the
Emacs manual:

       The command `C-x ^' (`enlarge-window') makes the selected window one
    line taller, taking space from a vertically adjacent window without
    changing the height of the frame.  With a positive numeric argument,
    this command increases the window height by that many lines; with a
    negative argument, it reduces the height by that many lines.  If there
    are no vertically adjacent windows (i.e., the window is at the full
    frame height), that signals an error.  The command also signals an
    error if you attempt to reduce the height of any window below a certain
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    minimum number of lines, specified by the variable `window-min-height'
    (the default is 4).

       Similarly, `C-x }' (`enlarge-window-horizontally') makes the
    selected window wider, and `C-x {' (`shrink-window-horizontally') makes
    it narrower.  These commands signal an error if you attempt to reduce
                                                        ^^^^^^^^^^^^^^^^^
    the width of any window below a certain minimum number of columns,
    ^^^^^^^^^^^^^^^^^^^^^^^
    specified by the variable `window-min-width' (the default is 10).

We can easily change that to not signal an error but then behaviors like
the one reported by Eli will get passed by unnoticed.  Emacsen < 23
silently could delete windows when you made them too small with these
commands.  This was deprecated but IIRC no one ever expressed a
preference as to how these functions _should_ behave when there is not
enough space.  Suggestions welcome.

Personally, I'd never use ‘enlarge-window’ and ‘shrink-window’ in Lisp
code.  IMO these are for interactive use only (supported by the fact
that neither of these functions is documented in the Elisp manual).

martin




  reply	other threads:[~2016-03-01  8:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160218102715.15576.42604@vcs.savannah.gnu.org>
     [not found] ` <E1aWLnn-000448-7K@vcs.savannah.gnu.org>
2016-03-01  1:31   ` emacs-25 3722a69: Fix bugs in window resizing code Óscar Fuentes
2016-03-01  8:07     ` martin rudalics [this message]
2016-03-01 15:10       ` Óscar Fuentes
2016-03-01 17:04         ` martin rudalics
2016-03-01 17:20           ` Eli Zaretskii
2016-03-02  8:22             ` martin rudalics
2016-03-02  9:28               ` martin rudalics
2016-03-02 15:54               ` Eli Zaretskii
2016-03-04  7:48                 ` martin rudalics
2016-03-04  8:28                   ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=56D54DB4.1080502@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=ofv@wanadoo.es \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).