Hi Tobias,
I noticed that slime-complete-form is broken in SLIME CVS. Since you did the most recent changes to arglist-related parsing, I hope you can fix it.
Create this Lisp buffer: --------------------------------------------------------- (defun
(defun foo (a) a) ---------------------------------------------------------
Then move point after the first "defun" and press C-c C-s.
SLIME now inserts "varlist body...)" and then signals "Wrong type argument: stringp, nil".
It should have inserted "name varlist body...)" instead (it should also not signal an error).
Apparently the "defun foo" form is taken as an actual argument to the first "defun" form and consumes the formal argument "name". This is wrong. For slime-complete-form, the parser should ignore everything that is beyond the token around point, as in earlier versions of the code (I remark it is NOT sufficient to just stop before the next top-level expression).
The wrong-type-arg error is occuring in code related to the automatic closing of parens.
Thanks, Matthias
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
Hi Tobias,
I noticed that slime-complete-form is broken in SLIME CVS. Since you did the most recent changes to arglist-related parsing, I hope you can fix it.
Create this Lisp buffer:
(defun
(defun foo (a) a)
Then move point after the first "defun" and press C-c C-s.
SLIME now inserts "varlist body...)" and then signals "Wrong type argument: stringp, nil".
It should have inserted "name varlist body...)" instead (it should also not signal an error).
I couldn't reproduce the error. The bogus behaviour should be fixed in CVS. I'd be interested in seeing a backtrace nontheless, though.
Apparently the "defun foo" form is taken as an actual argument to the first "defun" form and consumes the formal argument "name". This is wrong. For slime-complete-form, the parser should ignore everything that is beyond the token around point, as in earlier versions of the code (I remark it is NOT sufficient to just stop before the next top-level expression).
Right!
Thanks for spotting this,
-T.
"Tobias C. Rittweiler" tcr@freebits.de writes:
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
I noticed that slime-complete-form is broken in SLIME CVS.
The bogus behaviour should be fixed in CVS.
Now this: -------------------- (defun <C-c C-s>
(defun foo () 1) -------------------- causes this error:
Debugger entered--Lisp error: (cl-assertion-failed (<= (point) user-point)) signal(cl-assertion-failed ((<= (point) user-point))) (or (<= (point) user-point) (signal (quote cl-assertion-failed) (list ...))) (progn (or (<= ... user-point) (signal ... ...)) nil) (assert (<= (point) user-point)) (let ((full-sexps ...)) (forward-sexp arg-index) (slime-forward-blanks) (assert (<= ... user-point)) (let (...) (if ... full-sexps ...))) (save-excursion (goto-char op-start) (let (...) (forward-sexp arg-index) (slime-forward-blanks) (assert ...) (let ... ...))) (let ((user-point ...)) (save-excursion (goto-char op-start) (let ... ... ... ... ...))) (cond ((eql op-100273 ...) (destructuring-bind ... rand-100274 op)) ((eql op-100273 ...) (destructuring-bind ... rand-100274 op)) (t (let ... ...))) (case op-100273 (:declaration (destructuring-bind ... rand-100274 op)) (:type-specifier (destructuring-bind ... rand-100274 op)) (t (let ... ...))) (let* ((tmp-100275 ...) (op-100273 ...) (rand-100274 ...)) (case op-100273 (:declaration ...) (:type-specifier ...) (t ...))) (destructure-case (slime-ensure-list op) ((:declaration declspec) op) ((:type-specifier typespec) op) (t (let ... ...))) (let ((op ...) (op-start ...) (arg-index ...)) (destructure-case (slime-ensure-list op) (... op) (... op) (t ...))) (if (null operators) "" (let (... ... ...) (destructure-case ... ... ... ...))) (let* ((G100271 ...) (operators ...) (arg-indices ...) (points ...)) (if (null operators) "" (let ... ...))) (multiple-value-bind (operators arg-indices points) (slime-enclosing-form-specs) (if (null operators) "" (let ... ...))) slime-incomplete-form-at-point() (let ((form-string ...)) (let (...) (if ... ... ...))) slime-complete-form() * call-interactively(slime-complete-form)
I'd be interested in seeing a backtrace nontheless, though.
Using this (note: one space fewer): -------------------- (defun<C-c C-s>
(defun foo () 1) -------------------- I get the error that I mentioned:
Debugger entered--Lisp error: (wrong-type-argument stringp nil) substring-no-properties(nil) (let* ((deleted-region ...) (deleted-text ...) (prior-parens-count ...)) (when slime-close-parens-limit (let ... ...))) (progn (goto-char point) (dotimes (i sexp-level) (insert ")")) (setq point (point)) (skip-chars-forward " \n)") (skip-chars-backward " \n") (let* (... ... ...) (when slime-close-parens-limit ...))) (if (> sexp-level 0) (progn (goto-char point) (dotimes ... ...) (setq point ...) (skip-chars-forward " \n)") (skip-chars-backward " \n") (let* ... ...))) (when (> sexp-level 0) (goto-char point) (dotimes (i sexp-level) (insert ")")) (setq point (point)) (skip-chars-forward " \n)") (skip-chars-backward " \n") (let* (... ... ...) (when slime-close-parens-limit ...))) (let ((sexp-level 0) point) (save-excursion (save-restriction ... ... ... ... ...)) (when (> sexp-level 0) (goto-char point) (dotimes ... ...) (setq point ...) (skip-chars-forward " \n)") (skip-chars-backward " \n") (let* ... ...))) slime-close-all-parens-in-sexp() (let ((slime-close-parens-limit 1)) (slime-close-all-parens-in-sexp)) (save-excursion (insert (substring result 0 -1)) (let (...) (slime-close-all-parens-in-sexp))) (progn (just-one-space) (save-excursion (insert ...) (let ... ...)) (save-excursion (backward-up-list 1) (indent-sexp))) (if (eq result :not-available) (error "Could not generate completion for the form `%s'" form-string) (progn (just-one-space) (save-excursion ... ...) (save-excursion ... ...))) (let ((result ...)) (if (eq result :not-available) (error "Could not generate completion for the form `%s'" form-string) (progn ... ... ...))) (let ((form-string ...)) (let (...) (if ... ... ...))) slime-complete-form() * call-interactively(slime-complete-form)
(This one is on a strange old unreleased version of Emacs, though, 21.3.50)
Thanks, Matthias
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
Using this (note: one space fewer):
(defun<C-c C-s>
(defun foo ()
I get the error that I mentioned:
Debugger entered--Lisp error: (wrong-type-argument stringp nil) substring-no-properties(nil) (let* ((deleted-region ...) (deleted-text ...) (prior-parens-count ...)) (when slime-close-parens-limit (let ... ...))) ...
(This one is on a strange old unreleased version of Emacs, though, 21.3.50)
What does (delete-and-extract-region (point) (point)) return on that Emacs?
-T
PS: I've committed a better fix which I hope fixes the other error you posted.
"Tobias C. Rittweiler" tcr@freebits.de writes:
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
(This one is on a strange old unreleased version of Emacs, though, 21.3.50)
What does (delete-and-extract-region (point) (point)) return on that Emacs?
nil.
PS: I've committed a better fix which I hope fixes the other error you posted.
Looks OK now, thanks.
Matthias
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
"Tobias C. Rittweiler" tcr@freebits.de writes:
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
(This one is on a strange old unreleased version of Emacs, though, 21.3.50)
What does (delete-and-extract-region (point) (point)) return on that Emacs?
nil.
Ok, that should return "", actually. I've checked in a portable version of that function named `slime-delete-and-extract-region'. Please try if that fixes it for you.
-T.
"Tobias C. Rittweiler" tcr@freebits.de writes:
I've checked in a portable version of that function named `slime-delete-and-extract-region'. Please try if that fixes it for you.
Thanks, it works now.
Another bug: (find 1 '(1 2 3) <C-c C-s>
Debugger entered--Lisp error: (cl-assertion-failed (not (equal s string))) signal(cl-assertion-failed ((not (equal s string)))) (or (not (equal s string)) (signal (quote cl-assertion-failed) (list ...))) (progn (or (not ...) (signal ... ...)) nil) (assert (not (equal s string))) (lambda (s) (assert (not ...)) (slime-make-form-spec-from-string s))("'(1 2 3)") [...]
Matthias
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
Another bug: (find 1 '(1 2 3) <C-c C-s>
Debugger entered--Lisp error: (cl-assertion-failed (not (equal s string)))
Should work now!
-T.
"Tobias C. Rittweiler" tcr@freebits.de writes:
Matthias Koeppe mkoeppe+slime@mail.math.uni-magdeburg.de writes:
Another bug: (find 1 '(1 2 3) <C-c C-s>
Debugger entered--Lisp error: (cl-assertion-failed (not (equal s string)))
Should work now!
It does, thanks.
Matthias