Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common Lisp REPL state not entirely persistent #489

Closed
trev-dev opened this issue May 8, 2023 · 7 comments
Closed

Common Lisp REPL state not entirely persistent #489

trev-dev opened this issue May 8, 2023 · 7 comments
Labels
bug Something isn't working client-commonlisp

Comments

@trev-dev
Copy link

trev-dev commented May 8, 2023

This may be a niche issue, but I have been unable to to call (in-package) and expect the REPL to stay latched onto the package/image I want to evaluate and change at runtime.

In this case I'm speaking about swank running in a StumpWM instance. I can call (in-package :stumpwm) with conjure and I get a positive REPL response of #<PACKAGE "STUMPWM">. Subsequent evaluations of variables an functions that should be defined in the stump image are not.

However, buffer-local evaluations lead me to think that the CL-USER runtime is where the state ends up going, as re-defined variables and functions seem to persist.

I am able to get a working common lisp REPL running with Vlime, which works entirely. It may serve as a good point of reference.

Should I get better at this I will try to contribute. If anyone's able to reproduce this with other packages, I'd be curious to know

@Olical Olical added bug Something isn't working client-commonlisp labels May 12, 2023
@mjcurciojr
Copy link

Also experiencing this issue, and it appears to be similar, if not identical to the issue mentioned in #310, which was resolved last year. Could this be a regression of sorts?

@russtoku
Copy link
Contributor

russtoku commented Jul 17, 2023

@trev-dev
A work-around that you can use today is to have a (defpackage :stumpwm) form at the top of your buffer. Then subsequent evaluation of variables and functions will be in your STUMPWM package.

Looking at the code for the Conjure Common Lisp client and evaluating some forms in two lisp buffers, I noticed:

  • All evaluations are based on the defpackage form it sees in the top portion of the current buffer.
  • The defpackage form can be commented out and the client will still recognize it.
  • When you change to another buffer with a different defpackage form, evaluations will occur in that package.
  • Without a defpackage form, the default package is COMMON-LISP-USER.
  • Evaluating an in-packge form won't change the package that things are evaluated.
  • This behavior was implemented by the fix for issue in-package not working for common lisp #310.
  • Prior to that fix, all evaluations were done in the CL-USER package.

Is this the desired or expected behavior?

An in-package form should set the current package that all subsequent evaluations occur in regardless of a previous defpackage form.

Should this be per lisp buffer?

@russtoku
Copy link
Contributor

russtoku commented Mar 1, 2024

See #557

@russtoku
Copy link
Contributor

russtoku commented Mar 2, 2024

@russtoku wrote:

Is this the desired or expected behavior?

An in-package form should set the current package that all subsequent evaluations occur in regardless of a previous defpackage form.

I think that it should be the nearest preceeding in-package form from the form or item being evaluated. I've put a comment regarding this on the discussion #557.

See also #561

@Olical
Copy link
Owner

Olical commented Mar 11, 2024

I've added support for exactly what @russtoku describes, let me know what you think!

@Olical Olical closed this as completed Mar 22, 2024
@Olical
Copy link
Owner

Olical commented Mar 22, 2024

I think this is fixed!?

@trev-dev
Copy link
Author

Hey, @Olical - apologies - and thanks! I appreciate the fix. I haven't had a chance to mess with CL but I will confirm later next week and let you know if there are any challenges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client-commonlisp
Projects
None yet
Development

No branches or pull requests

4 participants