I'll claim authorship of push-line-other-window.  I'm glad to hear
you find it useful.

Here are
* a couple of refinements
* how I created this in the first place - you may find this useful for
  other applications
* another useful macro

--------------------------------------------------
Refinements

Instead of C-x p, I now have it bound to M-o and C-t,
either of which is easier to type repeatedly.

(define-key esc-map "o" 'push-line-other-window)
(global-set-key "\C-t" 'push-line-other-window)

I now have a slightly more efficient version of the fset command in my
.emacs.  I can't send that in an email message, because it includes
some control characters, but I'll attach a small zip file that
contains the definition.

--------------------------------------------------
Origination

I created a macro that did what I want, then saved the macro into .emacs.
Steps are:
C-x ( start-kbd-macro
give the sequences of commands that does what you want
C-x ) end-kbd-macro
M-x name-last-kbd-macro  (give a name)
; In your .emacs:
M-x insert-kbd-macro
; Optionally, in your .emacs, bind it to a key sequence.

--------------------------------------------------
I've created a bunch of such macros, though you don't want most of them :-)
Here's one that's generally useful:

(fset 'double-line
   [escape ?k ?\C-e ?  ?z ?z ?z ?  ?\C-y ?\C-n ?\C-a])
; insert zzz between copies, can replace that with something needed, or
delete

With C-u, you can use that to do the same thing for many lines.
E.g. do
  C-u 3 M-x double-line
to convert:

foo
bar
zed

to:

foo zzz foo
bar zzz bar
zed zzz zed

which you can then use other editing commands to convert to:

mv foo.txt foo.dat
mv bar.txt bar.dat
mv zed.txt zed.dat

Naturally, you will want to use push-line-other-window to send
those commands to a shell window :-)

Tim Hesterberg


On Wed, Nov 19, 2008 at 8:58 AM, Charles C. Berry <cberry@tajo.ucsd.edu>wrote:

> On Wed, 19 Nov 2008, Luis F wrote:
>
>  Dear Douglas, Richard, Mailing List:
>>
>> Thanks for such a quick reply. Douglas is absolutely right. I was
>> precisely trying to write an email clarifying my unprecise mail. Sorry
>> about that.
>>
>> Douglas Bates wrote:
>>
>>>  On Wed, Nov 19, 2008 at 8:12 AM, Richard M. Heiberger <rmh@temple.edu>
>>>  wrote:
>>>
>>> >  Use ESS.  The behavior is identical on Windows and Unix.
>>> >
>>>  I believe Luis is asking a different question, Richard.  He wants to
>>>  have separate shell and shell-script windows in which he can send
>>>  lines from the shell script window to be executed in the shell window.
>>>  That is, he wants to emulate some of the features provided by ESS for
>>>  R, S-PLUS (which apparently now has become S+) and SAS source files in
>>>  shell scripts.
>>>
>>
>
> You can use shell-script-mode to edit the script and add his macro:
>
>        (fset 'push-line-other-window
>        "\C-@\C-e\M-w\C-n\C-a\C-xo\M->\C-y\C-m\C-xo")
>        (global-set-key "\C-xp" 'push-line-other-window )
>
> to your .emacs (or wherever).
>
> With the shell-script-mode window open and the shell-mode window open, you
> can use C-X p to send a line from the former to the latter.
>
> My thanks to the orignator of this macro and apologies for forgetting
> his/her name. I think it was posted on S-news. I've used it for years when I
> want to move a line from one buffer to another.
>
>
> HTH,
>
> Chuck
>
>
>
>
>>>
>>> >  -----Original Message-----
>>> >  From: ess-help-bounces@stat.math.ethz.ch
>>> >  [mailto:ess-help-bounces@stat.math.ethz.ch] On Behalf Of Luis F
>>> >  Sent: Wednesday, November 19, 2008 09:02
>>> >  To: ess-help@stat.math.ethz.ch
>>> >  Subject: [ESS] XEmacs, UNIX, ESS
>>> > >  Dear Mailing List,
>>> > >  I am a biologist, very used to program in R using XEmacs and ESS. I
>>> have
>>> >  to do some little things in UNIX now. I would love to have something
>>> >  similar to what I'm used to with ESS.
>>> > >  Mainly:
>>> >  1) a shell script on my top window
>>> >  2) a shell on my bottom window
>>> >  3) send commands from the script (one line at the time, similar to C-c
>>> >  C-n; a region - C-C C-r; the whole file C-c C-l)
>>> > >  I could already do 1) and 2) (alt-x shell) (major achievements!) and
>>> I
>>> >  can copy-paste, go from one window do the next (C-x o) and that is
>>> >  already a great improvment.
>>> > >  But I can't do 3). Any suggestions?
>>> > >  I realize this might be a question outside of the strict scope of
>>> this
>>> >  list (and I appologize if anyone feels this is spam); I decided to
>>> post
>>> >  it here, because after searching for a while in the web, i felt this
>>> >  specific request would be more understood by people in here.
>>> > >  Thank you all for your work,
>>> >  Tiago
>>>
>>

	[[alternative HTML version deleted]]


