A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/clojure-emacs/cider/issues/3754 below:

`cider-ns-form-p` produces false positive when the form contains namespace-like string. · Issue #3754 · clojure-emacs/cider · GitHub

Hi, while working on https://github.com/scicloj/clay (we have Clojure file parser tests there) I hit a problem, so

I have code like this in a file

(ns wtf)

(def foo
  "
(ns bar)
"
  )
Expected behavior

foo evals to #'wtf/foo

Actual behavior

#'user/foo

Steps to reproduce the problem

put the code above into a file, start repl, eval it in cider

Environment & Version information CIDER version information
;; CIDER 1.16.0 (Kherson), babashka.nrepl 0.0.6-SNAPSHOT
;; Babashka 1.3.191
Lein / Clojure CLI version

Babashka 1.3.191

Emacs version

29.4

Operating system

Ubuntu 22.04

JDK distribution

Babashka 1.3.191

The problems is the regex used in cider-ns-form-p - "^[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" treats namespace in a string as a real namespace, so cider-interactive-eval evals it in user namespace instead of the current one.

I tried to fix it by myself but unfortunately, Emacs regexes don't support look ahead, so probably we should discuss the way it should be fixed.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4