[slime-cvs] CVS slime/contrib
CVS User nsiivola
nsiivola at common-lisp.net
Wed May 18 19:26:41 UTC 2011
Update of /project/slime/cvsroot/slime/contrib
In directory common-lisp.net:/tmp/cvs-serv723/contrib
Modified Files:
ChangeLog slime-cl-indent.el
Log Message:
slime-indention: add support for short form DEFSETF
--- /project/slime/cvsroot/slime/contrib/ChangeLog 2011/05/17 19:54:38 1.455
+++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/05/18 19:26:40 1.456
@@ -1,3 +1,8 @@
+2011-05-18 Nikodemus Siivola <nikodemus at solipsist>
+
+ * slime-cl-indent.el (lisp-indent-defsetf, run-lisp-indent-tests):
+ Better DEFSETF indentation: support both long and short forms.
+
2011-05-17 Nikodemus Siivola <nikodemus at random-state.net>
* slime-cl-indent.el (run-lisp-indent-tests, lisp-indent-loop): Fix
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/05/17 19:54:38 1.22
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/05/18 19:26:40 1.23
@@ -648,6 +648,35 @@
(&whole nil &rest 1))
path state indent-point sexp-column normal-indent)))
+(defun lisp-indent-defsetf
+ (path state indent-point sexp-column normal-indent)
+ (list
+ (cond
+ ;; Inside the lambda-list in a long-form defsetf.
+ ((and (eql 2 (car path)) (cdr path))
+ (lisp-indent-lambda-list indent-point sexp-column (elt state 1)))
+ ;; Long form: has a lambda-list.
+ ((or (cdr path)
+ (save-excursion
+ (goto-char (elt state 1))
+ (ignore-errors
+ (down-list)
+ (forward-sexp 3)
+ (backward-sexp)
+ (looking-at "nil\\|("))))
+ (+ sexp-column
+ (case (car path)
+ ((1 3) 4)
+ (2 4)
+ (t 2))))
+ ;; Short form.
+ (t
+ (+ sexp-column
+ (case (car path)
+ (1 4)
+ (2 4)
+ (t 2)))))
+ (elt state 1)))
;; LISP-INDENT-DEFMETHOD now supports the presence of more than one method
;; qualifier and indents the method's lambda list properly. -- dvl
@@ -959,7 +988,7 @@
(defconst . defcustom)
(define-condition . defclass)
(define-modify-macro (4 &lambda &body))
- (defsetf (4 &lambda 4 &body))
+ (defsetf lisp-indent-defsetf)
(defun (4 &lambda &body))
(defgeneric (4 &lambda &body))
(define-setf-method . defun)
@@ -1269,7 +1298,20 @@
collect (open f
:direction :output)
do (foo) (bar)
- (quux))"))))
+ (quux))")
+ "
+ (defsetf foo bar
+ \"the doc string\")"
+ "
+ (defsetf foo
+ bar
+ \"the doc string\")"
+ (((lisp-lambda-list-keyword-parameter-alignment t))
+ "
+ (defsetf foo (x y &optional a
+ z)
+ (a b c)
+ stuff)"))))
More information about the slime-cvs
mailing list