unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Include buffer-move.el
@ 2007-08-14 21:55 Leo
  2007-08-14 22:10 ` Glenn Morris
  2007-08-14 23:50 ` Juri Linkov
  0 siblings, 2 replies; 15+ messages in thread
From: Leo @ 2007-08-14 21:55 UTC (permalink / raw)
  To: emacs-devel

Hi there,

Is it a good idea to include buffer-mode.el¹?

Footnotes: 
¹  http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el
-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

          Gnus is one component of the Emacs operating system.

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

* Re: Include buffer-move.el
  2007-08-14 21:55 Include buffer-move.el Leo
@ 2007-08-14 22:10 ` Glenn Morris
  2007-08-14 23:50 ` Juri Linkov
  1 sibling, 0 replies; 15+ messages in thread
From: Glenn Morris @ 2007-08-14 22:10 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo wrote:

> Is it a good idea to include buffer-mode.el¹?
>
> Footnotes: 
> ¹  http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el

Who knows? If you want to be helpful, perhaps you would care to say
what it does and why/if you personally find it useful, well-written,
etc? Even just pasting the commentary would be an improvement:


    ;; This file is for lazy people wanting to swap buffers without
    ;; typing C-x b on each window. This is useful when you have :

    ;; +--------------+-------------+
    ;; |              |             |
    ;; |    #emacs    |    #gnus    |
    ;; |              |             |
    ;; +--------------+-------------+
    ;; |                            |
    ;; |           .emacs           |
    ;; |                            |
    ;; +----------------------------+

    ;; and you want to have :

    ;; +--------------+-------------+
    ;; |              |             |
    ;; |    #gnus     |   .emacs    |
    ;; |              |             |
    ;; +--------------+-------------+
    ;; |                            |
    ;; |           #emacs           |
    ;; |                            |
    ;; +----------------------------+

    ;; With buffer-move, just go in #gnus, do buf-move-left, go to #emacs
    ;; (which now should be on top right) and do buf-move-down.

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

* Re: Include buffer-move.el
  2007-08-14 21:55 Include buffer-move.el Leo
  2007-08-14 22:10 ` Glenn Morris
@ 2007-08-14 23:50 ` Juri Linkov
  2007-08-15  0:08   ` Lennart Borgman (gmail)
  2007-08-15  3:14   ` Eli Zaretskii
  1 sibling, 2 replies; 15+ messages in thread
From: Juri Linkov @ 2007-08-14 23:50 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

> Is it a good idea to include buffer-mode.el¹?
>
> Footnotes: 
> ¹  http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el

This package seems like a good complement of windmove.el (maybe its
contents should be added to windmove.el).  Together they provide
a convenient way of moving buffers between windows similar to moving
squares in the 15 puzzle :-)

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Include buffer-move.el
  2007-08-14 23:50 ` Juri Linkov
@ 2007-08-15  0:08   ` Lennart Borgman (gmail)
  2007-08-15 11:11     ` Juri Linkov
  2007-08-15  3:14   ` Eli Zaretskii
  1 sibling, 1 reply; 15+ messages in thread
From: Lennart Borgman (gmail) @ 2007-08-15  0:08 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Leo, emacs-devel

Juri Linkov wrote:
>> Is it a good idea to include buffer-mode.el¹?
>>
>> Footnotes: 
>> ¹  http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el
> 
> This package seems like a good complement of windmove.el (maybe its
> contents should be added to windmove.el).  Together they provide
> a convenient way of moving buffers between windows similar to moving
> squares in the 15 puzzle :-)

Then an incitament for adding it should of course be that it makes it 
easy to add a 15 puzzle to Emacs.

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

* Re: Include buffer-move.el
  2007-08-14 23:50 ` Juri Linkov
  2007-08-15  0:08   ` Lennart Borgman (gmail)
@ 2007-08-15  3:14   ` Eli Zaretskii
  2007-08-15  7:01     ` Mathias Dahl
  2007-08-15  9:24     ` Lucas Bonnet
  1 sibling, 2 replies; 15+ messages in thread
From: Eli Zaretskii @ 2007-08-15  3:14 UTC (permalink / raw)
  To: Juri Linkov; +Cc: sdl.web, emacs-devel

> From: Juri Linkov <juri@jurta.org>
> Date: Wed, 15 Aug 2007 02:50:57 +0300
> Cc: emacs-devel@gnu.org
> 
> > Is it a good idea to include buffer-mode.el¹?
> >
> > Footnotes: 
> > ¹  http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el
> 
> This package seems like a good complement of windmove.el (maybe its
> contents should be added to windmove.el).

I think we should indeed add this functionality to windmove.el.

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

* Re: Include buffer-move.el
  2007-08-15  3:14   ` Eli Zaretskii
