<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=X-VIET-VPS">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I'm still having some trouble with the R bundle.<br>
<br>
I'm getting, what to me is unexpected behavior, from the command
that says "Send Selection/Line to" and in the sub-menu says "R.app
& Step" (this is the one that has the default key binding of
option+shift+enter. Here is the code in my bundle:<br>
<br>
<blockquote><tt>#!/usr/bin/env bash</tt><tt><br>
</tt><tt>[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] &&
. "${TM_SUPPORT_PATH}/lib/bash_init.sh"</tt><tt><br>
</tt><tt><br>
</tt><tt># input is selection or document</tt><tt><br>
</tt><tt>rawText="`cat`"</tt><tt><br>
</tt><tt><br>
</tt><tt>curDir=''</tt><tt><br>
</tt><tt>if [[ ${#TM_DIRECTORY} -gt 0 ]]; then</tt><tt><br>
</tt><tt> curDir="$TM_DIRECTORY"</tt><tt><br>
</tt><tt>fi</tt><tt><br>
</tt><tt><br>
</tt><tt>osascript -e 'on run(theCode)' \</tt><tt><br>
</tt><tt> -e 'tell application "R" to activate' \</tt><tt><br>
</tt><tt> -e 'if (item 2 of theCode) is not "" then tell
application "R" to cmd "setwd('\''" & (item 2 of theCode)
& "'\'')"' \</tt><tt><br>
</tt><tt> -e 'tell application "R" to cmd (item 1 of
theCode)' \</tt><tt><br>
</tt><tt> -e 'end run' -- "$rawText" "$curDir"</tt><tt><br>
</tt><tt><br>
</tt><tt>if [ "$TM_LINE_NUMBER" != "" ]; then</tt><tt><br>
</tt><tt> open "${TM_MATE:-$TM_SUPPORT_PATH/bin/mate} -l
?line?&column=1000000" &</tt><tt><br>
</tt><tt>elif [[ $TM_SELECTION =~
[1-9][0-9]*:?[0-9]*-([1-9][0-9]*):?[0-9]* ]]; then</tt><tt><br>
</tt><tt> # Regular Selection</tt><tt><br>
</tt><tt> open
<a class="moz-txt-link-rfc2396E" href="txmt://open?line=$((${BASH_REMATCH[1]}+1))&column=1000000">"txmt://open?line=$((${BASH_REMATCH[1]}+1))&column=1000000"</a>
&</tt><tt><br>
</tt><tt>elif [[ $TM_SELECTION =~
[1-9][0-9]*:?[0-9]*x([1-9][0-9]*):?[0-9]* ]]; then </tt><tt><br>
</tt><tt> # Block (option) selection</tt><tt><br>
</tt><tt> open
<a class="moz-txt-link-rfc2396E" href="txmt://open?line=$((${BASH_REMATCH[1]}+1))&column=1000000">"txmt://open?line=$((${BASH_REMATCH[1]}+1))&column=1000000"</a>
&</tt><tt><br>
</tt><tt>else </tt><tt><br>
</tt><tt> open <a class="moz-txt-link-rfc2396E" href="txmt://open">"txmt://open"</a></tt><tt><br>
</tt><tt>fi</tt><br>
</blockquote>
If I don't have anything selected, i.e. just send the line, it will
send the line to R.app, but then retain focus on R.app. If I run it
on a selection it does the same thing, but also opens Textmate 1.
I'd like it to not open Textmate 1, and to return focus to the
original window/tab after the line or selection has been sent.<br>
<br>
The command that says ""Send Selection/Document to" in the sub-menu
R.app (default keybinding command+option+shift+R) also sends focus
to R.app.<br>
<br>
I would appreciate if someone could show me how to change the code
to send focus back to Textmate2, that is my biggest complaint. I
really like the package in Textmate 1. The few times I've considered
going to Emacs+ESS I've always given up because Textmate can do
everything I want. I want to move to Textmate2, but at least for
this bundle, it seems like a step backwards. I don't mean to sound
like a downer, I do appreciate the program.<br>
<br>
Thank you,<br>
<br>
Kevin<br>
<br>
</body>
</html>