> > Hello
> > I have this in my ~/.emacs
>
> > (defun edo-vertical-to-horizontal ()
> > (interactive)
> > (let ((one-buf (window-buffer (selected-window))))
> > (other-window 1)
> > (delete-other-window)
> > (split-window-horizontally)
> > (switch-to-buffer one-buf))
>

After using the above for a while you might become annoyed
by the loss of your cursor position when switching views.
So I use this.

  ;; Idea and starter code from Benjamin Rutt ([EMAIL PROTECTED])
  ;; on comp.emacs. Enhanced by RGB.
  (defun rgb-window-horizontal-to-vertical ()
    "Switches from a horizontal split to a vertical split."
    (interactive)
    (let ((one-buf (window-buffer (selected-window)))
          (buf-point (point)))
      (other-window 1)
      (delete-other-windows)
      (split-window-horizontally)
      (switch-to-buffer one-buf)
      (goto-char buf-point)))

  ;; complement of above created by RGB 11/2004
  (defun rgb-window-vertical-to-horizontal ()
    "Switches from a vertical split to a horizontal split."
    (interactive)
    (let ((one-buf (window-buffer (selected-window)))
          (buf-point (point)))
      (other-window 1)
      (delete-other-windows)
      (split-window-vertically)
      (switch-to-buffer one-buf)
      (goto-char buf-point)))

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to