[slime-cvs] CVS slime
trittweiler
trittweiler at common-lisp.net
Tue Aug 28 20:44:48 UTC 2007
Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv22252
Modified Files:
swank.lisp slime.el ChangeLog
Log Message:
* slime.el (slime-make-form-spec-from-string): Elisp Hacking 101:
Don't use `beginning-of-buffer' and `end-of-buffer' in Elisp code.
* swank.lisp (read-form-spec): Unintern just newly interned
symbols when an reader error occurs.
--- /project/slime/cvsroot/slime/swank.lisp 2007/08/28 13:53:02 1.503
+++ /project/slime/cvsroot/slime/swank.lisp 2007/08/28 20:44:41 1.504
@@ -1678,28 +1678,32 @@
(with-buffer-syntax ()
(call-with-ignored-reader-errors
#'(lambda ()
- (let ((result) (newly-interned-symbols))
- (dolist (element spec)
- (etypecase element
- (string
- (multiple-value-bind (symbol found? symbol-name package)
- (parse-symbol element)
- (if found?
- (push symbol result)
- (let ((sexp (read-from-string element)))
- (when (symbolp sexp)
- (push sexp newly-interned-symbols)
- ;; assert that PARSE-SYMBOL didn't parse incorrectly.
- (assert (and (equal symbol-name (symbol-name sexp))
- (eq package (symbol-package sexp)))))
- (push sexp result)))))
- (cons
- (multiple-value-bind (read-spec interned-symbols)
- (read-form-spec element)
- (push read-spec result)
- (setf newly-interned-symbols
- (append interned-symbols
- newly-interned-symbols))))))
+ (let ((result) (newly-interned-symbols) (ok))
+ (unwind-protect
+ (progn
+ (dolist (element spec)
+ (etypecase element
+ (string
+ (multiple-value-bind (symbol found? symbol-name package)
+ (parse-symbol element)
+ (if found?
+ (push symbol result)
+ (let ((sexp (read-from-string element)))
+ (when (symbolp sexp)
+ (push sexp newly-interned-symbols)
+ ;; assert that PARSE-SYMBOL didn't parse incorrectly.
+ (assert (and (equal symbol-name (symbol-name sexp))
+ (eq package (symbol-package sexp)))))
+ (push sexp result)))))
+ (cons
+ (multiple-value-bind (read-spec interned-symbols)
+ (read-form-spec element)
+ (push read-spec result)
+ (setf newly-interned-symbols
+ (append interned-symbols
+ newly-interned-symbols))))))
+ (setq ok t))
+ (mapc #'unintern newly-interned-symbols))
(values (nreverse result)
(nreverse newly-interned-symbols))))))))
--- /project/slime/cvsroot/slime/slime.el 2007/08/28 14:38:05 1.832
+++ /project/slime/cvsroot/slime/slime.el 2007/08/28 20:44:42 1.833
@@ -9896,7 +9896,7 @@
parsing, and are then returned back as multiple values."
;; OPS, INDICES and POINTS are like the finally returned values of
;; SLIME-ENCLOSING-FORM-SPECS except that they're in reversed order,
- ;; i.e. the leftmost operator (that is the latest) operator comes
+ ;; i.e. the leftmost (that is the latest) operator comes
;; first.
(save-excursion
(ignore-errors
@@ -10005,20 +10005,20 @@
(erase-buffer)
(insert string)
(when strip-operator-p
- (beginning-of-buffer)
+ (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 "(")))
- (end-of-buffer) (backward-char 1) ; for `slime-enclosing-form-specs'
+ (goto-char (1- (point-max))) ; for `slime-enclosing-form-specs'
(multiple-value-bind (forms indices points)
(slime-enclosing-form-specs 1)
(if (null forms)
string
(progn
- (beginning-of-buffer) (forward-char 1)
+ (goto-char (1+ (point-min)))
(mapcar #'(lambda (s)
(assert (not (equal s string)))
(slime-make-form-spec-from-string s temp-buffer))
@@ -10072,54 +10072,54 @@
;; do not need them in navigating through the nested lists.
;; This speeds up this function significantly.
(ignore-errors
- (save-excursion
- ;; Make sure we get the whole operator name.
- (slime-end-of-symbol)
- (save-restriction
- ;; Don't parse more than 20000 characters before point, so we don't spend
- ;; too much time.
- (narrow-to-region (max (point-min) (- (point) 20000)) (point-max))
- (narrow-to-region (save-excursion (beginning-of-defun) (point))
- (min (1+ (point)) (point-max)))
- (while (or (not max-levels)
- (<= level max-levels))
- (let ((arg-index 0))
- ;; Move to the beginning of the current sexp if not already there.
- (if (or (and (char-after)
- (member (char-syntax (char-after)) '(?\( ?')))
- (member (char-syntax (char-before)) '(?\ ?>)))
- (incf arg-index))
- (ignore-errors (backward-sexp 1))
- (while (and (< arg-index 64)
- (ignore-errors (backward-sexp 1)
- (> (point) (point-min))))
+ (save-excursion
+ ;; Make sure we get the whole operator name.
+ (slime-end-of-symbol)
+ (save-restriction
+ ;; Don't parse more than 20000 characters before point, so we don't spend
+ ;; too much time.
+ (narrow-to-region (max (point-min) (- (point) 20000)) (point-max))
+ (narrow-to-region (save-excursion (beginning-of-defun) (point))
+ (min (1+ (point)) (point-max)))
+ (while (or (not max-levels)
+ (<= level max-levels))
+ (let ((arg-index 0))
+ ;; Move to the beginning of the current sexp if not already there.
+ (if (or (and (char-after)
+ (member (char-syntax (char-after)) '(?\( ?')))
+ (member (char-syntax (char-before)) '(?\ ?>)))
(incf arg-index))
- (backward-up-list 1)
- (when (member (char-syntax (char-after)) '(?\( ?'))
- (incf level)
- (forward-char 1)
- (let ((name (slime-symbol-name-at-point)))
- (cond
- (name
- (save-restriction
- (widen) ; to allow looking-ahead/back in extended parsing.
- (multiple-value-bind (new-result new-indices new-points)
- (slime-parse-extended-operator-name initial-point
- (cons `(,name) result) ; minimal form spec
- (cons arg-index arg-indices)
- (cons (point) points))
- (setq result new-result)
- (setq arg-indices new-indices)
- (setq points new-points))))
- (t
- (push nil result)
- (push arg-index arg-indices)
- (push (point) points))))
- (backward-up-list 1)))))))
- (values
- (nreverse result)
- (nreverse arg-indices)
- (nreverse points))))
+ (ignore-errors (backward-sexp 1))
+ (while (and (< arg-index 64)
+ (ignore-errors (backward-sexp 1)
+ (> (point) (point-min))))
+ (incf arg-index))
+ (backward-up-list 1)
+ (when (member (char-syntax (char-after)) '(?\( ?'))
+ (incf level)
+ (forward-char 1)
+ (let ((name (slime-symbol-name-at-point)))
+ (cond
+ (name
+ (save-restriction
+ (widen) ; to allow looking-ahead/back in extended parsing.
+ (multiple-value-bind (new-result new-indices new-points)
+ (slime-parse-extended-operator-name initial-point
+ (cons `(,name) result) ; minimal form spec
+ (cons arg-index arg-indices)
+ (cons (point) points))
+ (setq result new-result)
+ (setq arg-indices new-indices)
+ (setq points new-points))))
+ (t
+ (push nil result)
+ (push arg-index arg-indices)
+ (push (point) points))))
+ (backward-up-list 1)))))))
+ (values
+ (nreverse result)
+ (nreverse arg-indices)
+ (nreverse points))))
;;;; Portability library
--- /project/slime/cvsroot/slime/ChangeLog 2007/08/28 14:38:05 1.1179
+++ /project/slime/cvsroot/slime/ChangeLog 2007/08/28 20:44:43 1.1180
@@ -1,3 +1,11 @@
+2007-08-28 Tobias C. Rittweiler <tcr at freebits.de>
+
+ * slime.el (slime-make-form-spec-from-string): Elisp Hacking 101:
+ Don't use `beginning-of-buffer' and `end-of-buffer' in Elisp code.
+
+ * swank.lisp (read-form-spec): Unintern just newly interned
+ symbols when an reader error occurs.
+
2007-08-28 Helmut Eller <heller at common-lisp.net>
Move presentations to contrib. Part II.
More information about the slime-cvs
mailing list