Michael Weber: Random Bits and Pieces

Lisp Logo (by Conrad Barsky)

If your Common Lisp DEFCLASS forms have been looking like fruit salad, despair not! GNU/Emacs and mwe-defclass-formatter.el to the rescue:

Before:


(defclass identifier ()
  ((name :reader name-of :initarg :name)
   (location :reader location-of :initarg :location)
   (scope         :accessor scope-of :initarg :scope)
   (definition :accessor definition-of :initform nil))
  (:default-initargs :scope *current-scope*))

After M-x mwe:align-defclass-slots RET:


(defclass identifier ()
  ((name       :reader   name-of       :initarg  :name)
   (location   :reader   location-of   :initarg  :location)
   (scope      :accessor scope-of      :initarg  :scope)
   (definition :accessor definition-of :initform nil))
  (:default-initargs :scope *current-scope*))

Existence of this code snippet is clearly a proof that soccer does not deserve my full attention. I can do many other useless things at the same time!

Should this go into cl-indent.el? If so, whose version?

UPDATE 2006-06-27: Emacs Compatibility Issues

Stefan Kamphausen kindly wrote in to tell that my code works in recent Emacsen only:

I just tried your formatting function and it failed. You seem to be using a very recent version of just-one-space which takes an argument. My XEmacs as well as the GNU Emacs installed on my system don't feature such a version. I tried to come up with a little helper function and it seems to work fine. Maybe this is interesting to you.

(defun ensure-spaces (num)
  "Helper function when you don't have a recent `just-one-space'."
  (just-one-space)
  (if (= num 0)
    (backward-delete-char)
    (loop repeat num
          do
          (insert " "))))

For what it's worth, here is my GNU/Emacs's just-one-space (version 22.0.50.1):


(defun just-one-space (&optional n)
  "Delete all spaces and tabs around point, leaving one space (or N spaces)."
  (interactive "*p")
  (let ((orig-pos (point)))
    (skip-chars-backward " \t")
    (constrain-to-field nil orig-pos)
    (dotimes (i (or n 1))
      (if (= (following-char) ?\s)
	  (forward-char 1)
	(insert ?\s)))
    (delete-region
     (point)
     (progn
       (skip-chars-forward " \t")
       (constrain-to-field nil orig-pos t)))))

UPDATE 2008-01-08: Old News...

The above functionality is part of Redshank mode now.

The Da Vinci Code

2006-06-15 :: /movies
via Irina: Film poster: The Da Vinci Code

I won't be original by saying that the film didn't come up to the book's fans expectations, but I wasn't fully disappoined. It was fairly entertaining, it showed places and works of art mentioned in the book, and Tom Hanks is Tom Hanks no matter what. Apart from a few absurd moments due to the weak script and the hollow play of Audrey Tautou (too bad, I actually liked her after "Amélie", but maybe it's because she had to play in English here), it was agreeable. Both Mike and another friend who haven't read the book, liked it. So I would say, it is either for those who didn't read the book or those who are passionate fans of it.

Well, to be honest, I don't see the problem with this movie. It's fiction, even if based on real events. I go to movies for entertainment, and although I could foresee some stereotypical plot lines it was decent entertainment.

If I want facts on the real events behind the story, I go and do my homework on the subject. Even a single book will likely give me more background information than can be squeezed into the standard two hour movie format. I have no sympathy for people around the world making a huge deal out of it. To repeat myself, it's fiction. If somebody want to raise concerns, feel free. But don't try to impose restrictions on what is acceptable and what is not for others to see.

Having said that, I liked the Pathe Tuschinski a lot. Due to work, I have not been to movies with Irina for some time now, and it's always fun to discuss with her afterwards, especially, if we have different opinions. :)