[climacs-cvs] CVS update: climacs/lisp-syntax.lisp
Robert Strandh
rstrandh at common-lisp.net
Wed Jan 11 17:10:17 UTC 2006
Update of /project/climacs/cvsroot/climacs
In directory common-lisp.net:/tmp/cvs-serv9480
Modified Files:
lisp-syntax.lisp
Log Message:
Added indentation functions for `flet' and `labels'.
Date: Wed Jan 11 18:10:16 2006
Author: rstrandh
Index: climacs/lisp-syntax.lisp
diff -u climacs/lisp-syntax.lisp:1.39 climacs/lisp-syntax.lisp:1.40
--- climacs/lisp-syntax.lisp:1.39 Wed Dec 21 07:06:54 2005
+++ climacs/lisp-syntax.lisp Wed Jan 11 18:10:15 2006
@@ -1937,6 +1937,7 @@
(define-simple-indentor (defvar indent-form))
(define-simple-indentor (defparameter indent-form))
(define-simple-indentor (defconstant indent-form))
+(define-simple-indentor (lambda indent-ordinary-lambda-list))
;;; non-simple-cases: LOOP, MACROLET, FLET, LABELS
@@ -2043,6 +2044,28 @@
(values tree 2)
(values tree 4))
(indent-form syntax (elt-form (children tree) (car path)) (cdr path))))
+
+(defmethod indent-local-function-definition ((syntax lisp-syntax) tree path)
+ (cond ((null (cdr path))
+ ;; top level
+ (cond ((= (car path) 1)
+ ;; before name, indent 1
+ (values tree 1))
+ ((= (car path) 2)
+ ;; between name and lambda list, indent 4
+ (values (elt-form (children tree) 1) 4))
+ (t
+ ;; after lambda list, indent 2
+ (values (elt-form (children tree) 1) 2))))
+ ((= (car path) 1)
+ ;; inside lambda list
+ (indent-ordinary-lambda-list syntax (elt-form (children tree) 1) (cdr path)))
+ (t (indent-form syntax (elt-form (children tree) (car path)) (cdr path)))))
+
+(define-list-indentor indent-local-function-definitions indent-local-function-definition)
+
+(define-simple-indentor (flet indent-local-function-definitions))
+(define-simple-indentor (labels indent-local-function-definitions))
(defun compute-path-in-trees (trees n offset)
(cond ((or (null trees)
More information about the Climacs-cvs
mailing list