[slime-devel] defclass form indentation

Bill Clementson billclem at gmail.com
Fri Feb 16 22:15:24 UTC 2007


Hi Zach,

On 16 Feb 2007 14:04:31 -0500, Zach Beane <xach at xach.com> wrote:
> I've run into some problems with indentation for defclass
> forms. Here's an example:
>
>   (defclass field ()
>     ((name
>       :initarg :name
>       :accessor name)
>      (default-value
>          :initarg :default-value
>        :accessor default-value))
>     (:default-initargs
>         :name nil
>       :default-value nil))
>
> This seems to be caused by the sexp starting with symbols that start
> with the letters "def"; I don't have a problem if the slot is named
> "dfault-value", for example.
>
> I'm using the bundled cl-indent from:
>
>   GNU Emacs 21.4.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
>   2006-09-15 on rothera, modified by Debian
>
> How can I get the indentation to align properly?

There should be some standard way to override the "def" indentation
rules for exceptions in cl-indent. Until someone submits a proper
patch, the following yucky patch does seem to work for your scenario:

--- cl-indent-orig.el	2007-02-16 13:49:06.000000000 -0800
+++ cl-indent-mods.el	2007-02-16 13:51:39.000000000 -0800
@@ -214,15 +214,17 @@
                   ((null method)
                    (when (null (cdr path))
 		     ;; (package prefix was stripped off above)
-		     (cond ((string-match "\\`def"
-					  function)
+		     (cond ((and (string-match "\\`def"
+					       function)
+				 (not (string-match "\\`default-"
+						    function)))
 			    (setq tentative-defun t))
 			   ((string-match



More information about the slime-devel mailing list