Update of /project/clim-desktop/cvsroot/clim-desktop In directory clnet:/tmp/cvs-serv19697
Modified Files: swine.lisp Log Message: Added fallback indentation for macros (proper indentation of &body and &rest parameters even when no specific rules have been defined for the operator). Belongs in Climacs itself (as usual).
--- /project/clim-desktop/cvsroot/clim-desktop/swine.lisp 2006/06/01 23:21:29 1.19 +++ /project/clim-desktop/cvsroot/clim-desktop/swine.lisp 2006/06/02 21:06:32 1.20 @@ -470,6 +470,36 @@ (show-note-counts notes (second result)) (when notes (show-notes notes (name buffer) "")))))
+;;; Fix indentation of macro forms: + +;; Redefine the basic method from Climacs to check the symbols argument list. +;; This gives us Emacs/SLIME-style indentation regarding +;; &body and &rest parameters in macros. +(defmethod compute-list-indentation ((syntax lisp-syntax) symbol tree path) + (if (null (cdr path)) + ;; top level + (let* ((arglist (arglist symbol)) + (body-or-rest-pos (or (position '&body arglist) + (position '&rest arglist)))) + (if (and (or (macro-function symbol) + (special-operator-p symbol)) + (and (not (null body-or-rest-pos)) + (plusp body-or-rest-pos))) + ;; macro-form with "interesting" arguments. + (if (>= (- (car path) 2) body-or-rest-pos) + ;; &body arg. + (values (elt-noncomment (children tree) 1) 1) + ;; non-&body-arg. + (values (elt-noncomment (children tree) 1) 3)) + ;; normal form. + (if (= (car path) 2) + ;; indent like first child + (values (elt-noncomment (children tree) 1) 0) + ;; indent like second child + (values (elt-noncomment (children tree) 2) 0)))) + ;; inside a subexpression + (indent-form syntax (elt-noncomment (children tree) (car path)) (cdr path)))) + ;;; Parameter hinting code. ;;; -----------------------