Skip to content

Unable to evaluate sexps in namespace with complicated metadata #2821

Closed
@n-hansen

Description

@n-hansen

Sexp evaluation seems to break in namespaces where the namespace symbol has metadata containing maps, e.g. (ns ^{:foo {:bar :baz}} foo).

Grepping around CIDER's codebase seems to indicate the problem lies in a call to the clojure-mode function clojure-find-ns, which just uses a big regex to find the ns name, and so fails with sufficiently-complicated datastructures.

Expected behavior

I should be able to evaluate individual forms in the namespace buffer when the namespace symbol is decorated with metadata containing nested maps.

Actual behavior

Evaluation fails with error Namespace ‘^{:foo’ not found..

Steps to reproduce the problem

  • Create a new clojure file foo.clj:
(ns ^{:foo {:bar :baz}} foo)
(println "eval me!")
  • Connect to a running REPL
  • Evaluate the buffer, then move cursor to the end of the buffer and run cider-eval-last-sexp.

Environment & Version information

CIDER version information

;; Connected to nREPL server - nrepl://localhost:7888
;; CIDER 0.25.0snapshot (package: 20200308.1030), nREPL 0.6.0
;; Clojure 1.10.1, Java 13.0.1

Lein/Boot version

N/A

Emacs version

GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.7.0, Carbon Version 158 AppKit 1671.6) of 2020-03-16

Operating system

OS X 10.14 "Mojave"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions