I'm using Allegro CL on Linux in XEmacs using Franz's eli package.
I've got a a question about how to use it effectively that I'm hoping
someone here will be able to answer.
Say I've got two .lisp files "foo.lisp" and "test-foo.lisp". In
"foo.lisp" I've got the production code for my foo app. In
"test-foo.lisp" I've got the unit tests for foo. Each file has it's
own 'defpackage' (defining "FOO" and "TEST-FOO" respectively) and
'in-package'. But it seems that when I use C-c C-s
('fi:lisp-eval-or-compile-last-sexp') or C-c C-x
('fi:lisp-eval-or-compile-defun') the evaluation is done in whatever
package happens to be current in my top-level. Because I'm switching
back and forth between the two files, it would be a pain--it seems--to
keep switching the top-level's package.
If I use C-c C-b ('fi:lisp-eval-or-compile-current-buffer') it does
the right thing, packagewise, but then I get warnings about my
'defconstants' being redefined. (Plus it seems silly to recompile the
whole buffer--currently it's basically instantaneous but hopefully
I'll eventually have written enough code that it won't be.)
I assume I must be missing some usage pattern that will make this all
appropriately convenient. Any advice?
-Peter
--
Peter Seibel
·····@javamonkey.com
Peter Seibel wrote:
> I'm using Allegro CL on Linux in XEmacs using Franz's eli package.
> I've got a a question about how to use it effectively that I'm hoping
> someone here will be able to answer.
>
> Say I've got two .lisp files "foo.lisp" and "test-foo.lisp". In
> "foo.lisp" I've got the production code for my foo app. In
> "test-foo.lisp" I've got the unit tests for foo. Each file has it's
> own 'defpackage' (defining "FOO" and "TEST-FOO" respectively) and
> 'in-package'. But it seems that when I use C-c C-s
> ('fi:lisp-eval-or-compile-last-sexp') or C-c C-x
> ('fi:lisp-eval-or-compile-defun') the evaluation is done in whatever
> package happens to be current in my top-level. Because I'm switching
> back and forth between the two files, it would be a pain--it seems--to
> keep switching the top-level's package.
>
test-foo.lisp to my mind belongs in the foo package (even if i wasn't
being bothered by package-switching). that said...
under mcl there was a "mode line" which got picked up by some mechanism
I never grokked, so bouncing from source file to source file the Right
Thing happened in re packages. and with acl on win32, it does not even
need a mode line (and i still cannot tell you how it works). so that is
nice, and maybe others know of some way to achieve the same with your
particular set-up.
--
kenny tilton
clinisys, inc
---------------------------------------------------------------
""Well, I've wrestled with reality for thirty-five years, Doctor,
and I'm happy to state I finally won out over it.""
Elwood P. Dowd
Peter Seibel <·····@javamonkey.com> writes:
> I'm using Allegro CL on Linux in XEmacs using Franz's eli package.
> I've got a a question about how to use it effectively that I'm
> hoping someone here will be able to answer.
[snip question about eli detecting what package I'm in for purposes of
evals]
Ah, I figured out my problem. Because I had created these files in
this emacs session, they hadn't been loaded since I typed in the
'(in-package ...)' expression. Reloading the file (in emacs) caused it
to recognize the right package. I suppose I could get emacs to be
smart about recognizing that I just typed an in-package expression. Or
I can just C-x C-v my file after I've put it in a package.
-Peter
--
Peter Seibel
·····@javamonkey.com
* Peter Seibel
| Or I can just C-x C-v my file after I've put it in a package.
You actually want M-x normal-mode RET.
--
Erik Naggum, Oslo, Norway
Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.
Erik Naggum <····@naggum.no> writes:
> * Peter Seibel
> | Or I can just C-x C-v my file after I've put it in a package.
>
> You actually want M-x normal-mode RET.
Cool. Didn't know about that one. Thanks.
-Peter
Peter Seibel <·····@javamonkey.com> writes:
> Cool. Didn't know about that one. Thanks.
While normal-mode is ususally the Right Thing, there is also
fi:parse-mode-line-and-package:
Determine the current package in which the buffer is defined. The
buffer's IN-PACKAGE form and the -*- mode line are parsed for this
information. This function is automatically called when a Common
Lisp source file is visited, but may be executed explicitly to
re-parse the package.
--
Frode Vatvedt Fjeld