[slime-cvs] CVS slime/contrib
CVS User nsiivola
nsiivola at common-lisp.net
Sat Nov 12 12:01:52 UTC 2011
Update of /project/slime/cvsroot/slime/contrib
In directory tiger.common-lisp.net:/tmp/cvs-serv26473/contrib
Modified Files:
ChangeLog slime-cl-indent-test.txt slime-cl-indent.el
Log Message:
slime-indent: DEFMETHOD indentation when the name is a SETF-name and qualifiers are present
* slime-cl-indent.el (lisp-beginning-of-defmethod-qualifiers): Renamed
from `lisp-beginning-of-defmethod'. Skip the method name as well, since
unlike qualifiers it can be list -- eg. (setf foo).
(lisp-indent-defmethod): Use the above to get the number of skips right.
* slime-cl-indent-test.txt: Tests 64 and 65.
--- /project/slime/cvsroot/slime/contrib/ChangeLog 2011/10/31 09:46:16 1.503
+++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/11/12 12:01:52 1.504
@@ -1,3 +1,15 @@
+2011-11-12 Nikodemus Siivola <nikodemus at random-state.net>
+
+ Fix DEFMETHOD indentation when the name is a SETF-name, and qualifiers
+ are present.
+
+ * slime-cl-indent.el (lisp-beginning-of-defmethod-qualifiers): Renamed
+ from `lisp-beginning-of-defmethod'. Skip the method name as well, since
+ unlike qualifiers it can be list -- eg. (setf foo).
+ (lisp-indent-defmethod): Use the above to get the number of skips right.
+
+ * slime-cl-indent-test.txt: Tests 64 and 65.
+
2011-10-31 Nikodemus Siivola <nikodemus at random-state.net>
* slime-cl-indent.el (common-lisp-run-indentation-tests): Make it
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent-test.txt 2011/10/31 09:45:45 1.12
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent-test.txt 2011/11/12 12:01:52 1.13
@@ -667,3 +667,22 @@
do (foo foo)
;; comment inside clause
(bar))
+
+
+;;; Test: 64
+;;
+;; lisp-lambda-list-keyword-parameter-alignment: t
+;; lisp-lambda-list-keyword-alignment: t
+
+(defmethod (setf foo) :around (zot &key x
+ y)
+ (list zot))
+
+;;; Test: 65
+;;
+;; lisp-lambda-list-keyword-parameter-alignment: t
+;; lisp-lambda-list-keyword-alignment: t
+
+(defmethod (setf foo)
+ :around (zot &key x y)
+ (list zot))
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/10/31 09:46:16 1.53
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/11/12 12:01:52 1.54
@@ -1182,23 +1182,30 @@
(t 2)))))
(elt state 1)))
-(defun lisp-beginning-of-defmethod ()
- (let ((regexp "(defmethod\\|(DEFMETHOD\\|(:method\\|(:METHOD")
- (ok nil))
- (while (and (not (setq ok (looking-at regexp)))
+(defun lisp-beginning-of-defmethod-qualifiers ()
+ (let ((regexp-1 "(defmethod\\|(DEFMETHOD")
+ (regexp-2 "(:method\\|(:METHOD"))
+ (while (and (not (or (looking-at regexp-1)
+ (looking-at regexp-2)))
(ignore-errors (backward-up-list) t)))
- ok))
+ (cond ((looking-at regexp-1)
+ (forward-char)
+ ;; Skip name.
+ (forward-sexp 2)
+ 1)
+ ((looking-at regexp-2)
+ (forward-char)
+ (forward-sexp 1)
+ 0))))
;; LISP-INDENT-DEFMETHOD now supports the presence of more than one method
;; qualifier and indents the method's lambda list properly. -- dvl
(defun lisp-indent-defmethod
(path state indent-point sexp-column normal-indent)
(lisp-indent-259
- (let ((nskip 0))
+ (let ((nskip nil))
(if (save-excursion
- (when (lisp-beginning-of-defmethod)
- (forward-char)
- (forward-sexp 1)
+ (when (setq nskip (lisp-beginning-of-defmethod-qualifiers))
(skip-chars-forward " \t\n")
(while (looking-at "\\sw\\|\\s_")
(incf nskip)
More information about the slime-cvs
mailing list