GithubHelp home page GithubHelp logo

Comments (8)

expez avatar expez commented on July 29, 2024

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.

robert-stuttaford avatar robert-stuttaford commented on July 29, 2024

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.

benedekfazekas avatar benedekfazekas commented on July 29, 2024

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.

expez avatar expez commented on July 29, 2024

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.

robert-stuttaford avatar robert-stuttaford commented on July 29, 2024

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.

benedekfazekas avatar benedekfazekas commented on July 29, 2024

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.

expez avatar expez commented on July 29, 2024

@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.

robert-stuttaford avatar robert-stuttaford commented on July 29, 2024

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)

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.