[slime-devel] Re: [Patch] Fix for out-of-range error when macroexpanding in-place

Tobias C. Rittweiler tcr at freebits.de
Fri May 26 20:11:49 UTC 2006


"Tobias C. Rittweiler" <tcr at freebits.de> writes:

> 2006-06-26  Tobias C. Rittweiler <PUT-MY-ADDRESS-HERE>
> 	
> 	* slime.el (slime-eval-macroexpand-inplace): Fix out-of-range
> 	error on in-place macroexpand when point is placed at a closing
> 	parenthesis. In this case the sexp closed by that paren is
> 	expanded.  
> 	Also make expanding of expressions work that are quoted like, for
> 	instance, "'(FOO BAR)" if point is placed at the opening paren.
>
> --- slime.el-old	2006-05-26 19:44:07.000000000 +0200
> +++ slime.el	2006-05-26 21:42:31.000000000 +0200
> @@ -7378,10 +7378,17 @@
>  NB: Does not affect *slime-eval-macroexpand-expression*"
>    (interactive)
>    (lexical-let* ((string (slime-sexp-at-point-or-error))
> +                 (bounds (bounds-of-thing-at-point 'sexp))
> +                 (start (car bounds))
> +                 (end (cdr bounds))
> +                 (point (point))
>                   (package (slime-current-package))
> -                 (start (point))
> -                 (end (+ start (length string)))
>                   (buffer (current-buffer)))
> +    ;; SLIME-SEXP-AT-POINT returns "'(FOO BAR BAZ)" even when point is
> +    ;; placed at the opening parenthesis, which wouldn't get expanded
> +    ;; even though FOO was a macro. Hence this workaround:
> +    (when (and (eq ?\' (elt string 0)) (eq ?\( (elt string 1)))
> +      (setf string (substring string 1)) (incf start)
                                            ^^^^^^^^^^^^^
Here's a closing parenthesis missing. Whoops.

  -T.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: slime-inplace-expansion-range-fix.diff
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20060526/8d86fb02/attachment.ksh>


More information about the slime-devel mailing list