"Tobias C. Rittweiler" tcr@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.
--- slime.el-old 2006-05-26 19:44:07.000000000 +0200 +++ slime.el 2006-05-26 22:10:23.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)) (slime-eval-async `(,expander ,string) (lambda (expansion) @@ -7393,7 +7400,8 @@ (delete-region start end) (insert expansion) (goto-char start) - (indent-sexp))))))) + (indent-sexp) + (goto-char point)))))))
(defun slime-macroexpand-1 (&optional repeatedly) "Display the macro expansion of the form at point. The form is