[slime-cvs] CVS slime/contrib
CVS User nsiivola
nsiivola at common-lisp.net
Fri Mar 30 10:40:21 UTC 2012
Update of /project/slime/cvsroot/slime/contrib
In directory tiger.common-lisp.net:/tmp/cvs-serv17514/contrib
Modified Files:
ChangeLog slime-cl-indent-test.txt slime-cl-indent.el
Log Message:
slime-indentation: fix indentation of (foo ;; comment\n...
(foo ;; Deal with bar
(bar)
;; Deal with quux
(quux))
instead of
(foo ;; Deal with bar
(bar)
;; Deal with quux
(quux))
--- /project/slime/cvsroot/slime/contrib/ChangeLog 2012/03/19 14:27:04 1.538
+++ /project/slime/cvsroot/slime/contrib/ChangeLog 2012/03/30 10:40:21 1.539
@@ -43,6 +43,14 @@
* swank-mrepl.lisp (send-prompt): Fix use of OR.
Reported by Mark H. David.
+2012-03-30 Nikodemus Siivola <nikodemus at random-state.net>
+
+ * slime-cl-indent.el (common-lisp-indent-function-1): Fix indentation
+ of (and ;; Foo\n...). Previously following lines were indented by one, instead
+ of using normal indentation.
+
+ * slime-cl-indent-test.txt (tests 84-86): Tests.
+
2011-12-30 Nikodemus Siivola <nikodemus at random-state.net>
* slime-cl-indent.el (common-lisp-looking-at-keyword): New function. Looks
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent-test.txt 2011/12/30 17:10:13 1.18
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent-test.txt 2012/03/30 10:40:21 1.19
@@ -890,3 +890,23 @@
#+quux #+quux
:quux t
:zot t)
+
+;;; Test: 84
+
+(and ;; Foo
+ (something)
+ ;; Quux
+ (more))
+
+;;; Test: 85
+
+(and ;; Foo
+ (something)
+ ;; Quux
+ (more))
+
+;;; Test: 86
+
+(foo (
+ bar quux
+ zor))
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/12/30 17:10:13 1.62
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2012/03/30 10:40:21 1.63
@@ -951,11 +951,31 @@
(error
(setq depth lisp-indent-maximum-backtracking))))))
(or calculated tentative-calculated
- ;; Fallback. calculate-lisp-indent doesn't deal with
- ;; things like (foo (or x
- ;; y) t
- ;; z)
- ;; but would align the Z with Y.
+ ;; Fallback.
+ ;;
+ ;; Instead of punting directly to calculate-lisp-indent we handle a few
+ ;; of cases it doesn't deal with:
+ ;;
+ ;; A: (foo (
+ ;; bar zot
+ ;; quux))
+ ;;
+ ;; would align QUUX with ZOT.
+ ;;
+ ;; B:
+ ;; (foo (or x
+ ;; y) t
+ ;; z)
+ ;;
+ ;; would align the Z with Y.
+ ;;
+ ;; C:
+ ;; (foo ;; Comment
+ ;; (bar)
+ ;; ;; Comment 2
+ ;; (quux))
+ ;;
+ ;; would indent BAR and QUUX by one.
(ignore-errors
(save-excursion
(goto-char indent-point)
@@ -966,11 +986,20 @@
(let ((one (current-column)))
(skip-chars-forward " \t")
(if (or (eolp) (looking-at ";"))
+ ;; A.
(list one containing-form-start)
(forward-sexp 2)
(backward-sexp)
- (unless (= p (point))
- (list (current-column) containing-form-start)))))))))))
+ (if (/= p (point))
+ ;; B.
+ (list (current-column) containing-form-start)
+ (backward-sexp)
+ (forward-sexp)
+ (let ((tmp (+ (current-column) 1)))
+ (skip-chars-forward " \t")
+ (if (looking-at ";")
+ ;; C.
+ (list tmp containing-form-start)))))))))))))
(defun common-lisp-indent-call-method (function method path state indent-point
More information about the slime-cvs
mailing list