help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [h-e-w] Re: split-window-recent


From: Nascif Abousalh-Neto
Subject: RE: [h-e-w] Re: split-window-recent
Date: Mon, 19 May 2003 16:16:47 -0400

Hi Klaus,

I take it back, you're right. It seems to do what the original function intended, and to be smart enough to skip over the minibuffer buffers.

For what is worth, I created another version that does the "other-window" checks explicitly:

(defun split-window-recent ()
  "Split the current window, and show the next most recently used
buffer in the newly created window."
  (interactive)
  (split-window)
  (let ((nextbuf (next-non-minibuf-buffer (cddr (buffer-list)))))
    (when nextbuf
      (show-buffer (next-window (selected-window))
                   nextbuf))))

(defun next-non-minibuf-buffer (buflist)
  "returns the next non-visible, non-minibuf-buffer from the given list of buffers"
  (if (or (null (cdr buflist))
          (and (not (string-match "Minibuf-" (buffer-name (car buflist))))
               (not (get-buffer-window (car buflist) `visible)))
          )
      (car buflist)
    (next-non-minibuf-buffer (cdr buflist)))
  )

Thanks to all that replied.
Regards,
        Nascif

> -----Original Message-----
> From: Abousalh-Neto, Nascif [NCRTP:3X20:EXCH]
> Sent: Monday, May 19, 2003 2:19 PM
> To: 'Klaus Berndl'; address@hidden
> Subject: RE: [h-e-w] Re: split-window-recent
>
>
> No, not really. I don't want to keep splitting the most
> recent window, but to have two and only two windows. This
> function is meant to be a replacement for C-x 2.
>
> Thanks anyway,
>       Nascif
>
>
> > -----Original Message-----
> > From: Klaus Berndl [mailto:address@hidden]
> > Sent: Monday, May 19, 2003 11:24 AM
> > To: address@hidden
> > Subject: [h-e-w] Re: split-window-recent
> >
> >
> > On Fri, 16 May 2003, Nascif Abousalh-Neto wrote:
> >
> > > 
> > > 
> > >  Hi all,         I use the following command bound to C-x 2
> > (according
> > > to my  notes the code was created by Colin Walters, thanks!)
> > > 
> > >  (defun split-window-recent ()
> > >    "Split the current window, and show the next most recently used
> > > buffer in the newly created window."
> > >    (interactive)
> > >    (split-window)
> > >    (let ((nextbuf (caddr (buffer-list))))
> > >      (when nextbuf
> > >        (show-buffer (next-window (selected-window))
> > >                     nextbuf))))
> > > 
> > >  It is quite nice 90% of the time, but every now and then
> > it selects
> > > the  minibuffer buffer into the new window - which is clearly an
> > > annoyance. I  would like to test if the "nextbuf" buffer is the
> > > minibuffer, but there  seems to be no "minibuffer-p" or
> equivalent
> > > test predicate (on GNU Emacs  21.2).
> >
> > Ok, here comes a new version of split-window-recent which is
> > IMHO more cleaner and does also what you want:
> >
> > (defun split-window-recent ()
> >   (interactive)
> >   (split-window)
> >   (show-buffer (next-window (selected-window))
> >                (other-buffer)))
> >
> > Is this what you want?
> > Klaus
> >
> >
> > > 
> > >  Any ideas?
> > >  TIA,
> > >          Nascif
> > --
> > Klaus Berndl                        mailto: address@hidden
> > sd&m AG                             http://www.sdm.de
> > software design & management       
> > Thomas-Dehler-Str. 27, 81737 München, Germany
> > Tel +49 89 63812-392, Fax -220
> >
> >
> >
> >
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]