Fork me on GitHub
#cider
<
2020-04-12
>
didibus02:04:57

@bozhidar Question about Emacs, what's the standard way to extend the auto-complete?

bozhidar08:04:27

Do you mean company mode or completion-at-point?

didibus17:04:02

I think I was asking a bit about that choice. Do I have to pick a backend, like go with company, auto-complete or completion.el. There's not a way to create generic completion that all of them would be able to leverage?

Gleb Posobin02:04:43

How do you deal with environmental variables? Some of my code uses them, and I want them to be available in repl. I can set them in my .zshenv file, it gets picked up by the repl, but it's not the best solution since I want to save the environmental variables per project. Also I don't want some of them (like api keys) to get under source control.

bozhidar08:04:28

It was discussed a few times to add provisions to CIDER about them, but we never got to doing so. I’m guessing one simple solution to prepend them to the jack-in command.

bozhidar08:04:11

And also https://www.gnu.org/software/emacs/manual/html_node/elisp/System-Environment.html I’m guessing you can just set process-environment via .dir-locals.el.

Jim Newton08:04:16

Can someone describe the refactoring process using cider? I have a project which I originally created with lein. Even though I'm not ready to announce it publically I would appreciate if someone could explain how to perform the refactoring. Currently all the functions are defined in one file, and I'd like to split them among different files, grouping functions together which work together.

Jim Newton08:04:47

For example, suppose all the functions have been loaded into VM, and I can run the tests at the cider repl. What do I need to do to move a function from one file to another?

Jim Newton09:04:15

One error that I get when i try this is the following:

jumar09:04:17

That looks like an aliasing issue in the test ns. You need either unalias, refresh (tools.namespace) or restart repl

jumar09:04:21

clj-refactor has some tools to move symbols but I’m not sure if it helps with this

Jim Newton09:04:16

clj-refactor unfortunatly does not help. Those functions are broken. I've created an issue in github, and they're working on the issues.

Jim Newton09:04:49

Are you suggesting that to move a function from one file to another I need to restart the repl?

Jim Newton09:04:07

Please tell me what you mean by unalias. I don't know what that is nor how to use it.

Jim Newton09:04:09

Is there a cider way to do the unalias? e.g. point to the offending symbol in the stacktrace and exec an emacs function ???

Jim Newton09:04:18

BTW, how should I restart the repl? In slime, there is the emacs function slime-restart-inferior-lisp ...

Jim Newton09:04:57

I don't find the function cider-jack-out which one might guess generalizing from cider-jack-in

jumar13:04:26

ns-unalias function

Jim Newton09:04:37

I get this error when trying to move several function definitions from file core.clj whose namespace is

(ns clojure-rte.core
  (:require [clojure.set :refer [union intersection]]
            [clojure.pprint :refer [cl-format]]
            [clojure-rte.cl-compat :refer [cl-cond cl-prog1 cl-prog2 cl-progn]]
            )
  (:gen-class))
to file rte_tester.clj whose name space is
(ns clojure-rte.rte-tester
  (:require [clojure-rte.tester :refer [simplify random-test]]
            [clojure-rte.core :refer []]
            ))

Jim Newton09:04:34

How should I restart the repl?  In slime, there is the emacs function `slime-restart-inferior-lisp` ...

Jim Newton09:04:41

I don't find the function `cider-jack-out` which one might guess generalizing from `cider-jack-in`

practicalli-johnny09:04:25

@jimka.issy I find most cider commands easily discoverable with M-x cider if you have a completion framework like helm or ivy (`SPC SPC cider` in Spacemacs) • To unevaluate a function, cider-undef • To refresh the namespace, cider-ns-refresh • To restart the repl, cider-restat or cider-quit followed by ckder-jack-in I use comment sections when I am developing code that groups my code logically, making it quite obvious when to split code off to another namespace. If doing just one function I will use cider-undef , if multiple functions I'll just restart my repl and evaluate the main namespace cider-eval-buffer , as this then helps check I have put all the definitions in order (as Clojure is a one pass parser, so def, defn should be used before using those names)

practicalli-johnny09:04:59

I am more used to using the Emacs tools to refactor code now, https://practicalli.github.io/spacemacs/refactor/ as I can use them across multiple languages

Jim Newton09:04:35

I don't find cider-def when I type that in the M-x minibuffer I see the following.

practicalli-johnny09:04:34

sorry, typo. updated the original post

Jim Newton10:04:15

that helps. thanks.

Jim Newton10:04:24

ouch! it's painful

Jim Newton10:04:01

Is there an idiomatic name to name a local function whose purpose it is to do a recursion similar to loop/recur ?

practicalli-johnny10:04:44

seems like a question best asked in the #beginners channel 🙂

Jim Newton10:04:12

oops sorry.. yes I clicked the wrong channel.... 100x excuse

👍 4