[R-SIG-Mac] built-in editor underlining

J ö rg Beyer Beyerj at students.uni-marburg.de
Mon Sep 18 20:32:49 CEST 2006


Simon, 

this is getting a more and more interesting thread, isn't it?


Am 18.09.2006 16:31 Uhr schrieb Simon Urbanek
(<simon.urbanek at r-project.org>):

> Jörg,
> 
> On Sep 17, 2006, at 2:28 PM, Jörg Beyer wrote:
> 
>> Your reply lets me fear I stepped onto your feet, which was not my
>> intention, as I already said.
> 
> Not at all - at least to the feet you think ;) - simply I really want
> people to tell us when they think - it's very frustrating when people
> don't tell us when they really think.

Well, this may be partly because people think that you already have enough
work to do...


>> Which means that I edit my R code with BBEdit, because it offers
>> -- speedy syntax highlighting
>> -- powerful RegEx search and replace, per file/folder/project
> 
> This sure sounds like a worthwhile feature

You may consider to try the demo, as a source of inspiration (?).
Try to have a look at these huge text fields BBEdit's/TextWrangler's search
& replace-dialog offers, incl. RegEx highlighting. Did you ever try to enter
a complex RegEx in one of that simple one line search/replace fields?
Horrible. 


>> -- easier navigation through the code (in my opinion; I tend to use
>> relatively large files, and have more than only a few open -- just
>> another question of taste)
> 
> Do you have things like "jump to the function definition of the
> function that the cursor is it" is mind, or just shortcuts between
> sections? Again, this could be useful

Both, and more. Jumping points/marks are useful sometimes. (BTW, BBEdit has
no built-in R-syntax support in the version I use, so it has no "jump to
function xy/next function/etc.", but that can be added with AppleScript. But
then, you still don't have a function popup or something similar for R-code
in v7, but with v8 or v8.5 this should work, I guess).
But back to your question. I can have a windows palette open (since v8 it's
a drawer, I think) and navigate with command-# to window 0-9, or pick the
file I want with a click on its entry. I prefer this to diving into a menu.
Bulk save, bulk close, too.
I can use window splitting -- I'm not the greatest fan of this feature, but
sometimes it helps to be a bit closer to the "big picture". Navigation in
this respect means, having different parts of the relevant code right in
front of you. 
I already mentioned RegEx searching through folders, which enhances
navigation, too, of course. I can pick a document in a search result list.
(Well, that should be enough, I'll stop before I'm getting too verbose
again.) 


>> -- productive automation features (well, that may sound a bit off-
>> topic, but is part of my personal coding and code organizing
>> style ... again,  only IMHO)
> 
> I'm not quite sure what automation you have in mind... I guess you
> don't mean AT ;)

What exactly is AT? Sorry for the dumb question.
Automation is ... well, a lot. Doing [bulk] search-replaces with AppleScript
and/or Automator and/or Perl filters, directly on a whole set of files, or
on selected text. Programmatically restricting such actions to specific
files in specific folders. Setting up new packages or projects, including
customized architectures (read: file- & folder hierarchies).  Controlling
and setting encodings, and syntax highlighting (Tcl for R-syntax; XML, ...).
Looping through open R-scripts and pasting specific code templates; doing
checks similar, but somewhat different to what 'R CMD check' does ... There
are dozens of others possibilities, most of them more complex. AppleScript
isn't that bad, and BBEdit has extensive AS support. AppleScript stands for
application automation *and integration*, and that's the most interesting
part for me. Another Mac user pointed me to sending selected code blocks
from BBEdit to R.app via AppleScript, and let the latter execute that code.
That's great, and somewhat simplifies the cycle of edit-source-edit (e.g.,
no navigation in R.app's command history needed, selectively executing code
snippets, shorter execution times).
You could argue that some of this is a weird way to work (sometimes that's
what *I* think LOL) -- for me it makes sense, and saves time and brain
cells. Or you could argue that there are other ways to accomplish the same.
Yes, without a doubt, but I like it this way. But I'm open to any
improvement, I fear I'm an ecclectic... ;)


