unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>, Paul Rankin <hello@paulwrankin.com>
Cc: 24193@debbugs.gnu.org
Subject: bug#24193: 25.1; `window-min-size' fails for horizontal width when margins >= body text
Date: Mon, 15 Aug 2016 10:28:12 +0200	[thread overview]
Message-ID: <57B17D1C.7070200@gmx.at> (raw)
In-Reply-To: <831t1rh14o.fsf@gnu.org>

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

 > I'm not sure we want to change window-min-size.  That function is used
 > for purposes that have nothing to do with splitting the window.  E.g.,
 > we also use its value when deciding whether a window can be resized,
 > when fitting window to buffer, etc.
 >
 > The lowest level function for splitting windows is split-window, so
 > the change should IMO be either in split-window-right or in
 > split-window.  Martin, WDYT?

This wouldnn't help much because as soon as a user has two side-by-side
windows she might want to drag the divider between those windows and
complain that it doesn't move.  We can install the attached hack in
Emacs 25.1 and leave this subject alone until someone has a better
solution.

martin

[-- Attachment #2: min-margins.diff --]
[-- Type: text/plain, Size: 2535 bytes --]

diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 55d90bd..7c07dd1 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -4349,6 +4349,24 @@ Window Parameters
 The fourth element is the buffer whose display caused the creation of
 this parameter.  @code{quit-restore-window} deletes the specified window
 only if it still shows that buffer.
+
+@item @code{min-margins}
+The value of this parameter is a cons cell specifying the minimum values
+(in columns) for the left and right margin of this window.  When
+present, Emacs will use these values instead of the real margin widths
+for determining whether a window can be split or shrunk.
+
+Emacs does not auto-adjust the margins of any window after splitting or
+resizing it.  It is sole responsibility of the application that sets
+this parameter to adjust the margins of this window as well as those of
+any new window created by a split.  The hooks to achieve that are
+@code{window-configuration-change-hook} and
+@code{window-size-change-functions} (@pxref{Window Hooks}).
+
+This parameter was introduced in Emacs version 25.1 as a conspiracy hack
+for applications that use large margins to center buffer text within a
+window and should be used with extreme care.  It can be replaced by an
+improved solution in future versions of Emacs.
 @end table

 There are additional parameters @code{window-atom} and @code{window-side};
diff --git a/lisp/window.el b/lisp/window.el
index f7a547b..ca8141b 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1383,10 +1383,17 @@ window--min-size-1
 	  (let* ((char-size (frame-char-size window t))
 		 (fringes (window-fringes window))
 		 (margins (window-margins window))
+                 (min-margins (window-parameter window 'min-margins))
+                 (left-min-margin (and min-margins
+                                       (numberp (car min-margins))
+                                       (car min-margins)))
+                 (right-min-margin (and min-margins
+                                        (numberp (cdr min-margins))
+                                        (cdr min-margins)))
 		 (pixel-width
 		  (+ (window-safe-min-size window t t)
-		     (* (or (car margins) 0) char-size)
-		     (* (or (cdr margins) 0) char-size)
+		     (* (or left-min-margin (car margins) 0) char-size)
+		     (* (or right-min-margin(cdr margins) 0) char-size)
 		     (car fringes) (cadr fringes)
 		     (window-scroll-bar-width window)
 		     (window-right-divider-width window))))


  reply	other threads:[~2016-08-15  8:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09  9:14 bug#24193: 25.1; `window-min-size' fails for horizontal width when margins >= body text Paul Rankin
2016-08-09  9:49 ` martin rudalics
2016-08-09 10:01   ` Paul Rankin
2016-08-09 10:15     ` martin rudalics
2016-08-09 10:37       ` Paul Rankin
2016-08-09 14:57         ` Eli Zaretskii
2016-08-09 15:18           ` Paul Rankin
2016-08-09 15:53             ` Eli Zaretskii
2016-08-14  5:11               ` Paul Rankin
2016-08-14 14:32                 ` Eli Zaretskii
2016-08-15  8:28                   ` martin rudalics [this message]
2016-08-15 10:02                     ` Paul Rankin
2016-08-16  7:35                       ` martin rudalics
2016-08-15 15:03                     ` Eli Zaretskii
2016-08-16  7:35                       ` martin rudalics
2016-08-16 14:19                         ` Eli Zaretskii
2016-09-02  4:06                           ` Paul Rankin
2016-09-02  6:29                             ` martin rudalics
2020-09-04 13:09                             ` Lars Ingebrigtsen
2020-09-04 13:41                               ` Eli Zaretskii
2020-09-04 14:54                               ` Paul W. Rankin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-05 12:28                                 ` Lars Ingebrigtsen
2016-08-09 16:08         ` martin rudalics
2016-08-14  5:24           ` Paul Rankin
2016-08-09 14:56 ` 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=57B17D1C.7070200@gmx.at \
    --to=rudalics@gmx.at \
    --cc=24193@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=hello@paulwrankin.com \
    /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).