Closed
Description
The new clojure-rename-ns-alias
refactoring introduced in #529 should only modify namespaced symbols/keywords, but the current regexp is too broad and could unintentionally match with things like filenames and slashes used in prose to indicate choices.
I'm not sure what the expected behaviour should be, perhaps a good idea would be to skip matching of strings but not comments, since strings found in source code don't generally refer to interned symbols (apart from references in docstrings where the full unaliased namespaces would be used)
Another option might be to delegate matching strings and comments to query-replace
so that such cases can be spotted and dealt with interactively.
Steps to reproduce the problem
(ns my.ns
(:require [my.lib :as lib]))
(def dirname "/usr/local/lib/python3.6/site-packages")
;; TODO: refactor using lib/foo
(def data (lib/baz dirname))
- Execute
M-x clojure-rename-ns-alias lib RET new-lib RET
Result (note the invalid directory name):
(ns my.ns
(:require [my.lib :as new-lib]))
(def dirname "/usr/local/new-lib/python3.6/site-packages")
;; TODO refactor using new-lib/foo
(def data (new-lib/baz dirname))
Environment & Version information
clojure-mode version information
clojure-mode (version 5.11.0-snapshot)
Emacs version
26.2
Operating system
macOS 10.14.5
Metadata
Metadata
Assignees
Labels
No labels