* mbaringer [2008-02-05 13:06+0100] writes:
(save-excursion (when (or (re-search-backward regexp nil t) (re-search-forward regexp nil t))
(match-string-no-properties 2)))))
;; package name can be a string designator, convert it to a string.
(slime-eval `(cl:string (cl:second (cl:read-from-string ,(match-string-no-properties 0))))
"COMMON-LISP-USER")))))
This is bad style for several reasons:
1. slime-eval should only be used in situations where it's impossible to use slime-eval-async e.g. for completion because the control structure is fixed by Emacs built-ins.
2. the argument to slime-eval should look like (swank:function arg1 arg2 ..) where each argument is a literal and not a to-be-evaluated form
3. it uses more than 80 columns
4. it makes a frequently used function much slower
5. it doesn't handle read-errors
6. it interns random symbols
7. it does useless work, because the result of slime-search-buffer-package will be used either with guess-package or slime-pretty-package-name.
That's quite a lot for a two line change :-)
Helmut.
Helmut Eller heller@common-lisp.net writes:
- mbaringer [2008-02-05 13:06+0100] writes:
(save-excursion (when (or (re-search-backward regexp nil t) (re-search-forward regexp nil t))
(match-string-no-properties 2)))))
;; package name can be a string designator, convert it to a string.
(slime-eval `(cl:string (cl:second (cl:read-from-string ,(match-string-no-properties 0))))
"COMMON-LISP-USER")))))
This is bad style for several reasons:
for reasons 1, 4 and5 i've already dropped it (though the other reason are pretty good too...)
slime-eval should only be used in situations where it's impossible to use slime-eval-async e.g. for completion because the control structure is fixed by Emacs built-ins.
the argument to slime-eval should look like (swank:function arg1 arg2 ..) where each argument is a literal and not a to-be-evaluated form
it uses more than 80 columns
it makes a frequently used function much slower
it doesn't handle read-errors
it interns random symbols
it does useless work, because the result of slime-search-buffer-package will be used either with guess-package or slime-pretty-package-name.
well, being able to handle (in-package #+foo foo #+bar other-foo) was nice but not worth it.