Archive for the ‘EMACS’ Category

Random Notes on Intermediate Perl/Emacs Stuff

August 5, 2008

The learning curve is steep. It’s hard to know what to prioritize. Perl makes life easier, though, in that the bottom 30% of the language is so all around useful, you can get all kinds of things done even though you “speak Perl like a three year old.” For the rest of it, I just stop every few weeks and take an hour to focus on the two or three things that bug me the most. My theory has been, that as long as the combination of Unix-like shell, Emacs editor, and Perl scripting is applied to my daily work, there’ll always be enough payoff that it’s worth my while to learn the things I’ve been putting off– so that in 6 to 8 months I’ll actually start to gain some genuine skill.

Here’s a few things like that that I finally took the time to address:

(global-font-lock-mode 1)

Put this in your .emacs file to enjoy the wonders of syntax highlighting. Yea. (I wondered why the Windows version was in color where the Cygwin version wasn’t….)

There’s also two Perl modes, for some reason. I actually kind of liked the default one better than the M-x cperl-mode that you’re supposed to use instead. In color, your hashes look atrocious… and your useless spaces show of as abrasive underscore lines…. I use those lines to mark my place in my project– to sort of delineate where I’m working. Cperl-mode seems a little more sluggish to me when it has to place your braces where they belong, but I like the way it spaces things better. (And people talk about how hard it is to parse Perl… it wasn’t long before I broke the syntax highlighting with a line that had a mess of single and double quotes on it. Maybe switching color mode on was not a good idea.)

Perl has anonymous functions and also functions that operate in list context. As much as Larry hates parentheses, it’s clear that he doesn’t hate Lisp concepts….

If you’ve got an array of strings, you can grep them with an anonymous function. Map can be used in a similar way:

my @array = qw/ apple bus cat dog elephant/;
my @things = grep {length($_) > 3} @array;
print "*$_*\n" for @things;
my @stuff = map {"--$_--"} @things;
print "test: $_\n" for @stuff;

# Altogether now:
print map {"!!!$_!!!\n"} grep {length($_) == 3} @array;

Now here’s the cool thing. I’m thinking to myself… wouldn’t it be great if you could refer to files streams in list context? And sure enough…

print map {“!!!$_!!!\n”} grep {length($_) == 3} <>;

This works! All of that accidental complexity in my Perl scripts due to excessive looping and if-then-else blocks… this one idea puts a huge dent in it.

I have to admit, this gave me flashbacks to my college Calculus class. We’d been working through a huge number of problem sets for a few weeks… and the professor comes in and teaches us a trick that showed us we were really doing things the hard way. The “regular” kids were disgusted. Why did he waste all our time? My theory was, that for most of us, we would not have appreciated the trick (and maybe not even understood it) if we hadn’t done the work first. Back at the code bench, this translates to… write bad Perl scripts to do practical things at work. Then clean them up with map and grep. Now you *really* know what they were trying to tell you back in chapter 3 of SICP! You know it down in your fingernails….

Okay, one last note. A few weeks ago, we saw that to really get functions to work with accepting arrays as arguments and returning groups of them for their return values, you had make the mental and semantic leap to begin thinking in terms of references. This seems to be a little tricky, because it doesn’t appear to be a “reference” like what I’ve seen in other languages– maybe it is, but if I “my” the sucker in a subroutine, it looks like that’s copying it, at the very least. Anyways, I’ll gradually assimilate that in time. We don’t really care what a reference really is yet– we just want stuff to work! Especially with hashes!!

my ($foo, $bar) = test2();
my $value = ${$bar}{2};
print "The value of foo is $foo and the value is $value\n";
print "We could have just said, '${$bar}{2}', too.\n";