>> -- a working clipping system (which could be better ;)
> 
> I'm losing you here - clipping?

Instant text, snippets. "Glossary" in the old version, "Clippings" in the
new. Common German term is "Textbausteine".


>> -- direct access to UNIX scripts and "filters", which I make heavy
>> use of to
>>    "reengineer" or "refactor" code, or for the simple reoccurring
>> things
>>    that can make life easy.
> 
> Some thing like "run this file/select through that perl script"?
> Again, easily implemented and it sounds useful.

It is, absolutely. And BBEdit has a palette for this kind of stuff, too.
Configurable in extenso, script files to feed it are stored in "Application
Support", it can have nested subsections, it's Alias-aware, you can assign
keyboard shortcuts to single scripts, etc.
Sorry that I said that "palette"-word again -- I know, not everyone is a fan
of palettes. For me, often used actions are just a click away, and that's
why I like them in BBEdit.
BTW, what about a configurable palette for R-scripts in R-app? Logic: Set up
your palette (project-wise changing, or for the rest of your days), and
execute your R-scripts with a click. A palette for the command history would
be VERY useful, too. (You see, the horror starts as soon as you ask people
to be creative ;-) 


>> -- syntax folding, which is said to be a nice feature, but I don't
>> have that
>>    new version, and so I don't have an own opinion.
>> 
>> That's rather specialized, isn't it?
> 
> Not really. Sure everyone has his own coding style, so why not
> provide the versatility.

Pleased to hear, though I fear it's a LOT of work.


>> ... while BBEdit on the other hand doesn't have code completion, of
>> course (one of the most criticized aspects). But, you know, I don't
>> profit that much from code completion at the moment. As a relative
>> beginner, I prefer to have the help pages open in R.app and look up
>> what I need. Gives me a better illusion of control ;-) Hopefully
>> that will change, and then in turn may (or may not) change my
>> working style.
>> 
> 
> Admittedly I couldn't live especially without argument hints as I got
> so used to it. Still, it's interesting, because I would classify many
> of the features you list as "power-features", definitely not for a
> beginner ;).

A question of feeling, or self-assessment?
No, seriously, I'm just beginning to learn R and figure out how things work
-- that's the beginner's part. But I know (more or less) what I want to
achieve, I have some experience with Perl and AppleScript, and SQL, a bit
XML/XSLT, and of course an elaborated personal style of working. Take it
with a grain of salt -- my skills are only half-cooked, I'm not a trained
programmer. 
But I made an interesting experience, repeatedly during the years: I try to
use what a program offers. If it has power features, they are there for a
reason, and I try to find out, in which respect this or that could be useful
for my own work, and adopt what I need. Step by step. Power features can
make beginners become power users, if they are available. Makes sense?


>> A bit philosophy comes in, too. Why should I expect any developer to
>> reinvent certain specialized functionalities, when other tools
>> already offer
>> them, and at the same time integrate seamlessly with R.app? Isn't
>> that just
>> what we want?
> 
> Depends. If you found your perfect editor and it integrates
> seamlessly, sure there' is no point in using the integrated one.
> However, that doesn't mean that we should keep it as plain and basic
> as possible. Especially with features that leverage R itself it can
> be more useful if it has additional features - and this is harder for
> other editors to do, so we should take advantage of it. We have
> started in that direction with JGR and it turned out to be a really
> good idea, especially for students and beginners. But then, why
> shouldn't power-users benefit, too?

That's a great attitude, Simon, respect.
The point is, I'm simply looking for the tools to get my work done. If I
find that BBEdit-or-whichever-app falls short, I stop to use it and switch
to the better fitting alternative.

Okay, enough for now. I'm sure that many people here are glad to have R and
R.app for OS X, and will certainly advocate and advertise both whenever they
can. We're here because we *need* this software, and we appreciate your
efforts. 

Sorry for the horrible English. I tend to call it "experimental", from time
to time ;) 

Cheers, 
Jörg


> Cheers,
> Simon
> 
>



More information about the R-SIG-Mac mailing list