[slime-cvs] CVS slime/contrib

CVS User trittweiler trittweiler at common-lisp.net
Thu Feb 26 18:35:43 UTC 2009


Update of /project/slime/cvsroot/slime/contrib
In directory cl-net:/tmp/cvs-serv28499/contrib

Modified Files:
	ChangeLog slime-enclosing-context.el slime-parse.el 
Log Message:
	* slime-parse.el (slime-parse-symbol-name-at-point):
	Removed. Superfluous due to recent changes on
	`slime-symbol-name-at-point'.
	(slime-parse-sexp-at-point): Simplified; use
	`slime-sexp-at-point'.
	(slime-inside-string-p, slime-beginning-of-string): Use
	`slime-current-parser-state'.
	([test] enclosing-form-specs.1): Add some simple cases.

	* slime-enclosing-context.el (slime-find-bound-names): Replace
	`slime-parse-symbol-name-at-point' with
	`slime-symbol-name-at-point'
	(slime-find-bound-functions): No need for `slime-ensure-list'
	anymore.
	([test] enclosing-context.1): Adapted due to the changes.


--- /project/slime/cvsroot/slime/contrib/ChangeLog	2009/02/21 19:05:21	1.176
+++ /project/slime/cvsroot/slime/contrib/ChangeLog	2009/02/26 18:35:43	1.177
@@ -1,3 +1,25 @@
+2009-02-26  Tobias C. Rittweiler  <tcr at freebits.de>
+
+	* slime-parse.el (slime-parse-symbol-name-at-point):
+	Removed. Superfluous due to recent changes on
+	`slime-symbol-name-at-point'.
+	(slime-parse-sexp-at-point): Simplified; use
+	`slime-sexp-at-point'.
+	(slime-inside-string-p, slime-beginning-of-string): Use
+	`slime-current-parser-state'.
+	([test] enclosing-form-specs.1): Add some simple cases.
+
+	* slime-enclosing-context.el (slime-find-bound-names): Replace
+	`slime-parse-symbol-name-at-point' with
+	`slime-symbol-name-at-point'
+	(slime-find-bound-functions): No need for `slime-ensure-list'
+	anymore.
+	([test] enclosing-context.1): Adapted due to the changes.
+
+2009-02-25  Luís Oliveira  <loliveira at common-lisp.net>
+
+	* slime-compiler-notes-tree.el: Fix typo in the `provide' form.
+
 2009-02-21  Tobias C. Rittweiler  <tcr at freebits.de>
 
 	* slime-package-fu.el: Removed misplaced comma, deleted some
--- /project/slime/cvsroot/slime/contrib/slime-enclosing-context.el	2009/01/18 14:18:53	1.3
+++ /project/slime/cvsroot/slime/contrib/slime-enclosing-context.el	2009/02/26 18:35:43	1.4
@@ -54,7 +54,7 @@
 		 (ignore-errors
 		   (loop 
 		    (down-list) 
-		    (push (slime-parse-symbol-name-at-point 1) binding-names)
+		    (push (slime-symbol-name-at-point) binding-names)
 		    (push (save-excursion (backward-up-list) (point)) 
 			  binding-start-points)
 		    (up-list)))))
@@ -81,8 +81,8 @@
 		 (ignore-errors 
 		   (loop
 		    (down-list) 
-		    (destructuring-bind (name arglist)
-			(slime-ensure-list (slime-parse-sexp-at-point 2))
+		    (destructuring-bind (name arglist) 
+                        (slime-parse-sexp-at-point 2)
 		      (assert (slime-has-symbol-syntax-p name)) (assert arglist)
 		      (push name names)
 		      (push arglist arglists)
@@ -100,8 +100,16 @@
     '(("(flet ((,nil ()))
 	 (let ((bar 13)
 	       (,foo 42))
-	   *HERE*))" 
-       (",nil" "bar" ",foo")
+	   *HERE*))"
+       ;; We used to return ,foo here, but we do not anymore.  We
+       ;; still return ,nil for the `slime-enclosing-bound-functions',
+       ;; though. The first one is used for local M-., whereas the
+       ;; latter is used for local autodoc. It does not seem too
+       ;; important for local M-. to work on such names. \(The reason
+       ;; that it does not work anymore, is that
+       ;; `slime-symbol-name-at-point' now does TRT and does not
+       ;; return a leading comma anymore.\)
+       ("bar" nil nil)
        ((",nil" "()")))
       ("(flet ((foo ()))
          (quux)
--- /project/slime/cvsroot/slime/contrib/slime-parse.el	2009/02/02 15:29:33	1.15
+++ /project/slime/cvsroot/slime/contrib/slime-parse.el	2009/02/26 18:35:43	1.16
@@ -27,11 +27,9 @@
 	      (concat (slime-incomplete-sexp-at-point) ")"))))))))
 
 (defun slime-parse-sexp-at-point (&optional n skip-blanks-p)
-  "Return the sexp at point as a string, otherwise nil.
-If N is given and greater than 1, a list of all such sexps
-following the sexp at point is returned. (If there are not
-as many sexps as N, a list with < N sexps is returned.)
-
+  "Returns the sexps at point as a list of strings, otherwise nil.
+\(If there are not as many sexps as N, a list with < N sexps is
+returned.\) 
 If SKIP-BLANKS-P is true, leading whitespaces &c are skipped.
 "
   (interactive "p") (or n (setq n 1))
@@ -42,38 +40,25 @@
                              (or (thing-at-point 'sexp)
                                  (slime-symbol-name-at-point)))))
              (if string (substring-no-properties string) nil))))
-    ;; `thing-at-point' depends upon the current syntax table; otherwise
-    ;; keywords like `:foo' are not recognized as sexps. (This function
-    ;; may be called from temporary buffers etc.)
-    (with-syntax-table lisp-mode-syntax-table
-      (save-excursion
-        (when skip-blanks-p ; e.g. `( foo bat)' where point is after ?\(.
-          (slime-forward-blanks))
-        (let ((result nil))
-          (dotimes (i n)
-            ;; `foo(bar baz)' where point is at ?\( or ?\).
-            (if (and (char-after) (member (char-syntax (char-after)) '(?\( ?\) ?\')))
-                (push (sexp-at-point :sexp-first) result)
-                (push (sexp-at-point :symbol-first) result))
-            (ignore-errors (forward-sexp) (slime-forward-blanks))
-            (save-excursion
-              (unless (slime-point-moves-p (ignore-errors (forward-sexp)))
-                (return))))
-          (if (slime-length= result 1)
-              (first result)
-              (nreverse result)))))))
+    (save-excursion
+      (when skip-blanks-p ; e.g. `( foo bat)' where point is after ?\(.
+        (slime-forward-blanks))
+      (let ((result nil))
+        (dotimes (i n)
+          (push (slime-sexp-at-point) result)
+          ;; Skip current sexp
+          (ignore-errors (forward-sexp) (slime-forward-blanks))
+          ;; Is there an additional sexp in front of us?
+          (save-excursion
+            (unless (slime-point-moves-p (ignore-errors (forward-sexp)))
+              (return))))
+        (nreverse result)))))
 
 (defun slime-has-symbol-syntax-p (string)
   (if (and string (not (zerop (length string))))
       (member (char-syntax (aref string 0)) 
 	      '(?w ?_ ?\' ?\\))))
 
-(defun slime-parse-symbol-name-at-point (&optional n skip-blanks-p)
-  (let ((symbols (slime-parse-sexp-at-point n skip-blanks-p)))
-    (if (every #'slime-has-symbol-syntax-p (slime-ensure-list symbols))
-	symbols
-	nil)))
-
 (defun slime-incomplete-sexp-at-point (&optional n)
   (interactive "p") (or n (setq n 1))
   (buffer-substring-no-properties (save-excursion (backward-up-list n) (point))
@@ -136,7 +121,7 @@
                      (not (= (point)       ; point is at end of form?
                              (save-excursion (slime-end-of-list)
                                              (point)))))
-            (let* ((args (slime-ensure-list (slime-parse-sexp-at-point n)))
+            (let* ((args (slime-parse-sexp-at-point n))
                    (arg-specs (mapcar #'slime-make-form-spec-from-string args)))
               (setq current-forms (cons `(,name , at arg-specs) old-forms))))
           (values current-forms current-indices current-points)
@@ -231,8 +216,7 @@
 		  (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))))))))))
+			  (slime-parse-sexp-at-point (1+ n) t)))))))))
 
 
 (defun slime-enclosing-form-specs (&optional max-levels)
@@ -310,7 +294,7 @@
               (when (member (char-syntax (char-after)) '(?\( ?')) 
                 (incf level)
                 (forward-char 1)
-                (let ((name (slime-parse-symbol-name-at-point 1 nil)))
+                (let ((name (slime-symbol-name-at-point)))
                   (cond
                     (name
                      (save-restriction
@@ -339,23 +323,25 @@
   (if (listp thing) thing (list thing)))
 
 (defun slime-inside-string-p ()
-  (let* ((toplevel-begin (save-excursion (beginning-of-defun) (point)))
-	 (parse-result (parse-partial-sexp toplevel-begin (point)))
-	 (inside-string-p  (nth 3 parse-result))
-	 (string-start-pos (nth 8 parse-result)))
-    (and inside-string-p string-start-pos)))
+  (nth 3 (slime-current-parser-state)))
 
 (defun slime-beginning-of-string ()
-  (let ((string-start-pos (slime-inside-string-p)))
-    (if string-start-pos
-	(goto-char string-start-pos)
-	(error "We're not within a string"))))
+  (let* ((parser-state (slime-current-parser-state))
+	 (inside-string-p  (nth 3 parser-state))
+	 (string-start-pos (nth 8 parser-state)))
+    (if inside-string-p
+        (goto-char string-start-pos)
+        (error "We're not within a string"))))
 
 (def-slime-test enclosing-form-specs.1
     (buffer-sexpr wished-form-specs)
     ""
-    '(("(defmethod *HERE*)" (("defmethod")))
-      ("(cerror foo *HERE*)" (("cerror" "foo"))))
+    '(("(defun *HERE*"           (("defun")))
+      ("(defun foo *HERE*"       (("defun")))
+      ("(defun foo (x y) *HERE*" (("defun")))
+      ("(defmethod *HERE*)"      (("defmethod")))
+      ("(defmethod foo *HERE*)"  (("defmethod" "foo")))
+      ("(cerror foo *HERE*)"     (("cerror" "foo"))))
   (slime-check-top-level)
   (with-temp-buffer
     (let ((tmpbuf (current-buffer)))





More information about the slime-cvs mailing list