[slime-cvs] CVS slime/contrib

CVS User nsiivola nsiivola at common-lisp.net
Tue Jun 14 10:27:22 UTC 2011


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

Modified Files:
	ChangeLog slime-cl-indent-test.txt slime-cl-indent.el 
Log Message:
slime-indentation: incomplete destructuring tails

  Fixes:

    (let (foo bar
              quux)
      ...)

  to indent as

    (let (foo bar
          quux)
      ...)

  instead.


--- /project/slime/cvsroot/slime/contrib/ChangeLog	2011/06/14 10:26:28	1.482
+++ /project/slime/cvsroot/slime/contrib/ChangeLog	2011/06/14 10:27:22	1.483
@@ -1,5 +1,13 @@
 2011-06-14  Nikodemus Siivola  <nikodemus at random-state.net>
 
+	Fix indentation of incomplete destructring.
+
+	* slime-cl-indent.el (lisp-indent-259): If there's a level of
+	destructuring specified in a tail, but we're looking at a word,
+	indent to sexp instead.
+
+	* slime-cl-indent-test.txt: Test 46.
+
 	Don't consider DEFINER and DEFINITION as tentative defuns.
 
 	* slime-cl-indent.el (common-lisp-indent-function-1): Don't consider
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent-test.txt	2011/06/14 10:26:28	1.7
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent-test.txt	2011/06/14 10:27:22	1.8
@@ -491,3 +491,9 @@
       bar
       quux)
   ...)
+
+;;; Test: 46
+
+(let (foo bar
+      quux)
+  ...)
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent.el	2011/06/14 10:26:28	1.45
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent.el	2011/06/14 10:27:22	1.46
@@ -1063,24 +1063,35 @@
                                sexp-column normal-indent)))
               (t
                ;; must be a destructing frob
-               (if (not (null p))
+               (if p
                    ;; descend
                    (setq method (cddr tem)
                          n (car p)
-                         p (cdr p))
-                 (setq tem (cadr tem))
-                 (throw 'exit
-                        (cond (tail
-                               normal-indent)
-                              ((eq tem 'nil)
-                               (list normal-indent
-                                     containing-form-start))
-                              ((integerp tem)
-                               (list (+ sexp-column tem)
-                                     containing-form-start))
-                              (t
-                               (funcall tem path state indent-point
-                                        sexp-column normal-indent)))))))))))
+                         p (cdr p)
+                         tail nil)
+                 (let ((wholep (eq '&whole (car tem))))
+                   (setq tem (cadr tem))
+                   (throw 'exit
+                          (cond (tail
+                                 (if (and wholep (integerp tem)
+                                          (save-excursion
+                                            (goto-char indent-point)
+                                            (back-to-indentation)
+                                            (looking-at "\\sw")))
+                                     ;; There's a further level of
+                                     ;; destructuring, but we're looking at a
+                                     ;; word -- indent to sexp.
+                                     (+ sexp-column tem)
+                                   normal-indent))
+                                ((not tem)
+                                 (list normal-indent
+                                       containing-form-start))
+                                ((integerp tem)
+                                 (list (+ sexp-column tem)
+                                       containing-form-start))
+                                (t
+                                 (funcall tem path state indent-point
+                                          sexp-column normal-indent))))))))))))
 
 (defun lisp-indent-tagbody (path state indent-point sexp-column normal-indent)
   (if (not (null (cdr path)))
@@ -1575,6 +1586,10 @@
       (indent-sexp)
       (if (equal (buffer-string) test)
           t
+        ;; (let ((test-buffer (current-buffer)))
+        ;;   (with-temp-buffer
+        ;;     (insert test)
+        ;;     (ediff-buffers (current-buffer) test-buffer)))
         (error "Bad indentation in test %s.\nMess: %s\nWanted: %s\nGot: %s"
                name
                mess





More information about the slime-cvs mailing list