[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Include buffer-move.el
From: |
Juri Linkov |
Subject: |
Re: Include buffer-move.el |
Date: |
Wed, 15 Aug 2007 14:14:08 +0300 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
>> I think we should indeed add this functionality to windmove.el.
>
> A similar function was discussed a while ago in gnu.emacs.help
> (subject "rotate split windows") and a simple solution developed:
>
> http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/5197a0895413ee6c/443d6b1f25e0c585?lnk=gst&q=rotate+buffer&rnum=2#443d6b1f25e0c585
>
> The difference is that the buffers are rotated, so you cannot do
> exactly what buffer-move seems to do. I thought I should mention it
> however in case people like that better.
Then I should mention my version of this function:
(defun rotate-window-buffers (&optional n)
"Exchange buffers in all windows N times.
With positive N, it uses the window order of `window-list'.
With negative N, does this in the reverse order."
(interactive "p")
(let* ((ws (window-list))
(bs (mapcar 'window-buffer ws))
(ps (mapcar 'window-point ws))
(n (mod (or n 1) (length ws))))
(dolist (w (append (last ws n) (butlast ws n)))
(set-window-buffer w (pop bs))
(set-window-point w (pop ps)))))
This is less flexible than proposed buffer-move, but still very useful.
I use it mostly to exchange two buffers in the horizontally split
two-window frame (this is like using `C-u' in commander-like file managers
to swap two panels). Perhaps this command should be added to window.el.
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: Include buffer-move.el, (continued)
- Re: Include buffer-move.el, Juri Linkov, 2007/08/14
- Re: Include buffer-move.el, Lennart Borgman (gmail), 2007/08/14
- Re: Include buffer-move.el, Juri Linkov, 2007/08/15
- Re: Include buffer-move.el, Andreas Schwab, 2007/08/15
- Re: Include buffer-move.el, Lennart Borgman (gmail), 2007/08/15
- Re: Include buffer-move.el, David Kastrup, 2007/08/15
- Re: Include buffer-move.el, Davis Herring, 2007/08/15
Re: Include buffer-move.el, Eli Zaretskii, 2007/08/14
Re: Include buffer-move.el, Lucas Bonnet, 2007/08/15
Re: Include buffer-move.el, Leo, 2007/08/16