@ 2007-08-15  7:01     ` Mathias Dahl
  2007-08-15 10:23       ` Leo
  2007-08-15 11:14       ` Juri Linkov
  2007-08-15  9:24     ` Lucas Bonnet
  1 sibling, 2 replies; 15+ messages in thread
From: Mathias Dahl @ 2007-08-15  7:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Juri Linkov, sdl.web, emacs-devel

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

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

* Re: Include buffer-move.el
  2007-08-15  3:14   ` Eli Zaretskii
  2007-08-15  7:01     ` Mathias Dahl
@ 2007-08-15  9:24     ` Lucas Bonnet
  2007-08-16 21:53       ` Leo
  1 sibling, 1 reply; 15+ messages in thread
From: Lucas Bonnet @ 2007-08-15  9:24 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Juri Linkov <juri@jurta.org>
>> Date: Wed, 15 Aug 2007 02:50:57 +0300
>> Cc: emacs-devel@gnu.org
>> 
>> > Is it a good idea to include buffer-mode.el¹?
>> >
>> > Footnotes: 
>> > ¹  http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el
>> 
>> This package seems like a good complement of windmove.el (maybe its
>> contents should be added to windmove.el).
>
> I think we should indeed add this functionality to windmove.el.

As the author of buffer-move.el, I'm obviously all for it. The code
might need a bit of refinement, tough, since it was one of my first
public package.

I haven't signed papers for Emacs, as far as I can tell, only for
EMMS. Do I need to sign other papers, or do you just want to copy the
idea and implement it in a cleaner way? :)

Regards,
-- 
Lucas Bonnet

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

* Re: Include buffer-move.el
  2007-08-15  7:01     ` Mathias Dahl
@ 2007-08-15 10:23       ` Leo
  2007-08-15 11:14       ` Juri Linkov
  1 sibling, 0 replies; 15+ messages in thread
From: Leo @ 2007-08-15 10:23 UTC (permalink / raw)
  To: emacs-devel

On 2007-08-15 08:01 +0100, Mathias Dahl wrote:
>> 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.

I copied the code here for convenience.

  (defun rotate-window-buffers ()                                                                                 
    (interactive)                                                                                                 
    (let* ((ws (window-list))                                                                                     
           (bs (mapcar 'window-buffer ws))                                                                        
           (ps (mapcar 'window-point ws))                                                                         
           (w (pop ws)))                                                                                          
      (dolist (v (append ws `(,w)))                                                                               
        (set-window-buffer v (pop bs))                                                                            
        (set-window-point v (pop ps)))))

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

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

* Re: Include buffer-move.el
  2007-08-15  0:08   ` Lennart Borgman (gmail)
@ 2007-08-15 11:11     ` Juri Linkov
  2007-08-15 11:36       ` Andreas Schwab
  0 siblings, 1 reply; 15+ messages in thread
From: Juri Linkov @ 2007-08-15 11:11 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Leo, emacs-devel

>> This package seems like a good complement of windmove.el (maybe its
>> contents should be added to windmove.el).  Together they provide
>> a convenient way of moving buffers between windows similar to moving
>> squares in the 15 puzzle :-)
>
> Then an incitament for adding it should of course be that it makes it easy
> to add a 15 puzzle to Emacs.

Just split a frame into 4x4 squares, create buffers with names 1..15,
and use S-arrows to move point between windows and C-S-arrows to move
buffers between windows (well, this is not exactly real rules of 15,
since adjacent buffers are swapped, not moved with pushing other squares
but this is very close.)

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Include buffer-move.el
  2007-08-15  7:01     ` Mathias Dahl
  2007-08-15 10:23       ` Leo
@ 2007-08-15 11:14       ` Juri Linkov
  1 sibling, 0 replies; 15+ messages in thread
From: Juri Linkov @ 2007-08-15 11:14 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: Eli Zaretskii, sdl.web, emacs-devel

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

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

* Re: Include buffer-move.el
  2007-08-15 11:11     ` Juri Linkov
@ 2007-08-15 11:36       ` Andreas Schwab
  2007-08-15 13:46         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2007-08-15 11:36 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Lennart Borgman (gmail), Leo, emacs-devel

Juri Linkov <juri@jurta.org> writes:

> Just split a frame into 4x4 squares, create buffers with names 1..15,
> and use S-arrows to move point between windows and C-S-arrows to move
> buffers between windows (well, this is not exactly real rules of 15,
> since adjacent buffers are swapped, not moved with pushing other squares
> but this is very close.)

It's a rather important detail, since with the original rules it is
impossible to swap two neighbouring squares, partitioning all possible
arrangements into two distinct sets with no way to transform between
them.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Include buffer-move.el
  2007-08-15 11:36       ` Andreas Schwab
@ 2007-08-15 13:46         ` Lennart Borgman (gmail)
  2007-08-15 13:51           ` David Kastrup
  2007-08-15 15:20           ` Davis Herring
  0 siblings, 2 replies; 15+ messages in thread
