Michael Weber: Random Bits and Pieces

Lisp Logo (by Conrad Barsky)

Tamas K. Papp asked on comp.lang.lisp about a DEFCLASS skeleton, after I showed a DEFPACKAGE skeleton earlier. So, here it is:


(define-skeleton mwe:cl-defclass-skeleton
  "Inserts a Common Lisp DEFCLASS skeleton."
  "Class: "
  "(defclass " str " (" ((skeleton-read "Superclass: ") str " ") & -1 ")"
  \n "(" ((skeleton-read "Slot: ")
          "(" str " :accessor get-" str " :initarg :" str ")" \n) & '(join-line)
  ")"
  ;; \n "(:default-initargs " - ")" ;; add to your liking...
  ")\n" \n
  _)

(define-skeleton mwe:cl-defclass-slot-skeleton
  "Inserts a Common Lisp DEFCLASS slot skeleton."
  "Slot: "
  ((skeleton-read "Slot: ")
   "(" str " :accessor get-" str " :initarg :" str ")" \n) & '(join-line)
  _)

I have not felt a need for it so far, mostly because it turns out that my DEFCLASS forms rarely are that regular, and tend to grow iteratively, so I have to go back and change them anyway. Using skeletons then feels to me like interrupting the flow, for lack of a better explanation...

Also, I would rather have somebody step forward and publish their msf-abbrev abbreviations for Common Lisp. Thanks.

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

The above skeleton is part of Redshank mode now.