[slime-cvs] CVS slime/contrib
CVS User nsiivola
nsiivola at common-lisp.net
Wed May 18 21:48:04 UTC 2011
Update of /project/slime/cvsroot/slime/contrib
In directory common-lisp.net:/tmp/cvs-serv6428/contrib
Modified Files:
ChangeLog slime-cl-indent.el
Log Message:
slime-indentation: aligning keywords in calls
Provides
(make-instance 'foo :bar t :quux t
:zot t)
and
(vecto:with-canvas (:height 42
:width 100)
(save-png foo))
Controlled via lisp-align-keywords-in-calls.
--- /project/slime/cvsroot/slime/contrib/ChangeLog 2011/05/18 19:26:40 1.456
+++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/05/18 21:48:04 1.457
@@ -1,3 +1,9 @@
+2011-05-19 Nikodemus Siivola <nikodemus at random-state.net>
+
+ * slime-cl-indent.el (common-lisp-indent-function-1)
+ (lisp-align-keywords-in-calls): Support for aligning keyword
+ arguments in calls.
+
2011-05-18 Nikodemus Siivola <nikodemus at solipsist>
* slime-cl-indent.el (lisp-indent-defsetf, run-lisp-indent-tests):
--- /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/05/18 19:26:40 1.23
+++ /project/slime/cvsroot/slime/contrib/slime-cl-indent.el 2011/05/18 21:48:04 1.24
@@ -86,6 +86,22 @@
:type 'integer
:group 'lisp-indent)
+(defcustom lisp-align-keywords-in-calls t
+ "Whether to align keyword arguments vertically or not.
+If t (the default), keywords in contexts where no other
+indentation rule takes precedence are aligned like this:
+
+\(make-instance 'foo :bar t
+ :quux 42)
+
+If nil, they are indented like any other function
+call arguments:
+
+\(make-instance 'foo :bar t
+ :quux 42)"
+ :type 'boolean
+ :group 'lisp-indent)
+
(defcustom lisp-lambda-list-keyword-alignment nil
"Whether to vertically align lambda-list keywords together.
If nil (the default), keyworded lambda-list parts are aligned
@@ -386,7 +402,19 @@
function lisp-indent-defun-method
path state indent-point
sexp-column normal-indent)
- normal-indent tentative-calculated)))
+ normal-indent tentative-calculated)
+ (when lisp-align-keywords-in-calls
+ ;; No method so far. If we're looking at a keyword,
+ ;; align with the first keyword in this expression.
+ ;; This gives a reasonable indentation to most things
+ ;; with keyword arguments.
+ (save-excursion
+ (goto-char indent-point)
+ (back-to-indentation)
+ (when (looking-at ":")
+ (while (ignore-errors (backward-sexp 2) t)
+ (when (looking-at ":")
+ (setq calculated (current-column)))))))))
((integerp method)
;; convenient top-level hack.
;; (also compatible with lisp-indent-function)
@@ -1311,7 +1339,15 @@
(defsetf foo (x y &optional a
z)
(a b c)
- stuff)"))))
+ stuff)")
+ (((lisp-align-keywords-in-calls t))
+ "
+ (make-instance 'foo :bar t quux t
+ :zot t)")
+ (((lisp-align-keywords-in-calls nil))
+ "
+ (make-instance 'foo :bar t quux t
+ :zot t)"))))
More information about the slime-cvs
mailing list