From: Lennart Borgman (gmail) @ 2007-08-15 13:46 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Juri Linkov, Leo, emacs-devel

Andreas Schwab wrote:
> Juri Linkov <juri@jurta.org> writes:
> 
>> Just split a frame into 4x4 squares, create buffers with names 1..15,
>> and use S-arrows to move point between windows and C-S-arrows to move
>> buffers between windows (well, this is not exactly real rules of 15,
>> since adjacent buffers are swapped, not moved with pushing other squares
>> but this is very close.)
> 
> It's a rather important detail, since with the original rules it is
> impossible to swap two neighbouring squares, partitioning all possible
> arrangements into two distinct sets with no way to transform between
> them.

Why would you have games if you could not cheat? Anyway, just add a 
buffer named "empty" and only allow switching with that one.

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

* Re: Include buffer-move.el
  2007-08-15 13:46         ` Lennart Borgman (gmail)
@ 2007-08-15 13:51           ` David Kastrup
  2007-08-15 15:20           ` Davis Herring
  1 sibling, 0 replies; 15+ messages in thread
From: David Kastrup @ 2007-08-15 13:51 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> Andreas Schwab wrote:
>> Juri Linkov <juri@jurta.org> writes:
>>
>>> Just split a frame into 4x4 squares, create buffers with names 1..15,
>>> and use S-arrows to move point between windows and C-S-arrows to move
>>> buffers between windows (well, this is not exactly real rules of 15,
>>> since adjacent buffers are swapped, not moved with pushing other squares
>>> but this is very close.)
>>
>> It's a rather important detail, since with the original rules it is
>> impossible to swap two neighbouring squares, partitioning all possible
>> arrangements into two distinct sets with no way to transform between
>> them.
>
> Why would you have games if you could not cheat? Anyway, just add a
> buffer named "empty" and only allow switching with that one.

We could just use startup-buffer-whatever for that...

-- 
David Kastrup

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

* Re: Include buffer-move.el
  2007-08-15 13:46         ` Lennart Borgman (gmail)
  2007-08-15 13:51           ` David Kastrup
@ 2007-08-15 15:20           ` Davis Herring
  1 sibling, 0 replies; 15+ messages in thread
From: Davis Herring @ 2007-08-15 15:20 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Juri Linkov, Andreas Schwab, Leo, emacs-devel

>> It's a rather important detail, since with the original rules it is
>> impossible to swap two neighbouring squares, partitioning all possible
>> arrangements into two distinct sets with no way to transform between
>> them.
>
> Why would you have games if you could not cheat? Anyway, just add a
> buffer named "empty" and only allow switching with that one.

The best thing about Emacs is how it directly supports so many useful
user-interaction modes.  Here, for instance, we can have a 15-mode (Lisp
allows symbols to begin with digits -- take that, "real" languages!) for
the empty space that supports C-S-u/l/d/r to exchange the empty space with
an adjacent tile.

Some users (probably closet vi users who don't understand that point is
really between buffers, not in a particular buffer) will complain that you
ought to be able to slide a number tile -into- the empty space without
having to move to the empty space and slide it the other direction, but
clearly all moves just shove the empty space around so you can put select
that buffer and go to town.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

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

* Re: Include buffer-move.el
  2007-08-15  9:24     ` Lucas Bonnet
@ 2007-08-16 21:53       ` Leo
  0 siblings, 0 replies; 15+ messages in thread
From: Leo @ 2007-08-16 21:53 UTC (permalink / raw)
  To: emacs-devel

On 2007-08-15 10:24 +0100, Lucas Bonnet wrote:
> As the author of buffer-move.el, I'm obviously all for it. The code
> might need a bit of refinement, tough, since it was one of my first
> public package.

There are altogether 70 lines of code.

> I haven't signed papers for Emacs, as far as I can tell, only for
> EMMS. Do I need to sign other papers, or do you just want to copy the
> idea and implement it in a cleaner way? :)

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

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

end of thread, other threads:[~2007-08-16 21:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-14 21:55 Include buffer-move.el Leo
2007-08-14 22:10 ` Glenn Morris
2007-08-14 23:50 ` Juri Linkov
2007-08-15  0:08   ` Lennart Borgman (gmail)
2007-08-15 11:11     ` Juri Linkov
2007-08-15 11:36       ` Andreas Schwab
2007-08-15 13:46         ` Lennart Borgman (gmail)
2007-08-15 13:51           ` David Kastrup
2007-08-15 15:20           ` Davis Herring
2007-08-15  3:14   ` Eli Zaretskii
2007-08-15  7:01     ` Mathias Dahl
2007-08-15 10:23       ` Leo
2007-08-15 11:14       ` Juri Linkov
2007-08-15  9:24     ` Lucas Bonnet
2007-08-16 21:53       ` Leo

Code repositories for project(s) associated with this public inbox

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

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