[slime-cvs] CVS slime/contrib

trittweiler trittweiler at common-lisp.net
Wed Sep 5 18:49:00 UTC 2007


Update of /project/slime/cvsroot/slime/contrib
In directory clnet:/tmp/cvs-serv26398/contrib

Modified Files:
	slime-parse.el 
Log Message:
	Added extended arglist display for DECLAIM and PROCLAIM.
	
	* slime.el (slime-extended-operator-name-parser-alist): Added
	entries for "DECLAIM", and "PROCLAIM".
	(slime-parse-extended-operator/declare): Provide information about
	the operator the arglist is requested for.
	(slime-make-form-spec-from-string): Fixed for "()" as input.
	
	* swank-arglists.lisp (valid-operator-symbol-p): Explicitly allow
	the symbol 'DECLARE.
	(arglist-dispatch): New method for `DECLARE'. We have to catch
	this explicitly, as DECLARE doesn't have an arglist (in the
	`swank-backend:arglist' sense.)
	(*arglist-pprint-bindings*): New variable. Splitted out from
	`decoded-arglist-to-string'.
	(decoded-arglist-to-string): Use `*arglist-pprint-bindings*'.

	(parse-first-valid-form-spec): Rewritten, because function
	signature had to be changed: doesn't take arg-indices anymore;
	returns position of first valid spec as second value to remedy.
	(arglist-for-echo-area): Accomodated to new signature of
	`parse-first-valid-form-spec'; now searchs for contextual
	declaration operator name, to prefix a declaration arglist by
	"declare", "declaim", or "proclaim" depending on what was used at
	user's point in Slime. Use `*arglist-pprint-bindings*' for
	printing the found declaration operator name.
	(%find-declaration-operator): New helper to do this search.
	(completions-for-keyword): Accomodated to new signature of
	`parse-first-valid-form-spec'. Also fixed to correctly provide
	keyword completions in nested expressions like:

	   `(defun foo (x)
	      (let ((bar 'quux))
	        (with-open-file (s f :|'    [`|' being point]


--- /project/slime/cvsroot/slime/contrib/slime-parse.el	2007/09/01 05:36:19	1.2
+++ /project/slime/cvsroot/slime/contrib/slime-parse.el	2007/09/05 18:49:00	1.3
@@ -154,7 +154,9 @@
     ("CHANGE-CLASS"   . (slime-make-extended-operator-parser/look-ahead 2))
     ("DEFMETHOD"      . (slime-make-extended-operator-parser/look-ahead 1))
     ("APPLY"          . (slime-make-extended-operator-parser/look-ahead 1))
-    ("DECLARE"        . slime-parse-extended-operator/declare)))
+    ("DECLARE"        . slime-parse-extended-operator/declare)
+    ("DECLAIM"        . slime-parse-extended-operator/declare)
+    ("PROCLAIM"       . slime-parse-extended-operator/declare)))
 
 (defun slime-make-extended-operator-parser/look-ahead (steps)
   "Returns a parser that parses the current operator at point
@@ -195,9 +197,11 @@
                 (setq current-indices (list (second decl-indices)))
                 (setq current-points  (list (second decl-points))))
               (let ((declspec (slime-make-form-spec-from-string declspec-str)))
-                (setq current-forms   (list `(:declaration ,declspec)))
-                (setq current-indices (list (first decl-indices)))
-                (setq current-points  (list (first decl-points)))))))))
+                (setq current-forms   (list `(,name) `(:declaration ,declspec)))
+                (setq current-indices (list (first current-indices)
+					    (first decl-indices)))
+                (setq current-points  (list (first current-points)
+					    (first decl-points)))))))))
   (values current-forms current-indices current-points))
 
 (defun slime-nesting-until-point (target-point)
@@ -219,34 +223,35 @@
 is stripped from the form. This can be important to avoid mutual
 recursion between this function, `slime-enclosing-form-specs' and
 `slime-parse-extended-operator-name'."
-  (if (slime-length= string 0)
-      ""
-      (with-temp-buffer
-        ;; Do NEVER ever try to activate `lisp-mode' here with
-        ;; `slime-use-autodoc-mode' enabled, as this function is used
-        ;; to compute the current autodoc itself.
-        (erase-buffer)
-        (insert string)
-        (when strip-operator-p ; `(OP arg1 arg2 ...)' ==> `(arg1 arg2 ...)'
-          (goto-char (point-min))
-          (when (string= (thing-at-point 'char) "(")
-            (ignore-errors (forward-char 1)
-                           (forward-sexp)
-                           (slime-forward-blanks))
-            (delete-region (point-min) (point))
-            (insert "(")))
-        (goto-char (1- (point-max))) ; `(OP arg1 ... argN|)'
-        (multiple-value-bind (forms indices points)
-            (slime-enclosing-form-specs 1)
-          (if (null forms)
-              string
-              (let ((n (first (last indices))))
-                (goto-char (1+ (point-min))) ; `(|OP arg1 ... argN)'
-                (mapcar #'(lambda (s)
-                            (assert (not (equal s string)))       ; trap against
-                            (slime-make-form-spec-from-string s)) ;  endless recursion.
-                        (slime-ensure-list
-                         (slime-parse-sexp-at-point (1+ n) t)))))))))
+  (cond ((slime-length= string 0) "")
+	((equal string "()") '())
+	(t
+	 (with-temp-buffer
+	   ;; Do NEVER ever try to activate `lisp-mode' here with
+	   ;; `slime-use-autodoc-mode' enabled, as this function is used
+	   ;; to compute the current autodoc itself.
+	   (erase-buffer)
+	   (insert string)
+	   (when strip-operator-p ; `(OP arg1 arg2 ...)' ==> `(arg1 arg2 ...)'
+	     (goto-char (point-min))
+	     (when (string= (thing-at-point 'char) "(")
+	       (ignore-errors (forward-char 1)
+			      (forward-sexp)
+			      (slime-forward-blanks))
+	       (delete-region (point-min) (point))
+	       (insert "(")))
+	   (goto-char (1- (point-max))) ; `(OP arg1 ... argN|)'
+	   (multiple-value-bind (forms indices points)
+	       (slime-enclosing-form-specs 1)
+	     (if (null forms)
+		 string
+                (let ((n (first (last indices))))
+		   (goto-char (1+ (point-min))) ; `(|OP arg1 ... argN)'
+		   (mapcar #'(lambda (s)
+			       (assert (not (equal s string)))       ; trap against
+			       (slime-make-form-spec-from-string s)) ;  endless recursion.
+			   (slime-ensure-list
+			    (slime-parse-sexp-at-point (1+ n) t))))))))))
 
 
 (defun slime-enclosing-form-specs (&optional max-levels)
@@ -260,7 +265,7 @@
 As tertiary value, return the positions of the operators that are
 contained in the returned form specs. 
 
- When MAX-LEVELS is non-nil, go up at most this many levels of
+When MAX-LEVELS is non-nil, go up at most this many levels of
 parens.
 
 \(See SWANK::PARSE-FORM-SPEC for more information about what




More information about the slime-cvs mailing list