September 23, 2008
Some people (such as me) have always been annoyed by how you need to use the mouse a lot to make use of your X11 desktop environment. Wouldn’t it be great if you could just control everything using your keyboard? Well, that is what ratpoison allows you to do.
Ratpoison is a minimalist window manager which is similar to GNU screen. It’s called ratpoison because you don’t need to use a “rat” (mouse). It is written in C.
But eventually, the authors got tired of writing in C, as they were implementing many features that resembled Emacs or that were in a Lisp style. As said by the authors:
“StumpWM grew out of the authors’ frustration with writing ratpoison in C. Very quickly we realized we were building into ratpoison lispy-emacs style paradigms. We had a REPL hanging off ‘C-t :’, hooks, and a growing subset of Common Lisp in the implementation … It was clear what we really wanted was a window manager written in Lisp from the ground up with lots of room for customizing and real-time hacking.”
So, being a Lisp fanboy and an Emacs zealot, I decided to give it a try. I wrote down most of the key combos on a sheet of paper which I put on my wall, and I set up StumpWM. I got used to it in about 15 minutes, and after an hour or two I was completely addicted to it. Emacs-like frames, window groups, its being written in Common Lisp (and hence hackable for me), its simple key combo to run/raise Emacs, and of course its allowing me to control my desktop with the keyboard make it the best window manager I’ve ever tried.
If I gladly said “I don't need no stinkin' icons” after setting up Fluxbox, I excitedly thought “I don't need no stinkin' mouse either” after trying out StumpWM.
I really recommend that you try it out. Don’t let the key combos throw you off, you’ll get used to it (although I do recommend that you set up your CapsLock key as an additional (or the only) left Control key.
But hey, why don’t you watch this video?
How to install/start it
- Install SBCL, the portable-clx package (called cl-clx-sbcl in Debian), and cl-ppcre.
- Download StumpWM.
- In the stumpwm directory, run ./configure.
- Run make. This should create a stumpwm executable.
- In your ˜/.xinitrc file, include the path to the stumpwm executable.
- Finally, start X Windows with startx.
September 6, 2008
I run Debian GNU/Linux most of the time, so the instructions here will most likely be 100% correct if you run Debian, Ubuntu, or any other Linux distributions that use .deb package files. If you run any other distributions, you will still benefit from reading this article, but some instructions may vary.
0. Downloading what you need
The applications you need are, obviously enough, Emacs, SLIME, and the Common Lisp implementation of your choice. I will be using SBCL. You don't really need cl-asdf if you re just starting out, and it might not be in the repositories for your distribution. Please note that due to the license in one file, SLIME is in the non-free section of the Debian repositories.
1. Setting up the Common Lisp environment
When everything has been correctly installed, fire up Emacs. I don 't know whether you like the defaults or not, but I find certain things annoying (including the colors), so create a text file named .emacs in your /home/$USER directory. You will need to create one anyway, as we still need to set Emacs up so we can use SLIME and SBCL.
This is what needs to go in your .emacs file:
;; Set up the Common Lisp environment
(add-to-list 'load-path "/usr/share/common-lisp/source/slime/")
(setq inferior-lisp-program "/usr/bin/sbcl")
You may need to modify the path to SLIME and SBCL, but that should be good enough if you installed it through aptitude.
2. Adding functionality to Emacs
We 're not done yet, but here 's what you will need to add to your .emacs file if you want to use my settings. If you don 't know what something does, read the comment (anything after ;; is a comment). Feel free to include and/or modify anything you like.
;; Text and the such
;; Use colors to highlight commands, etc.
;; Disable the welcome message
(setq inhibit-startup-message t)
;; Format the title-bar to always include the buffer name
(setq frame-title-format "emacs - %b")
;; Display time
;; Make the mouse wheel scroll Emacs
;; Always end a file with a newline
(setq require-final-newline t)
;; Stop emacs from arbitrarily adding lines to the end of a file when the
;; cursor is moved past the end of it:
(setq next-line-add-newlines nil)
;; Flash instead of that annoying bell
(setq visible-bell t)
;; Remove icons toolbar
(if (> emacs-major-version 20)
;; Use y or n instead of yes or not
(fset 'yes-or-no-p 'y-or-n-p)
3. Making Emacs look prettier
These are my color settings, if you would like to include them. There are separate color settings for the X11 version of Emacs and for the console one.
(defun faces_x ()
;; these are used when in X
'(default ((t (:foreground "wheat" :background "black"))))
'(flyspell-duplicate ((t (:foreground "Gold3" :underline t :weight normal))))
'(flyspell-incorrect ((t (:foreground "OrangeRed" :underline t :weight normal))))
'(font-lock-comment-face ((t (:foreground "SteelBlue1"))))
'(font-lock-function-name-face ((t (:foreground "gold"))))
'(font-lock-keyword-face ((t (:foreground "springgreen"))))
'(font-lock-type-face ((t (:foreground "PaleGreen"))))
'(font-lock-variable-name-face ((t (:foreground "Coral"))))
'(menu ((((type x-toolkit)) (:background "light slate gray" :foreground "wheat" :box (:line-width 2 :color "grey75" :style released-button)))))
'(mode-line ((t (:foreground "black" :background "light slate gray"))))
'(tool-bar ((((type x w32 mac) (class color)) (:background "midnight blue" :foreground "wheat" :box (:line-width 1 :style released-button))))))
(set-cursor-color "deep sky blue")
(set-face-foreground 'default "wheat")
(set-face-background 'default "black"))
(defun faces_nox ()
;; these are used when in terminal
'(default ((t (:foreground "white" :background "black"))))
'(font-lock-comment-face ((t (:foreground "magenta"))))
'(font-lock-function-name-face ((t (:foreground "red"))))
'(font-lock-keyword-face ((t (:foreground "green"))))
'(font-lock-type-face ((t (:foreground "blue"))))
'(font-lock-string-face ((t (:foreground "cyan"))))
'(font-lock-variable-name-face ((t (:foreground "blue"))))
'(menu ((((type x-toolkit)) (:background "white" :foreground "black" :box (:line-width 2 :color "grey75" :style released-button)))))
'(modeline ((t (:foreground "blue" :background "white")))))
(set-face-foreground 'default "white")
(set-face-background 'default "black"))
4. Running SLIME
Right. Now, fire up emacs.
Although I assume you have a little experience with Emacs (or, at least, some fine googling skills), I will tell you how to start SLIME. Just press M-x (that means ``Press the (usually) Alt key and then press x'') and write slime. It should look like this:
Press RET (that 's your Return or Enter key). You should see a trippy text effect, and then this:
Now you're done. Happy hacking, and forgive me if my explanations have not been clear enough.
September 6, 2008
I’ve always thought that there are several types of programmers, each one showing distinctive features. Now, I think you could do the same with people who want to learn programming. And, one of the most important decisions a novice programmer will ever take is what to learn; the first choice is which programming language to learn first.
That’s the person who’s just interested in learning programming as a form of entertainment and to take a challenge every now and then. So, instead of collecting stamps, he learns programming. He probably won’t want to get down to the complex stuff, but he might end up liking it and wanting to do it for a living.
That’s the person who wants to learn programming as a discipline, and to get more out of his computer, or perhaps because he likes a challenge (but not the hobbyist‘s kind). He’s more likely to end up wanting to do it for a living, or to make use of the skills he starts to acquire in his current job.
Is this you? I suggest you either learn Python (see above) as an introduction to programming, and perhaps learn C. The latter might be a bit difficult in the beginning, but the effort will be worth it (you will not only be able to program in C — You will have some base knowledge and skills which will let you learn C++ or more advanced object-oriented programming languages more easily).
The computer scientist
Right, we’re starting to deal with the serious folks. That’s the folk who wants to learn programming to earn a living, and perhaps we should make a difference between an “engineer” in my categorizing system, and a “software engineer”, which is what this type of person will eventually become. He does want a challenge, but probably only to improve his skills and add new shiny things to his CV.
Is this you? I suggest you learn C. It will most likely be a prerequisite for you to work as an actual software engineer. Otherwise, it lets you learn C++, Java, or whatever you’re into more easily. Focus on object-oriented programming languages, as that’s the trend nowadays.
Now, this is the type I wanted to talk about. That’s the person who loveschallenges, loves programming, and loves to experiment with both old and new stuff. He’ll most likely want to do it for a living, but he’s likely to experience some trouble working for someone else doing things that he doesn’t like, unless he’s got enough free time to do what he likes at home (or in his server-cave). While you may think of programming as either something very complex or as a serious discipline, the hacker (if you’re thinking of movie types who break into computer systems, you’re thinking of a cracker, not a hacker) will think of it as a playful and pleasurable form of entertainment. It will probably even become his lifestyle.
Is this you? Hell, forget about Python unless you don’t know anything about programming yet! Learn C for lower-level tasks and embedded systems, and… Lisp! You can choose between Scheme (the tiny basis for Lisp, with which you can experiment but not really write any serious applications) and Common Lisp (a complex and complete dialect of Lisp, probably uglier than Scheme but excellent for any purpose).
See? It’s not that hard to decide which language to learn first.