unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "rgb" <rbielaws@i1.net>
Subject: Re: defun not working
Date: 20 Jul 2005 12:32:21 -0700	[thread overview]
Message-ID: <1121887941.783281.267360@f14g2000cwb.googlegroups.com> (raw)
In-Reply-To: 8g5lbd.46.ln@acm.acm


> > 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 (rutt.4+news@osu.edu)
  ;; 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)))

  reply	other threads:[~2005-07-20 19:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-19 11:56 defun not working Baloff
2005-07-18 21:41 ` Pascal Bourguignon
2005-07-18 21:56   ` Lennart Borgman
2005-07-19 15:20 ` Stefan Monnier
2005-07-20  9:28 ` Alan Mackenzie
2005-07-20 19:32   ` rgb [this message]
2005-07-21 12:44   ` Baloff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1121887941.783281.267360@f14g2000cwb.googlegroups.com \
    --to=rbielaws@i1.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).