GithubHelp home page GithubHelp logo

Comments (6)

technomancy avatar technomancy commented on September 26, 2024

I found a few places (nrepl-interactive-eval and friends) that were checking nrepl-buffer-ns which was incorrectly set to "user"; replacing those references with a call to (nrepl-current-ns) fixed the problem, but I'm not sure if it's the correct solution; it's probably better to just ensure nrepl-buffer-ns is set correctly.

from cider.

jsnikeris avatar jsnikeris commented on September 26, 2024

If you add (setq nrepl-buffer-ns (nrepl-current-ns)) to nrepl-interaction-mode's definition, the namespace will be set correctly when you open an existing Clojure file.

However, I think we ought to do away with nrepl-buffer-ns altogether. The difficulty of correctly maintaining its state is not worth the benefit. Because nrepl-current-ns uses it as an optimization to prevent a call to clojure-find-ns, if you change the current buffer's namespace, even nrepl-current-ns will return an incorrect value.

from cider.

technomancy avatar technomancy commented on September 26, 2024

Yeah, makes sense to me.

from cider.

jsnikeris avatar jsnikeris commented on September 26, 2024

This is trickier than I thought.

nrepl-buffer-ns is sent to the nREPL server for the interactive-eval calls. Simply replacing it with a call to nrepl-current-ns will cause a NPE on the server side if the namespace has not yet been defined.

from cider.

jsnikeris avatar jsnikeris commented on September 26, 2024

The above pull request adds the functionality requested by Alexander.

I've come to accept that it makes sense to have an nrepl-buffer-ns variable. SLIME uses a similar variable. However, it is confusing to have both a variable and a function that are named similarly that serve slightly different purposes.

from cider.

kingtim avatar kingtim commented on September 26, 2024

Good point, probably nrepl-current-ns should be renamed.

from cider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.