Comments (8)
There's currently no support for cljs. rr
tears down the require form and the rebuilds it, without any knowledge of what :refer-macros
does. This might be easy to fix. Pull requests are most welcome, if you want to take a look?
from clj-refactor.el.
Ok. I'll see if I can figure it out.
I disagree with 'no support for cljs' - but for this one issue of not understanding :require-macros
and :refer-macros
, it's actually very well supported :-)
from clj-refactor.el.
well clj-refactor.el understands your code on a 'paredit' level. so in a sense it 'understands' cljs too. ;)
I'll have a look into this if I have time but as @expez said it should not be too hard so PR is very wlc...
from clj-refactor.el.
I didn't mean that cljs is out of scope for clj-refactor, it's just not working atm and nobody has shown any interest in fixing that situation.
from clj-refactor.el.
I don't even know enough elisp to be dangerous, but am I correct that we'd simply need to add cases for :include-macros
and :refer-macros
to the (if)
form on the fourth line, here?
(defun cljr--rectify-req-statement (require-as-list)
(save-excursion
(let ((sexp-as-list (-flatten (-map (lambda (sexp) (split-string sexp)) require-as-list))))
(if (or (= 1 (safe-length sexp-as-list))
(string= ":refer" (nth 1 sexp-as-list))
(string= ":as" (nth 1 sexp-as-list)))
(cljr--rectify-simple-req-statement (s-join " " require-as-list) sexp-as-list)
(cljr--rectify-prefix-list-req-statement require-as-list)))))
https://github.com/clojure-emacs/clj-refactor.el/blob/master/clj-refactor.el#L564
from clj-refactor.el.
hm.. definitely this needs to change. but also have a look on cljr--rectify-simple-req-statement
and cljr--rectify-refer-type-require
don't be frightened, good old TDD can save you: if you want to play with this write an ecukes test first (see readme how to run them, see the already existing tests) that will help you a lot ;)
from clj-refactor.el.
@robert-stuttaford what I've found to be very helpful when working with emacs code is to step through the code in the debugger. To load new elisp into emacs you can use C-x C-e
(with point after the function definition), but with a prefix C-u C-x C-e
you also activate the debugger for that function. When you call the function you'll now see the function stepped through in one window, and in the other window you'll be watching as the target buffer is changed while the function in question does it's work!
Learning enough elisp to be able to customize your working environment, and tweak your workflow, is incredibly liberating. Another tip, if you go down this road: everyone in #emacs
(or #clojure-emacs
) on freenode will be so incredibly helpful that you can't help but wonder if they mistook your retarded question for the final piece in the cure for cancer.
from clj-refactor.el.
Ok. I will have a go at fixing the code up.
I genuinely laughed out loud at your last sentence, @expez :-) Thank you for that!
from clj-refactor.el.
Related Issues (20)
- cljr-clean-ns erroneously removes :as-alias in clj namespaces HOT 1
- Document (or remove) pkg-info dependency HOT 6
- `cljr-sort-project-dependencies` drop :dependencies section when using managed-dependencies HOT 2
- cljr-slash magic require js/ behavior is determined by file type, not language context HOT 2
- cljr--ns-alias-at-point does not handle quasiquote, sharp-quote and dotted aliases HOT 1
- Combine cljs and clj namespace alias candidates for magic requires HOT 15
- Ability to specify context in `cljr-magic-require-namespaces` HOT 4
- Create cljr-slash variant that uses the `suggest-libspecs` middleware op HOT 9
- `cljr--point-in-reader-conditional-branch-p` may block and is incorrect HOT 1
- Question: how to install `clj-refactor` via `use-package` declaration instead of imperative `package-install`? HOT 2
- Enhancement: trying to install and configure `clj-refactor` with the declarative `use-package` instead of imperative `package-install` HOT 1
- cljr-add-project-dependency throws `java.io.EOFException` HOT 6
- `cljr-rename-symbol` not working properly when narrowing is in effect HOT 2
- cljr-slash breaks whenever there's a Unicode character used as an alias in a codebase HOT 3
- cljr-add-project-dependency document support for deps.edn HOT 1
- Add Emacs 28, 29 to test matrix
- Add `eldev lint` to the CI
- Some refactorings are not working via TRAMP HOT 2
- Add support for updating :sha in :git/url dependencies HOT 3
- Error with suggest_libspecs HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clj-refactor.el.