[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Yet another 7.2 patch



	The following patch fixes that annoying problem where qualified
methods are not properly indented by zwei.

	enjoy,
		-mike (mthome@bbn.com)

 = = = = = = = =
;;; -*- Package: PCL -*-

;;; PATCH 3600-LOW.LISP
;;; patch to fix indentation of method forms in cases with qualifiers.
;;;    MT - 880926

#||
;; before...
(defmethod foo ((x number) y)			; this is ok
  whatever)
(defmethod foo :after ((x number) y)		; this is not
	   whatever)

;; after...
(defmethod foo ((x number) y)			; this is ok
  whatever)
(defmethod foo :after ((x number) y)		; this is too, now.
  whatever)
||#

(defun zwei:pcl-method-indentation (BP1 BP LASTPAREN lastsexp space-width sym)
  (declare (ignore sym space-width lastsexp))
  (let* ((ipt bp1)
	 (nsexps (do* ((sbp (zwei:forward-char lastparen 1)
			    (zwei:forward-sexp sbp 1 nil 0 bp))
		       (count 0))
		      ((null sbp) count)
		   (let* ((sbp1 (zwei:forward-over zwei:*whitespace-chars* sbp bp))
			  (ch (zwei:bp-char sbp1)))
		     (when (zwei:bp-= sbp1 bp)
		       (return count))
		     (when (= count 1)
		       (setf ipt sbp1))         ; should this be a copy-bp?
		     (unless (char-equal ch #\:)
		       (incf count))))))
    (case nsexps
      ((0 1) (values bp1 nil 2))
      ((2) (values ipt nil 0))
      (t (values bp1 nil 2)))))

(zwei:defindentation (defmethod . zwei:pcl-method-indentation))