all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'martin rudalics'" <rudalics@gmx.at>, <3366@emacsbugs.donarmstrong.com>
Subject: bug#3366: 23.0.94; doc of split-window-preferred-function, display-buffer, etc.
Date: Mon, 25 May 2009 01:42:40 -0700	[thread overview]
Message-ID: <779632281BA742BFB5A1470D08B17538@us.oracle.com> (raw)
In-Reply-To: <4A1A42F9.7050500@gmx.at>

>  > It seems (but I'm not sure this works for all cases) that what is
>  > needed, to ensure that the same window as before is split, 
>  > is to bind `split-window-preferred-function' to something like
>  > this around calls to `display-buffer':
>  > (lambda (w) (eq w (get-lru-window)))
> 
> The function you want might be
> 
> (defun split-window-22 (window)
>    (let ((frame (window-frame window)))
>      (or (and (setq window (get-largest-window frame t))
> 	     (window-full-width-p window)
> 	     (window-splittable-p window)
> 	     (split-window window))
> 	(and (setq window (get-lru-window frame t))
> 	     (window-splittable-p window)
> 	     (split-window window)))))
> 
> but I wouldn't rely on it.

Thanks for this info, Martin. For the particular code I had in mind the simpler
version I wrote above works, but I understand the difference.

>  > Even if this function is not an exact recipe for all 
>  > cases, something like it should be mentioned, to help users
>  > get back the behavior that existed before the new "smarter"
>  > behavior was introduced. Preferably, Emacs would itself provide
>  > a function that users could use here - a function that would
>  > give precisely the pre-23 behavior in all cases.
>  >
>  > We should also make it clear that if you want the pre-23 
>  > behavior then you will need to wrap not only explicit calls to 
>  > `display-buffer' with a `let' binding this way, but also calls
>  > to things such as `with-output-to-temp-buffer'.
> 
> All people have to do is customize
> `split-window-preferred-function' to that function.

No, I'm talking about code, not a broad user preference setting. Code that
wants, for example, to work with various releases.

But yes, that's my point: We should tell users that they can bind
`split-window-preferred-function' to such a function to get Emacs 22/21/20
behavior wrt window splitting. I suggest we provide such a function, and mention
it in the doc string. If the function you wrote above isn't perfect, it's still
probably pretty good. Bug reports will help perfect it, if need be.







  reply	other threads:[~2009-05-25  8:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-24 17:01 bug#3366: 23.0.94; doc of split-window-preferred-function, display-buffer, etc Drew Adams
2009-05-25  7:04 ` martin rudalics
2009-05-25  8:42   ` Drew Adams [this message]
2009-05-25  9:40     ` martin rudalics
2009-05-25 15:27     ` Stefan Monnier
2009-05-26  9:28       ` martin rudalics
2009-05-26 13:47         ` Drew Adams
2009-05-26 17:12         ` Stefan Monnier
2009-05-27  6:53           ` martin rudalics
2009-05-27 14:39             ` Stefan Monnier
2009-05-27 14:47               ` Drew Adams
2009-05-27 17:03               ` martin rudalics
2009-05-27 17:54                 ` Stefan Monnier
2011-07-11 16:03                   ` Lars Magne Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=779632281BA742BFB5A1470D08B17538@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=3366@emacsbugs.donarmstrong.com \
    --cc=rudalics@gmx.at \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.