Fork me on GitHub
#cider
<
2017-05-09
>
dpsutton14:05:14

how was the experience? getting comfortable with the codebase, etc

dpsutton14:05:35

i'm trying to put together docs about how to get going so i'd love your feedback about what seemed confusing, what you would have saved you time, etc

ustunozgur14:05:16

Honestly, it was a trivial fix in this case, once I knew the problem. The part that took me time was figuring out the face that was being used, so initially I assumed there would be a cider variable for that. I tried cider-test-error-face etc to no avail. After I discovered it automatically configures itself according to theme, I just searched for enable-theme in the code-base and copy-pasted the relevant sections for disable-theme.

ustunozgur14:05:42

If I were to document the steps I used to achieve it, it would be as follows: 1- The background of the failing tests is ugly. 2- Discover which function is being called when I run the tests. 3- C-h k to discover the function is being called. C-c C-t n in this case for example calls cider-test-run-ns-tests 4- C-u M-x that function to first observe how it runs. 5- Find that it runs cider-test-render-assertion to render the assertions. 6- Find :background ,cider-test-items-background-color in that line. 7- Search for cider-test-items-background-color in the codebase. 8- Find that there are advice functions for setting cider-test-items-background-color on enable-theme. 9- Try the same advice with disable-theme. 10- Clone latest Cider. 11- Create a new branch and make the changes. 12- Add these lines so that it loads the github version, not the one from melpa. (add-to-list 'load-path "~/Github/cider") (require 'cider) 13- Verify the fix works after restarting emacs.

ustunozgur15:05:05

14- Create an issue. 15- Push the branch and create a PR. 16- Change the changelog to refer to the issue. (I had to do a push force here to squash my commits to one.)

uvtc17:05:37

Hi, #cider. I'd like to start using inf-clojure (on GNU/Linux, using lein, within a library project), but am missing a number of details about how to make it work. I have clojure-mode, clojure-mode-extra-font-locking, and inf-clojure installed. I've got Emacs running. I've got a terminal window open in my library project's directory. I can open emacsclient -nw src/john/data_util.clj in the terminal window, and running M-x inf-clojure splits the window and shows me that nREPL and REPL-y are both running, and I get a user=> prompt. I can (require '[john.data-util :as jdu]) and run my library functions... but that's it.

uvtc17:05:16

So, I suppose the first thing I need to know is: if I edit my code, how can I reload it and try out my changes?

uvtc17:05:52

Actually, the zeroth thing is: how can I "Ctrl-p" to get a previously typed form in the repl? (so I don't have to re-type it)

uvtc17:05:50

(I see that I can navigate up in the repl window and copy/paste a previously-typed form...)

uvtc17:05:15

Regarding reloading, I've tried running the require again, though that doesn't give me my changes.

dpsutton17:05:24

> For a list of all available commands in inf-clojure-mode (a.k.a. the REPL) and inf-clojure-minor-mode you can either invoke C-h f RET inf-clojure-mode and C-h f RET inf-clojure-minor-mode or simply browse their menus.

richiardiandrea17:05:47

@uvtc inf-clojure does not have any notion of reloading code. It is the lowest possible form of interaction with a repl

richiardiandrea18:05:23

so a reload in clojure is achieved with (require '[john.data-util :as jdu] :reload)

richiardiandrea18:05:40

or (require '[john.data-util :as jdu] :reload-all)

richiardiandrea18:05:06

that is the string you need to send...maybe inf-clojure could do it automatically for you.

richiardiandrea18:05:13

it is not there atm though

dpsutton18:05:45

i think the question may be how to eval the buffer. reload the code in the colloquial sense rather than in clojure's notion of reload

richiardiandrea18:05:21

oh sorry, so eval a buffer has a binding and is inf-clojure-eval-buffer

richiardiandrea18:05:26

agree a wiki with all the commands would be awesome

dpsutton18:05:57

@uvtc if you have any questions, richiardi here is the principal committer right now

uvtc18:05:35

Awesome. Thanks! Since my small library is currently only one file, does "require ... :reload" do the same thing as M-x inf-clojure-eval-buffer?

richiardiandrea18:05:36

@uvtc probably yes 😉

uvtc18:05:51

Ack! I need to run M-x inf-clojure-eval-buffer in my code window, not the repl window. 🙂

uvtc18:05:55

Ah. Regarding getting command/form history, M-p and M-n do the trick!

dpsutton18:05:07

control up might as well?

uvtc18:05:42

Ah, heh. Yes, those work too. 🙂 Thatks.

uvtc18:05:16

Wow. This is nice! I can also open a separate terminal window, run the emacsclient and switch to that *inf-clojure* buffer and work the repl from there. Whee!

uvtc18:05:54

Hm. This is weird: I hit Ctrl-D to exit/end the repl in the other terminal window (where I'd started emacsclient -nw and switched to *inf-clojure* buffer). It ended, but I couldn't do my usual C-# to finish the emacsclient session. I closed the terminal window. I had another file open in Emacs, and now the buffer is completely empty. It appears to be modified, and and tells me "No undo information in this buffer"... I can still see the file on disk, and its "#other-version.txt#" is there also and zero size...

uvtc18:05:12

Well, killed the empty buffer, and the file is fine.

uvtc18:05:59

(type: I meant "C-x #", not "C-#".)

uvtc18:05:07

typo, I meant typo 🙂

uvtc18:05:16

Hm. Hitting a snag: I can get everything working with a given library project. But I'd like to then shut down the repl, close the file, and do the same with some other library project. I Ctrl-d to end the repl. I "C-x #" to close the emacsclient. cd to another library project, open a file there, but when I try M-x inf-clojure, it gives me file-not-found error:

uvtc18:05:08

FileNotFoundException Could not locate john/data_util__init.class or john/data_util.clj on classpath. Please check that namespac\es with dashes use underscores in the Clojure file name. clojure.lang.RT.load (RT.java:456)

uvtc18:05:37

(That was after working with inf-clojure repl with john/html-util, then trying to switch to john/data-util.)

richiardiandrea18:05:17

uhm, it does not seem an inf-clojure problem

richiardiandrea18:05:28

all inf-clojure does is to launch lein repl

richiardiandrea18:05:41

(btw you can customize what it is that it launches)

uvtc18:05:02

Ok, thank you.

uvtc18:05:06

I currently use lein, so lein repl works great.

uvtc18:05:27

Thanks for the help! So glad to have this!