[slime-cvs] CVS slime/contrib
trittweiler
trittweiler at common-lisp.net
Tue Sep 11 17:04:17 UTC 2007
Update of /project/slime/cvsroot/slime/contrib
In directory clnet:/tmp/cvs-serv10590/contrib
Modified Files:
slime-parse.el
Log Message:
* slime-parse.el (slime-enclosing-form-specs): Now also works even
when point is inside a string.
(slime-inside-string-p): New function.
(slime-beginning-of-string): New function.
--- /project/slime/cvsroot/slime/contrib/slime-parse.el 2007/09/10 21:45:18 1.5
+++ /project/slime/cvsroot/slime/contrib/slime-parse.el 2007/09/11 17:04:17 1.6
@@ -299,8 +299,11 @@
;; This speeds up this function significantly.
(ignore-errors
(save-excursion
- ;; Make sure we get the whole operator name.
- (slime-end-of-symbol)
+ ;; Make sure we get the whole thing at point.
+ (if (not (slime-inside-string-p))
+ (slime-end-of-symbol)
+ (slime-beginning-of-string)
+ (forward-sexp))
(save-restriction
;; Don't parse more than 20000 characters before point, so we don't spend
;; too much time.
@@ -347,7 +350,22 @@
(nreverse arg-indices)
(nreverse points))))
+
(defun slime-ensure-list (thing)
(if (listp thing) thing (list thing)))
+(defun slime-inside-string-p ()
+ (let* ((toplevel-begin (first (slime-region-for-defun-at-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)))
+
+(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"))))
+
(provide 'slime-parse)
+
More information about the slime-cvs
mailing list