[slime-cvs] CVS slime/contrib

CVS User nsiivola nsiivola at common-lisp.net
Mon May 16 08:23:45 UTC 2011


Update of /project/slime/cvsroot/slime/contrib
In directory common-lisp.net:/tmp/cvs-serv24759/contrib

Modified Files:
	slime-cl-indent.el 
Log Message:
slime-indentation: better multiform loop bodies better

  When subclause indentation is disabled:

   (loop repeat n
         do (foo)
         finally (fini1)
                 (fini2)
                 (fini3))

  fixes the previous commit that didn't get this right if
  there were more than 2 subforms. Duh.


--- /project/slime/cvsroot/slime/contrib/slime-cl-indent.el	2011/05/16 07:59:18	1.20
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent.el	2011/05/16 08:23:45	1.21
@@ -167,24 +167,24 @@
                              (if (eq 'extended/split type)
                                  (- (current-column) 4)
                                (current-column))))
-         (indent loop-indentation))
+         (indent nil)
+         (re "\\(:?\\sw+\\|;\\|)\\|\n\\)"))
     (goto-char indent-point)
-    (beginning-of-line)
+    (back-to-indentation)
     (cond ((eq 'simple type)
            (+ loop-indentation lisp-simple-loop-indentation))
-          ;; Previous line starts a body, and has a form on it
-          ((and (save-excursion
-                  (previous-line)
-                  (back-to-indentation)
-                  (looking-at common-lisp-indent-body-introducing-loop-macro-keyword))
+          ;; We are already in a body, with forms in it.
+          ((and (not (looking-at re))
                 (save-excursion
-                  (when (and (ignore-errors (backward-sexp) t)
-                             (not (looking-at common-lisp-indent-body-introducing-loop-macro-keyword)))
-                    (setf indent (current-column)))))
+                  (while (and (ignore-errors (backward-sexp) t)
+                              (not (looking-at re)))
+                    (setq indent (current-column)))
+                  (when (and indent
+                             (looking-at common-lisp-indent-body-introducing-loop-macro-keyword))
+                    t)))
            (list indent loop-start))
           ;; Keyword-style
-          ((or lisp-loop-indent-forms-like-keywords
-               (looking-at "^\\s-*\\(:?\\sw+\\|;\\|)\\|\n\\)"))
+          ((or lisp-loop-indent-forms-like-keywords (looking-at re))
            (list (+ loop-indentation 6) loop-start))
           ;; Form-style
           (t
@@ -1224,9 +1224,11 @@
          for y in quux
          finally (foo)
                  (fo)
+                 (zoo)
          do
          (print x)
-         (print y))")
+         (print y)
+         (print 'ok!))")
       (((lisp-loop-indent-subclauses nil)
         (lisp-loop-indent-forms-like-keywords nil))
        "
@@ -1234,9 +1236,22 @@
          for y in quux
          finally (foo)
                  (fo)
+                 (zoo)
          do
             (print x)
-            (print y))"))))
+            (print y)
+            (print 'ok!))")
+      (((lisp-loop-indent-subclauses t)
+        (lisp-loop-indent-forms-like-keywords nil))
+       "
+   (loop for x in foo
+         for y in quux
+         finally (foo)
+                 (fo)
+         do
+            (print x)
+            (print y)
+            (print 'ok!))"))))
 
 
 





More information about the slime-cvs mailing list