Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's a function that does what you want. After loading it into emacs, select the buffer you want to rearrange and do an <code>M-x my-shift-window-right</code>. You can also bind it to a key with <code>global-set-key</code>.</p> <pre><code>(defun my-shift-window-right (&amp;optional start-window) "Reset the current window configuration with START-WINDOW on the right and the rest of the windows on the left. START-WINDOW defaults to the selected window. Return START-WINDOW, or nil if START-WINDOW isn't live or if there is only one visible window." (interactive (list (selected-window))) (if (or (one-window-p) (and start-window (not (window-live-p start-window)))) nil (let ((other-buffers '()) (start-window (or start-window (selected-window)))) ;; add all visible buffers other than the current one to other-buffers list (walk-windows #'(lambda (window) (when (not (eq window start-window)) (add-to-list 'other-buffers (window-buffer window))))) (delete-other-windows) ;; pop the first "other buffer" into a split window on the left (set-window-buffer (select-window (split-window start-window nil 'left)) (pop other-buffers)) ;; make a split window for each buffer in the "other-buffers" list ;; select the start-window and return it when finished (dolist (buffer other-buffers (select-window start-window)) (set-window-buffer (split-window (selected-window) nil 'above) buffer))))) </code></pre> <p>This function cycles through the other visible windows and stores each of their buffers in a list called <code>other-buffers</code>. Then it rearranges the windows the way you described by iterating over the <code>other-buffers</code> list.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload