unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: emacs-devel@gnu.org
Subject: Re: Patch: prefer-window-split-horizontally
Date: Wed, 15 Aug 2007 17:49:36 +0200	[thread overview]
Message-ID: <87odh8vlv3.fsf@baldur.tsdh.de> (raw)
In-Reply-To: 42925.128.165.123.18.1187191448.squirrel@webmail.lanl.gov

"Davis Herring" <herring@lanl.gov> writes:

Hi Davis,

>> I think your approach would do that.  This example function would split
>> horizontally as long as all windows are 80 or more columns wide.
>>
>> --8<---------------cut here---------------start------------->8---
>> (defun th-split-window-function ()
>>   (save-window-excursion
>>     (save-excursion
>>       (split-window-horizontally)
>>       (balance-windows)
>>       (if (>= (let ((edges (window-edges))) (- (nth 2 edges) (nth 0
>> edges))) 80)
>>           'split-window-horizontally
>>         'split-window-vertically))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> Would you try to implement that?
>
> Splitting one window should not involve destroying all Lisp references
> to existing windows (as `save-window-excursion' must).  Unless
> redisplay would somehow be supressed here (I'm not sure), this would
> also involve calling `window-size-change-functions' twice for each
> split, which would be wasteful and perhaps confusing.

Is there another way to figure out how wide the windows that would
result from a horizontal split would be?

And if you want to avoid the problems you mentioned, you could go with:

--8<---------------cut here---------------start------------->8---
(defun th-split-window-function ()
  (if (>= (let ((edges (window-edges)))
            (- (nth 2 edges) (nth 0 edges)))
          162)
      'split-window-horizontally
    'split-window-vertically))
--8<---------------cut here---------------end--------------->8---

I don't use scroll bars, so if the current window is 162 columns wide a
horizontal split will result in two 80 column wide windows.  Two columns
will be occupied by the additional fringe.

Anyway, I like Juri's suggestion because it gives the user a very good
control over splitting decisions.

Bye,
Tassilo
-- 
A morning without coffee is like something without something else.

  reply	other threads:[~2007-08-15 15:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-14 16:34 Patch: prefer-window-split-horizontally Tassilo Horn
2007-08-14 16:51 ` Tassilo Horn
2007-08-15 18:22   ` Richard Stallman
2007-08-15 18:47     ` Tassilo Horn
2007-08-16  2:42       ` Richard Stallman
2007-08-16  5:52         ` Tassilo Horn
2007-08-14 20:47 ` Juri Linkov
2007-08-15  5:35   ` Tassilo Horn
2007-08-15 15:24     ` Davis Herring
2007-08-15 15:49       ` Tassilo Horn [this message]
2007-08-15 18:22   ` Richard Stallman
2007-08-15 18:57     ` Tassilo Horn
2007-08-15 19:35   ` Stefan Monnier
2007-08-15 19:53     ` Tassilo Horn
2007-08-15 20:31       ` Stefan Monnier
2007-08-16  6:28         ` Tassilo Horn
2007-08-16 13:11           ` Stefan Monnier
2007-08-16 13:38             ` Tassilo Horn
2007-08-16 14:00               ` klaus.berndl
2007-08-16 14:37                 ` Tassilo Horn
2007-08-16 14:34               ` Stefan Monnier
2007-08-16 14:52                 ` Tassilo Horn
2007-08-16 15:46                   ` klaus.berndl
2007-08-15 23:36     ` Juri Linkov
2007-08-16  0:45       ` Stefan Monnier
2007-08-16 20:21         ` Juri Linkov
2007-08-16  2:42       ` Richard Stallman
2007-08-16 20:23         ` Juri Linkov
2007-08-15  5:52 ` Dieter Wilhelm
2007-08-15  6:27   ` 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=87odh8vlv3.fsf@baldur.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=emacs-devel@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.
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).