(archive 'newLISPer)

July 22, 2006

Dear editor

Filed under: newLISP — newlisper @ 23:35
Tags:

>

There’s no such thing as the perfect newLISP text editor for MacOS X, and I doubt whether there ever will be, since we all have different views of what makes good things good. Most of the text editors currently available lack either features or finesse, and sometimes both. The ones that stand out as the best of the bunch are, in no particular order:

  • BBEdit, and the free version, TextWrangler
  • TextMate, a reasonably-priced editor that “brings coding into the 21st century”
  • emacs, which is already installed
  • JEdit, a flexible and free Java-based editor

I want to find out more about TextMate, since it promises much, although I’m hoping that someone else has already mastered the wizardry required to make it newLISP-friendly – it looks pretty hair-raising stuff at first glance. There appear to be no newLISP users of TextMate at the moment, according to this page (where are you, m i c h a e l? :-)), but I’m sure things will change as more and more people discover newLISP, perhaps even after reading this blog. (Yeah, right!)

I might be unusual in that I like Lisp but I don’t use emacs. I have used emacs before, and have even written some simple emacs-lisp macros in my time, although not recently. But – to be honest – I find it a hostile and ugly place, and I don’t enjoy working there, despite having all that power and flexibility. In the meantime, I continue to use BBEdit and TextWrangler for newLISPing.

BBEdit (and the free version, TextWrangler, which doesn’t understand HTML and CSS as well as BBEdit) is a very powerful and flexible editor. An old-fashioned Mac-ness pervades the interface, making it look perhaps a little too ‘old-school’ for the new wave of Unix geeks who have recently adopted the platform, but this traditional flavour makes it seem (to me at least) a solid and dependable Mac product, oozing with good old-fashioned UI quality. BBEdit is the product of decades of work, and has always been a good Mac citizen, supporting most of the technologies provided by the OS soon after their appearance. It’s also managed to harness the Unix engine to great effect. Scriptability is excellent, which means I can, with a single click, convert this text I’m writing, first to HTML (using Markdown and then post it straight to Blogger (using some newLISP, of course). There’s a newLISP language module available on the newLISP site, which gives you colour-coding in your source documents.

Crucially, BBEdit has parenthesis-balancing, so you can press Command-B to locate and select the list containing the cursor; press it again to select the containing list, and so on. And when you type a closing parenthesis, BBEdit highlights the matching one, briefly. Basic but essential.

One obvious – even surprising – omission, though, is the lack of passive parenthesis balancing. By this I mean that when I move the cursor over a parenthesis, or select one, I’d like to see the matching one flash or be highlighted in some way. It’s surprising, perhaps, because BBEdit already knows the structure of the code, so it shouldn’t be that hard to do. But you always have to delete a parenthesis and retype it to see the matching one, or select and deselect using Command-B, and this can confuse as much as enlighten. To be honest, I haven’t seen another half-decent code editor that can’t do this passive balancing, so it’s a surprising omission. Also, presumably it isn’t just a problem that affects just a small minority of Lisp coders. (What’s the collective noun for newLISP users? A brace, perhaps – or is that for partridges?)

Another problem appeared recently when I was working on a longer newLISP file. There’s no overview or outline facility in BBEdit, and no ‘code-folding’ either, so the only way to navigate around is to scroll the text up and down inside the window. Of course, if I was working in C or one of the more mainstream languages, I would be able to use the Function List Pop-up menu, which automatically scans a document for patterns that match BBEdit’s idea of a function or procedure, and then lists them for you.

There appears to be no way for me to tell BBEdit that I’d like to see my newLISP functions appear in the Function menu.

I have found a way of providing a list of functions used in a document, though. The BBEdit manual gave me the idea while I was trying to work out why the function popup didn’t work for me:

If you are programming, you may be tempted to use markers to mark functions in your source code. However, if BBEdit supports the language you are using, this is usually unnecessary; your functions will automatically appear in the Function pop-up menu in the document window.

So, using markers might work, and indeed it does. You can quickly mark all newLISP functions by choosing the Find and Mark All menu from the Markers menu. Then type in a search expression similar to the following (depending on how you format your code):

(\(define(?s).*?\))

and replace it with:

\1

BBEdit will find all matches and display them in the Markers menu. You can then quickly jump to the right location in your source file.

Advertisements

7 Comments »

  1. >Hi, Cormullion.Seems like you’ve found a text editor you like. BB Edit is the standard for Mac’s, I understand. It’s got a strong reputation. I browsed the feature list for Textwrangler when I read about it on Webmonkey. It looked powerful. So anyway, nice choices!That passive paren-balancing is an interesting feature. I’ll look for that in Vi, my little evil favorite.-Noah

    Comment by Noah — July 23, 2006 @ 06:45 | Reply

  2. >Oops!I should have just written, Hi newLISPer. I don’t know who I’m writing to, do I?:-(-Noah

    Comment by Anonymous — July 23, 2006 @ 22:55 | Reply

  3. >well you could have been writing to m i c h a e l …

    Comment by newlisper — July 23, 2006 @ 22:57 | Reply

  4. >I sign my posts with the dark red m i c h a e l in order to help distinguish them from cormullion’s (who leaves them unsigned). I don’t mind being called a cormullion, but I’m not sure how cormullion feels about being called a michael :-)cormullion: Thank you for pointing me to the TextMate programming languages page. This one completely escaped my attention. The oversight has been corrected and newLISP proudly joins the back of the queue (last shall be first) :-)m i c h a e l

    Comment by m i c h a e l — July 24, 2006 @ 06:55 | Reply

  5. >You really should give TextMate a go. With a bit of work, I’m sure you could get lisp functions in the function list, if they aren’t there already. Folding works pretty well, and there have been some creative little commands for dealing with moving parens around. Parens are automatically balanced when typed, and you get the flashing you’re looking for when you move past a closing paren.When it comes to scriptability, TM can’t be beat. You can get relatively accurate syntax highlighting for your markdown text, and you can use the new blogging bundle to post to this blog.Most importantly, while BBEdit gains new features a few times a decade, TextMate has hundreds of users adding things to the bundles every day, and the developer is moving the rest of the application along extremely quickly.Download the TM trial, and give it a couple of weeks. You’ll be hooked, I’m sure.

    Comment by Anonymous — July 26, 2006 @ 13:58 | Reply

  6. >Thanks Anon – I’m trying it out as we speak. Looks fun so far!

    Comment by newlisper — July 26, 2006 @ 14:40 | Reply

  7. >At least BBEdit has code folding now, as of 8.5. :)

    Comment by Anonymous — September 19, 2006 @ 19:36 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: