Skip to content

Editor integration #1

@monkeysees

Description

@monkeysees

First of all, I want to say thank you for this library, I use it all the time.

I'm wondering if you'd be open to add editor integrations for it.

I remember you sharing with me the following Emacs helpers a while ago:

(defun clj-insert-persist-scope-macro ()
  (interactive)
  (insert
   "(defmacro persist-scope
              \"Takes local scope vars and defines them in the global scope. Useful for RDD\"
              []
              `(do ~@(map (fn [v] `(def ~v ~v))
                  (keys (cond-> &env (contains? &env :locals) :locals)))))"))

(defun persist-scope ()
  (interactive)
  (let ((beg (point)))
    (clj-insert-persist-scope-macro)
    (cider-eval-region beg (point))
    (delete-region beg (point))
    ;; If emacs is slow, it may start evaluating function at point
    ;; before macro is evaluated and deleted.
    (sleep-for 0 10)
    (insert "(persist-scope)")
    (cider-eval-defun-at-point)
    (delete-region beg (point))))

(defun unpersist-scope ()
  (interactive)
  (let ((beg (point)))
    (insert "(remove-ns (.getName *ns*))")
    (cider-eval-region beg (point))
    (delete-region beg (point))
    (cider-eval-buffer)))

I think it'd be nice to put them into an Elisp package so that people have easier time using them. I think something similar can be done for VS Code as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions