unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Joost Kremers <joostkremers@fastmail.fm>, 44483@debbugs.gnu.org
Subject: bug#44483: 27.1.50; Window parameter `min-margins' doesn't split window in half
Date: Fri, 6 Nov 2020 19:12:51 +0100	[thread overview]
Message-ID: <b9921ceb-3635-b75b-f820-caf1fbb7174a@gmx.at> (raw)
In-Reply-To: <87tuu2inkv.fsf@fastmail.fm>

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

 > 1. Open any text file, preferably with long lines (to better see the effect).
 >
 > 2. `M-x visual-line-mode RET`
 >
 > 3. `M-: (set-window-margins (selected-window) 0 150) RET`
 >
 > The number 150 is arbitrary. It's appropriate for my case (with a frame width of
 > about 238 characters).
 >
 > 4. `M-: (set-window-parameter (selected-window) 'min-margins '(0 . 0)) RET`
 >
 > 5. `C-x 3`
 >
 > At this point, I expect the window to be split into two equally-sized
 > side-by-side windows, but the split is at about one third of the original window
 > width.

The problem is that when we split the original window, the new window
does not get its 'min-margins' parameter set and the subsequent
sanitizing step screws up things.  Please try the attached patch.

And please look also into what happens when you shrink a frame with such
large margins to a size that won't accommodate those margins any more
unless they get shrunk.  I'm afraid that the subsequent sanitizing step
might cause troubles there as well.

Thanks, martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: joost.diff --]
[-- Type: text/x-patch; name="joost.diff", Size: 705 bytes --]

diff --git a/lisp/window.el b/lisp/window.el
index 48005fc93e..6c08e71aae 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5414,6 +5414,12 @@ split-window

 	  ;; Sanitize sizes unless SIZE was specified.
 	  (unless size
+            ;; Make sure the new window gets any `min-margins' parameter
+            ;; of WINDOW.  Otherwise, sanitizing screws up window sizes
+            ;; considerably (Bug#44483).
+            (let ((min-margins (window-parameter window 'min-margins)))
+              (when min-margins
+                (set-window-parameter new 'min-margins min-margins)))
             (window--sanitize-window-sizes horizontal))

 	  (run-window-scroll-functions new)

  parent reply	other threads:[~2020-11-06 18:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 14:09 bug#44483: 27.1.50; Window parameter `min-margins' doesn't split window in half Joost Kremers
2020-11-06 14:41 ` Eli Zaretskii
2020-11-06 16:25   ` Joost Kremers
2020-11-06 18:29     ` Eli Zaretskii
2020-11-06 18:12 ` martin rudalics [this message]
2020-11-06 20:36   ` Joost Kremers
2020-11-07  9:00     ` martin rudalics
2020-11-08 15:00       ` Joost Kremers
2020-11-09  8:31         ` martin rudalics
2021-10-11 12:35           ` Stefan Kangas
2021-10-11 17:18             ` martin rudalics

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=b9921ceb-3635-b75b-f820-caf1fbb7174a@gmx.at \
    --to=rudalics@gmx.at \
    --cc=44483@debbugs.gnu.org \
    --cc=joostkremers@fastmail.fm \
    /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).