all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: defun not working
  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
  2 siblings, 1 reply; 7+ messages in thread
From: Pascal Bourguignon @ 2005-07-18 21:41 UTC (permalink / raw)


Baloff <vddr2u@bi.edu.gr> writes:

> 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))
>
> upone M-x edo-vertical-to-horizontal
> it actually do horizontal to vertical which is the opposite to what it
> is suppost to do. it was working good last time I used it which was a
> year or so ago, I since upgraded my debain.
>
> not sure why it would do this.

Because that's the way it is: split-window-horizontally splits vertical windows
and  split-window-vertically splits horizontal windows.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: defun not working
  2005-07-18 21:41 ` Pascal Bourguignon
@ 2005-07-18 21:56   ` Lennart Borgman
  0 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2005-07-18 21:56 UTC (permalink / raw)
  Cc: help-gnu-emacs

Pascal Bourguignon wrote:

>Because that's the way it is: split-window-horizontally splits vertical windows
>and  split-window-vertically splits horizontal windows.
>  
>
Or maybe you can say "split-window-horizontally makes a vertical split 
along the horizontal line"?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* defun not working
@ 2005-07-19 11:56 Baloff
  2005-07-18 21:41 ` Pascal Bourguignon
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Baloff @ 2005-07-19 11:56 UTC (permalink / raw)


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

upone M-x edo-vertical-to-horizontal
it actually do horizontal to vertical which is the opposite to what it 
is suppost to do. it was working good last time I used it which was a 
year or so ago, I since upgraded my debain.

not sure why it would do this.

thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: defun not working
  2005-07-19 11:56 defun not working Baloff
  2005-07-18 21:41 ` Pascal Bourguignon
@ 2005-07-19 15:20 ` Stefan Monnier
  2005-07-20  9:28 ` Alan Mackenzie
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2005-07-19 15:20 UTC (permalink / raw)


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

Go to the first open-paren and press C-M-q that will make your code
more readable, especially to readers of this newsgroup.  Thank you,


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: defun not working
  2005-07-19 11:56 defun not working Baloff
  2005-07-18 21:41 ` Pascal Bourguignon
  2005-07-19 15:20 ` Stefan Monnier
@ 2005-07-20  9:28 ` Alan Mackenzie
  2005-07-20 19:32   ` rgb
  2005-07-21 12:44   ` Baloff
  2 siblings, 2 replies; 7+ messages in thread
From: Alan Mackenzie @ 2005-07-20  9:28 UTC (permalink / raw)


Baloff <vddr2u@bi.edu.gr> wrote on Tue, 19 Jul 2005 04:56:26 -0700:
> 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))

I don't think that's _quite_ what you've got in your .emacs:  I think in
your real .emacs you've got (delete-other-windows)
                                                ^
                                                |

, and there's an extra parenthesis at the end, to balance the one opening
the defun.  You seem to be using Mozilla on Windows NT.  Have you been
having trouble copying and pasting text from Emacs into Mozilla?

> upone M-x edo-vertical-to-horizontal
> it actually do horizontal to vertical which is the opposite to what it 
> is suppost to do. it was working good last time I used it which was a 
> year or so ago, I since upgraded my debain.

What the function does for me is to change this layout:

*******************************
*                             *
*                             *
*******************************
*                             *
*                             *
*******************************

to this one:

*******************************
*              *              *
*              *              *
*              *              *
*              *              *
*              *              *
*******************************

> not sure why it would do this.

`split-window-horizonally' means "split so that to go between the
resulting windows means moving horizontally", NOT "split so that the
resulting windows are separated by a horizontal line".  This seems
arbitrary, but the choice had to be made one way or the other.
Personally, I agree with you, and I think the choice was made the wrong
way - looking at the second of my diagrams, I imagine a sword swiping
VERTICALLY through a sheet of paper.

> thanks

THANK YOU for this function!  I've been doing this with the clumsy double
sequence C-x 1, C-x 3 for years, and never quite consciously realised
what a hassle this was.  So, I've now put this into my .emacs with this
key-binding:  (global-set-key "\C-cv 'edo-vertical-to-horizontal).  I've
also made the obvious other function, and bound (global-set-key "\C-ch
'edo-horizontal-to-vertical).

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: defun not working
  2005-07-20  9:28 ` Alan Mackenzie
@ 2005-07-20 19:32   ` rgb
  2005-07-21 12:44   ` Baloff
  1 sibling, 0 replies; 7+ messages in thread
From: rgb @ 2005-07-20 19:32 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: defun not working
  2005-07-20  9:28 ` Alan Mackenzie
  2005-07-20 19:32   ` rgb
@ 2005-07-21 12:44   ` Baloff
  1 sibling, 0 replies; 7+ messages in thread
From: Baloff @ 2005-07-21 12:44 UTC (permalink / raw)


Alan Mackenzie wrote
> 
> , and there's an extra parenthesis at the end, to balance the one opening
> the defun.  You seem to be using Mozilla on Windows NT.  Have you been
> having trouble copying and pasting text from Emacs into Mozilla?
> 
I have 2 different pc, the emacs one not on line, Mozilla is on the box 
which is online, so I don't copy/paste. but last I remember using that 
functionality, yes, it works fine.
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-21 12:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2005-07-21 12:44   ` Baloff

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.