sub test2 {
  my $foo = "hello";
  my %bar;
  $bar{2} = "world!";
  return ($foo, \%bar);

So, to cast the reference (stored in a scalar) into a hash so that we can ‘talk’ to it, we have to ‘fancy’ it in two places. I was thinking that the curly braces around the key would tip Perl off as to what we were trying to do…. And when that didn’t work, I was thinking that some sort of casting with a % sign somewhere would be the ticket. Thanks to Intermediate Perl, though, we know what we need to keep rolling….

Configuring an IBM i for Emacs and Perl hacking

July 31, 2008

An “IBM i” is a descendant of the old AS/400 machines and has undergone numerous name changes over the years. Most code on it is written in a language called RPG, but which unfortunately lacks polyhedral dice altogether. When IBM decided to promote Java for the platform, they had to have a Unix like tool to manage everything, so they built one from scratch with local tools and languages. At the same time, IBM realized they could run the machine with more or less the exact same hardware as their AIX boxes, so a second stream of “Unix-ness” was introduced into the platform.

First you need to install Option 30 (QSHELL) and Option 33 (PASE) on your operating system. PASE is a bonafide AIX type Unix environment. QHSELL is a Unix-like environment that is implemented in native code/objects. You’ll use PASE to run ‘real’ Unix programs and you’ll use QSHELL when you need a tool that groks the differences between Unix and the local environment.

Next you want to go install The iSeries Tools for Developers (product 5799-PTL). This will give you version v5.8.7 of Perl and version 20.7.2 of Emacs relatively painlessly. You’ll want to set up symbolic links for at least these programs:

ln -s /QIBM/ProdData/DeveloperTools/pase/bin/perl /usr/bin/perl 
ln -s /QOpenSys/QIBM/ProdData/DeveloperTools/perl587/bin/perldoc /usr/bin/perldoc 
ln -s /QOpenSys/QIBM/ProdData/DeveloperTools/emacs/bin/emacs /usr/bin/emacs

Now you can call Perl and Emacs from the command line… except you can’t run Emacs, yet.

You’ll need cygwin installed on your Windows box. Pull down the xwindows libraries when you configure your setup. You’re good to go when you can type “startx” from a cywgin command line.

Go to C:\cygwin\usr\X11R6\bin and make a shortcut to startxwin.bat onto your desktop. Run this to go directly to x without having to start cygwin first. Once you’re at the x command line, type “xhost YOURSERVERNAME”.

Now start your 5250 emulator. At the command line, type STRQSH to go into QSHELL. Once there, enter the following commands:

system "strptl CLIENT('')" 
export DISPLAY="" 

If you don’t know what your ip address is to set up your DISPLAY environment variable there, you can just peek in the startxwin.bat to get it. You can also put the above commands into your .profile file so that they run every time you start QSHELL. Both your .emacs and .profile files go in the “home folder” that you start off in when you open QSHELL.


How NOT to fix your Delete key in EMACS

July 15, 2008

I’ve been runing emacs off of a weird server. I was running x on cygwin and had used “xhost MYSERVER” to pick up the emacs session. Cool. The version of Emacs 20.7.2, though. Anyways… I get there and backspace and the delete key both work by backing over the previous character. I wanted to make the delete key “eat” the next character. This should be easy to fix, right? Doh! It took me more than an hour. Below is my lame trial and error process of finding a lame solution. I haven’t had this much fun since I had to figure out how to enter a carriage return!

C-h b — list key bindings
C-s del — search for del… C-s to go forward, C-r to go backward

C-d runs the command delete-char
which is an interactive built-in function
DEL runs the command delete-backward-char
which is an interactive built-in function

C-x C-e the elisp code lines to execute them.

[Waste time trying many wrong ways to global-set-key the delete key, until….]

runs but doesn’t change behavior:

(global-set-key [del] 'delete-char)

look– hitting del does not make the “hello” text

(global-set-key [del] "hello")

this works! but… now backspace works like delete! Argh!

(global-set-key "\d" 'delete-char)

fix it back:

(global-set-key "\d" 'delete-backward-char)

Uh… both of them are bound to DEL.

Problem must not be in EMACS. But wait… the weirdo shell that lanched EMACS knows the difference!

Can EMACS tell the difference between DEL and BACKSPACE?

press backspace , press delete
then hit C-h l to view the lossage buffer.
If you see something like
backspace deletechar

It can!!! Execute this:

(global-set-key [backspace]  'delete-backward-char) 
(global-set-key [deletechar] 'delete-char)

Still doesn’t work right….

(define-key function-key-map [delete] nil) 
(global-set-key [delete] 'delete-char)

Now delete is dead! (Backspace still works.)

Can’t get it back with this:

(define-key function-key-map [delete] [delete])

Hmm…. Maybe…. Aha! A lame hack:

(define-key function-key-map [delete] [F20]) 
(global-set-key [F20] 'delete-char)

This works! I did it! It only took an hour and a half! Argh!

Lisp at Work: a macro for managing replace-regexp routines

November 5, 2007

The following commands have all become essential in my day to day Emacs usage:

C-M-% (query-replace-regexp)
C-x ESC ESC (repeat-complex-command)
M-x re-builder
C-x C-e (eval-last-sexp)

I use them to define regular expressions for use in editing text documents. Over time, I begin to collect quite a few of these, so it makes sense to think more carefully about my key bindings: normally I just use a Function key, but there’s other stuff I want to hot key from there now…. The Emacs manual says that the combination of C-c followed by a plain letter is reserved for the user, so I can put my custom routines there with a single letter mnemonic to help me remember what’s what.

Here’s a macro (with an example of its use) for setting up these sorts of text processing routines:

(defmacro defreplacer (name description search-for replace-with chord) 
     (defun ,name (n) 
       (interactive "p") 
       (query-replace-regexp ,search-for 
                             (if (and transient-mark-mode mark-active) 
                             (if (and transient-mark-mode mark-active) 
     (global-set-key (kbd ,chord) ',name)))   

(defreplacer pull-text-from-semi-colons 
  "Remove text from between two semi-colon signs."
  "[ ]*;\\([a-z]*\\);[ ]*" ; use double back slash to 'escape' in quotes 
  "C-c ;")

In the example above, we’re replacing lower case text inside a pair of semi-colons (and surrounded with any number of spaces on each side) with just the lower case text. The command chord to trigger that replace routine is “C-c ;”. This is a pointlessly simple example, but it should give you the basic idea of how to use the macro.

Does the “defmacro” really do much more for us than “defun” would otherwise do? The main savings you get with the macro is that it defines the key binding at the same time that the replacement function is defined– having a naming type there caused me a minor headache when I was wondering why my hot-keys weren’t working once. With “defmacro” you eliminate the chance of this kind of confusion occurring. On the other hand, if you change the definition of the macro after a file has been loaded, you will not change the operation of the existing functions– the macro only affects the environment at compile time. So there are trade offs either way. In this case I went with a macro because once I get my regular expression from re-builder, I wanted to be able to write the code for everything as quickly as possible. With “defreplacer”, all I needed was four arguments and I was good to go.

Echo Chamber: Backstabbing Lisp Hackers and the War to End All Language Wars

October 15, 2007

Interesting stuff from an article I found on raganwald’s feed:

You might know that James Gosling (one of the creators of Java) once wrote a version of Emacs. But did you know that his version did not have a real Lisp implementation running under the hood?

You might know that MIT had a really cool AI lab that Richard Stallman worked in. But did you know that the fallout between two competing Lisp machine companies put an end to the the primordial hacker culture that once thrived there? And did you know that Stallman spent two years implementing a free version of every single feature that Symbolics came out with for their Lisp machine in order to punish them for stabbing his fellow hackers (at Lisp Machines Incorporated) in the back?

You might know that TCL is a language used to write GUI code. But did you know that Sun once tried to make it the “de-facto standard extension language” of the world?

You might know that Guile is the GNU implementation of Scheme. But did you know that Stallman intended Guile to become the standard extensibility package for all GNU programs?

You might know that Lisp dialects can be used to write embedded languages. But did you know that such a capability could be marshalled to end the language war in many applications? Stallman: “But when you have a powerful language that can implement others by translating into it, then you give the user a choice of language and we don’t have to have a language war anymore. That’s what we’re hoping ‘Guile’, our scheme interpreter, will do.”

My First Emacs Hack: A Jumpstart Guide

October 11, 2007

While it’s nice to have a function key to bring up an IDE so that we can automate our applications, we see that Emacs goes even further by allowing code to be edited and run from any window. There is no special, separate application that is used for extending or modifying the program. This is strange and unusual– and very fun. This short tutorial will show how to use one of Emacs’ most versatile commands, how to retrieve the code for executing complex commands, how to put them into function definitions, and how to attach them to hot-keys. (This more comprehensive introduction is very good if you need extra information.)

A basic out-of-the-box feature of Emacs is the C-M-% query-replace-regexp command. You can use this to search and replace patterns of text. I try to explain this to people and it doesn’t quite register: they think, “oh yeah, I’ve got find/replace built into my IDE, what are you talking about?!” (Evidently, you can get a Master’s degree in Computer Science and not know what a regular expression is….) I’m not talking about searching and replacing not just specific strings, but patterns as well.

Suppose you have inherited a project that has lots of data hard coded into visual basic files. You might have something that looks like this:

strOptions = “OptionOne, OptionTwo, OptionThree,”
strOptions = strOptions & “OptionFour,” ‘ Don’t forget this one!
strOptions = strOptions & “OptionFive, OptionSix”

How can we get rid of all the code and get ourselves a nice simple list of options?

What we first want to do is search for lines that have a series of upper and lowercase letters, equal signs, and/or ampersands… followed by upper and lower case letters and commas inside a pair of double quotes… followed, perhaps, by a code comment. We could search for that specific pattern of text and then replace it with just the stuff that’s inside the double quotes.

To do that, just use C-M-% to search for this:

[A-Za-z=& ]*”/([A-Za-z ,]*/)”[‘ A-Za-z!.,()@#$%^&*]*

And replace it with this:


The [A-Za-z=& ]* part represents the first part of the pattern. The double quotes represent (surprise!) double quotes. The [A-Za-z ,]* represents the stuff inside the double quotes. The /( and /) markers are used to tag regions of text so that we can refer to them later. The [‘ A-Za-z!.,()@#$%^&*]* represents the comment. The /1 is a reference back to the text that was between the double quotes.

After we apply query-replace-regexp with these two arguments, we should end up with this:

OptionOne, OptionTwo, OptionThree,
OptionFive, OptionSix

(Note that to apply the replace to a section of highlighted text, press the space bar. To apply it to every line after the cursor, press the “!” key. Note that the search begins at the place that the cursor is….)

To get rid of the commas and get a nice simple list of options, we’ll need to know a little Emacs trick. To enter a carriage return as part of an argument to a command like query-replace-regexp, you need to hit C-q C-j. (I’ll use a ~ character to denote that key chord.) So to remove the commas and line up our options we, search for:

,[ ~]*

And replace it with “nothing.” (Just hit enter when prompted for what to replace it with.) Running the command should produce the following:


Now… you may want to reuse these sorts of commands that have complex arguments… or you may want to be able to save and modify them some more when you find out they don’t work quite like you want them to. To see these commands as Emacs sees them, hit C-x esc esc. This will display in the mini-buffer the last complex command you’ve entered. You can then hit enter to rerun it or cut and paste it to somewhere else.

The skeleton below shows a basic outline for an elisp function. You can paste complex command “stolen” with C-x esc esc into the place marked <<<PUT YOUR CODE HERE>>>:

(defun your-function (n)
“Put your function’s documentation here”
(interactive “p”) ; n = value passed by the C-u “universal argument”

The “interactive p” part means that the command can be run with from the mini-buffer by typing M-x, entering the name of the function, and then hitting “enter”. For that to work, though, you must first get the function into the environment. You can do this by moving the cursor just to the right of the very last parenthesis in your function definition. From there hit C-x C-e. The name of your function should appear in the mini-buffer when you do this. In fact, you can evaluate any lisp expression that way. Type “(+ 30 12)” and hit C-x C-e after the final parentheses and you should see “42” appear in the mini-buffer!

To wire in a hot-key, evaluate a function like this:

(global-set-key [f8 ‘your-function)

You can collect your code into a text file marked “.el”. Files with that extender will be highlighted properly when you load them into the editor. To execute all of the code in a file, type M-x load-file and then enter the path and/or filename of the code you want running in your environment. Here’s an example file with the code from our tutorial set to run with the function keys f3 and f4.

With regular expressions and the above commands, you can automate just about any complicated text manipulation. In some cases, it can take a while to figure out a good regex to solve a problem, but that’s generally more fun than editing loads of text files by hand.


Kicking the ctrl-x/ctrl-c/ctrl-v habit with Emacs

October 11, 2007

There’s plenty you can do with Emacs… and lots of documentation floating around on the web. This is just a quick tutorial on some basic Emacs techniques that demonstrate how it can be a pleasure to use. I’m mainly writing this for myself, but maybe someone getting started will find this helpful if they’re just getting past the initial learning curve and are daunted by the prospect of having to “research” things that were trivial with their previous text editors.

Two of my favorite features in Emacs are find-file (C-x C-f) and iswitchb-buffer (C-x b). Emacs doesn’t bother me with a file dialog box that takes forever to appear. How many times in a Windows program have I accidentally hit “Open” or “F1” by accident and then have to wait while my computer stalls? The Emacs autocompleting feature makes it much faster to home in on a file I’m looking for and I never have to take my hands off the keyboard. And as far as buffer switching goes, Windows can be annoying no matter how it is set up. If you’ve got tabs on the screen, then you’re wasting on-screen “real estate.” If you are switching buffers using “control – F6” then you’re stuck cycling through the windows in a certain order. Emacs understands that I might want to work with a slew of buffers at once– but also that I tend to switch back and forth between a pair of buffers quite a bit. Accordingly, the buffer switcher lists the names of my open files and autocompletes the file name if I start typing. And the buffers are all listed in order of how recently I’ve touched them, so the default buffer is usually the one I need. Anyways, the point is that you can generally trust the designers of Emacs to do things in a really slick way. A lot of things will seem unnatural at first, but the more you use it, the more you appreciate it.

So fire up Emacs and type “one”, hit return, type “two”, hit return, type “three”, and so on until you’ve typed the words for the numbers one to ten each on their own line. Move the cursor so that it rests on the “o” in the word “one”. You can do this by hitting C-p ten time to move line by line. Or you can type C-u 10 C-p if you want to be fancy. You could even try M-{ C-n. (In Emacs, you should avoid using arrow keys and page up/down.)

Once you get to the “o” in “one” type C-space to set the mark. Type C-n to move down a line and then hit C-w to kill the text. Then alternate between the commands C-n and C-w until you’ve killed all ten of your lines. Hitting C-y will “yank” the most recent bit of text from the kill-ring.

If you type C-y a few times, you should get several lines of text that say “ten”. Try M-y and the last “ten” that you yanked will become a “nine”. Hit M-y a few more times and you’ll keep moving back through the kill-ring. Generally, your position in the kill ring just moves backwards as you keep hitting M-y. To jump several kills back hit C-u and then a number. Enter zero you move one notch forward in the kill ring… and enter a negative number to move several notches forward.

Type C-y to “yank” some text again… and then hit M-y to cycle back until your yanked text becomes a “one”. Type C-y to paste several lines that say “one”. Then type C-u 0 C-y. (That middle key there is a zero.)  This should make a new line that says “two”. Type C-u -2 M-y to change the “two” to a “four”. (The -2 there is negative two.) If you ever jump forward too far, just hit M-y to cycle back through the kill ring until you get where you want.

So you can move around fairly easily using next-line and previous-line commands. (Plus, knowing about using C-u to supply arguments to commands will help you with other tasks.) The curly braces commands to do next-paragraph and previous-paragraph are pretty useful, too. Use them to get into position and C-space to set your mark. Use the movement keys to go to the other end-point of your text section and type C-w to “cut” what you need. (You can use M-w to copy text without “cutting” it.)  Finally, you can use C-y to “paste”, and then M-y (in conjunction with C-u) to navigate a list of things you’ve previously “cut.”

Now that you’ve mastered the basic use of the kill-ring, you’ll be able to shift your text around however you need. Combine these techniques with the the already good file selector and buffer switcher and you have a really powerful tool for navigating and manipulating text files. It takes practice, but if you keep at it the mouse will start looking more like an impediment than a shortcut.

Stallman: Screw Child Rearing; Contribute to Emacs!

August 13, 2007

That’s one thing about the Open Source movement that’s always troubled me. It’s not just a movement that deals with software and computers, but somehow its followers seem to have been drawn into it for other political, religious, and social reasons. I could never put my finger on what it was that was going on exactly, but I always got the impression that these people “weren’t like me.”

A recent spate of rants sheds some light on to the issues that play into this dynamic. Richard Stallman essentially slams a coworker because his family commitments were going to interfere with the development of Emacs. Now a geek being rude is not a new thing… but the reasoning of geeks coming to the defense of another rude geek can get pretty frightening. Easily the most insightful comment came from Paul Prescod: “If there exists any universal value system that would justify any of the screaming one way or the other in this thread, it surely includes the component that a father has a responsibility to his wife and daughter that takes precedence over his volunteer activities.”

So who is this guy that combines empathy with strong reasoning skills? And more importantly… what language does he program in?? A quick google and I see that Paul Prescod is author of a book on XML and codes in Python. I like his quip that he refuses to become proficient in “indecent” languages. And in spite of his professional accomplishments, he has never forgotten what it was like to be a kid with an 8-bit computer and nothing but a basic manual to go on. He states his dream for the future of programming and computing thusly:

“My dream is a world wherein all but the very lowest levels and tightest loops of programs are written in a language that is so simple that it can be taught in primary school as a first language; where every word-processor user who can write a macro can at least try to dive into their word processor’s source code to fix a bug, because the macro language is also the implementation language.”

But this of course sounds a lot like Small talk. As Mark Miller has noted, “what Smalltalk, and especially Squeak, has achieved that no other system has achieved to date, with the exception of the Lisp machines of old, is a symbolic virtual machine environment that is more relevant to its own use than any other run-time environment out there.”

And of course, this brings us back to Lisp. Pretty much all the arguments against Lisp I can set aside, but I still have one of the “if Lisp is so great” type of worries hanging on. If Lisp is so great… then why don’t we have an operating system written in the language?

My guess as to the answer to that is that its Richard Stallman’s fault. Yeah, C and Unix are the ultimate viruses that propagate against all of our better judgements, but Emacs is just good enough that its not worth the effort. As Dave Roberts says, “having everything integrated, editor, Lisp system, and application, is powerful. While it can’t quite match up to the power of a full Lisp machine, you can begin to realize some of the potential.” Too bad the platform is run by a guy that has little sympathy for average developers that go home at 5PM to assist in child-rearing activities….

Close, but no Cigar: Jasspa MicroEmacs with “It’s All Text!” on Firefox [on Windows]

August 8, 2007

I took half an hour to fiddle with this one.  It sounded promising: use the text editor of your choice to compose text for any type-in box you might find on the web.  (I can’t learn Emacs easily if I keep having to switch back and forth between different text editors all the time.)

The “It’s All Text” plug-in for for Firefox provides a way of eliminating at least a portion of this hassle.  There’s just a couple of problems, though.  Firefox looks crappy on Windows XP compared to the very crisp look I’d just gotten with it on PCLinixOS 2007.  (I’m not sure if I can give up Opera on my Windows boxes yet….)  Jasspa MicroEmacs looks really ugly, by the way, but that’s no big deal; I can just use Emacs 21 or something if I want.  But what really gets me is that the little edit button doesn’t work in the main place that I want it to: the text editing box right here on WordPress for when you’re posting a new entry!  Argh!

Thanks to the anonymous coward that recently posted here (and also to minor Emacs wizardry) for spreading the good news.

(Mozilla’s Outlook-style spell checking feature rocks, though.  The one here on WordPress is an abomination!)

Setting Up PCLinuxOS 2007 for Lisp Hacking

August 6, 2007

So I picked up a copy of PCLinuxOS 2007. Pop it in the drive, answer a few dialogs, and voila… we have a shiny new desktop. Time for some Emacs action!

I open up a Konsole and type in ’emacs’ and… I hear the whirring/clunking sound of a Millenium Falcon failing to make the jump to light speed. Hmm…. I guess we know what side of the holy wars these PCLinusOS guys are on!

So I go into the Package Manager. It looks a lot like the Cygwin version, except its very easy to search it and get around in it. I mark the emacs package for installation and “Apply” the changes. Things seem to go smoothly enough and I switch back to the console. I type in ’emacs’ again and… there’s that clunking sound.

So I cruise over to the “Start Menu” thing and go to “More Applications” and “Editors” and there’s nothing over there about Emacs. This is weird… I figured the system would just know we had Emacs now…. I log out and log back in hoping that things would magically appear and it still doesn’t work. I start muttering under my breath and try everything I can think of to make it work. But I just can’t do it.

A Linux machine that can’t run Emacs. Pathetic! In exasperation I go to the PCLinuxOS site and register a sign-on name for their forums. I’m thinking, man… these dudes are going to “RTFM” me so bad…. It turns out that I have to wait for an administrator to activate me so I go back to trying to make it work on my own. (That red spot on the side of my cube? Oh, its nothing….)

I decide to go back and read the fine print on the packages… and obviously… I find out that I need more than the emacs library to run emacs. I need emacs-x11, too. So I install that puppy and… hey, we have emacs! Woo-hoo! (And it magically appears in the “Start Menu”, too, just like I expected….)

Now I need to get some CLisp cracking away in there. I use the Package Manager to get CLisp… pull up a Konsole and type Clisp to make sure its there. Sure enough, it’s hanukka again. There’s no Slime package, unfortunately. So I switch back to Firefox. (Did I mention that I had internet access completely painlessly? I hardly paid attention to the configuration questions on that when I was first booting up, but it just worked anyway. Nice.)

I google slime, download slime-2.0.tgz to the desktop, drag it over to the /home/guest folder, and then right-click “Extract Here” to unpack it. This works fine. Now I just need the file path to Clisp. Piece of cake, right?

Argh! Now I end up bloodying up the other side of my cubical…. I try a couple of grep’s from the Konsole… I do a half dozen searches from “Start | Find Files…” and nothing works. Why is looking up a file so difficult?!

I fire up Google for this one and come back with a “find -name clisp” command. I type this in from a root Konsole after going to the very bottom directory with a series of “cd ..” commands. Aha! There it is! Now I make new file with Emacs and cut and paste the following commands into it from the Slime readme file….

(add-to-list ‘load-path “/home/guest/slime-2.0/”) ; your SLIME directory
(setq inferior-lisp-program “/union/usr/bin/clisp”) ; your Lisp system
(require ‘slime)

I saved the text file as “setup.el” and loaded it with M-x load-file. After that I tried M-x slime… and we were ready to rock. Not quite ready for Lemonodor fame, but I’m glad to be here anyway.

And PCLinux 2007 does look pretty sharp, if I do say so myself. The GUI is very crisp, you (obviously) get native access to all the classic Unix commands, and you can switch between up to four different “desktops” at once to keep from shuffling windows so much. That last feature, combined with Firefox’s ability to keep multiple browser tabs in the same application instance, can cut back on a lot of clutter and make it very easy to get around.

(Emacs 22 appears to try to do a lame imitation of Notepad’s word wrapping by default! Don’t be fooled! I thought at first that the carriage returns would go away when I cut and pasted to other applications. Then I noticed that cutting and pasting between Emacs and other windows appeared to be altogether disabled! I could paste stuff to Emacs… but couldn’t get stuff out of it!? This just wasn’t a problem on Windows, strangely enough. I reluctantly switched to KWrite and used ctrl-J to clean up the carriage returns one paragraph at a time. This was way too big of a pain; there’s got to be an easier way to do this…. On the bright side, it appears that Firefox has a spell checker that automatically kicks in no matter where you’re typing stuff in. Nice!)