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

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

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


From: Klaus Berndl
Subject: [h-e-w] Re: split-window-recent
Date: 20 May 2003 09:16:38 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

On Mon, 19 May 2003, Nascif Abousalh-Neto wrote:



>  
>  
>  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)))   )

OK, this skips over the minibuffer but nevertheless `other-buffer' is even
smarter than your function :-)

I assume you do not want buffers being displayed if the buffer-name begins with
a blank, so for example buffers with names like " *nntpd*" (a buffer used by
Gnus but only internally and not intended to be displayed in a window), right?

OK, `other-buffer' skips over all these buffers...

Klaus

>  
> > -----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
> > >
> > >
> > >
> > >
> >
-- 
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]