unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: gnu-emacs-help@gnu.org
Subject: Popping up a buffer of certain width without making current windows too narrow
Date: Tue, 26 Jul 2022 18:09:47 +0200	[thread overview]
Message-ID: <874jz3j0so.fsf@gnu.org> (raw)

Hi all,

I have a situation where I generate a buffer and measure its contents'
width (it's a diff output which might be a side-by-side diff, so can be
probably around 160 columns wide), and then I want to display it.  I use

  (pop-to-buffer
   (current-buffer)
   `(nil (window-width. ,width)))

so that the the resulting window is wide enough to fit the buffer's
contents.

That basically works except it can easily result in an existing window
being split and the buffer of the split window now being much to narrow.

So what I'd actually would like to have is a way to say:

  1. Please show this buffer (no matter how, e.g., existing window or
     new window) and ensure the window that will show it is wide
     enough...

  2. ... while at the same time ensure that no existing window becomes
     resized narrower than, say, 70 columns.

Point 1 is solved but I have no idea about point 2.  I've tried setting
window-min-width to 70 but that didn't seem to have an effect.

As a workaround I'm currently using `display-buffer-at-bottom` as ACTION
entry which has the downside of creating a bottom window where a
side-by-side split would also do.

Bye,
Tassilo



             reply	other threads:[~2022-07-26 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 16:09 Tassilo Horn [this message]
2022-07-26 17:24 ` Popping up a buffer of certain width without making current windows too narrow Tassilo Horn

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=874jz3j0so.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=gnu-emacs-help@gnu.org \
    /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.
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).