Fork me on GitHub
#spacemacs
<
2017-04-07
>
reefersleep08:04:04

@eggsyntax cheers, this was one of the things I tried to get my work back - but I didn't succeed. Not sure why, because I'm not at that computer at the moment. But an important note was that I hadn't worked on that particular file for months, it had just been laying there in my work dir, uncommitted. I don't know when undo tree files are deleted, maybe it had already been removed by emacs in my case.

jumar08:04:24

@rustam.gilaztdinov Unfortunatelly, I wasn't able to navigate to the source of clojure's java classes (e.g. clojure.lang.PersistentVector): cider-find-var responds with "No source location". However, this works for JDK classes like "java.util.ArrayList"

reefersleep08:04:54

Found a thread regarding "persistent undo" a la vim, which is exactly what I was looking for. Will have do delve deeper into this once I get back to my personal computer 🙂

eggsyntax13:04:02

@reefersleep ah, yeah, I do have undo-tree-auto-save-history set to true; I'd forgotten that. That's probably what's causing the difference in behavior.

reefersleep13:04:42

@eggsyntax neat. Do you know what the limits are for that? Does it just naively persist all of your history?

jumar13:04:21

@reefersleep if you need to get back some data after git reset --hard you might wanna look at git reflog

reefersleep13:04:15

@jumar that was my first attempt, but I didn't succeed. When you use the reflog to jump to an earlier point in time, that "point" does not contain uncommitted/unstashed files... Or so it seemed to me. Am I wrong?

clojer13:04:25

Can anyone help with this error: WARNING: clj-refactor and refactor-nrepl are out of sync. Their versions are 2.3.0-SNAPSHOT (package: 20170126.118) and n/a, respectively.

clojer13:04:42

I have [refactor-nrepl “2.3.0-SNAPSHOT”] in ~/.lein/profiles.clj

clojer13:04:14

[cider/cider-nrepl “0.15.0-SNAPSHOT”] matches the Spacemacs version

eggsyntax13:04:38

@reefersleep I believe that's correct (re reflog). I think it persists files naively until/unless you delete them yourself, but I wouldn't swear to that.

clojer13:04:14

2.3.0-SNAPSHOT seems to be the refactor-nrepl version so “respectively” seems to be wrong?

reefersleep13:04:20

hm, I'd like some documentation on that, will have to dig it up or ask in the right places... Are your persistent save history files created in the same place as the original file, or in some designated (by your or some default settings) location? @eggsyntax

eggsyntax13:04:20

@clojer I believe you no longer need to have them in your personal profiles.clj -- I don't, anyway, and the refactor stuff works fine for me.

eggsyntax13:04:42

@reefersleep my .spacemacs contains the following -- I believe it was in there at install:

;; Location where to auto-save files. Possible values are `original' to
   ;; auto-save the file in-place, `cache' to auto-save the file to another
   ;; file stored in the cache directory and `nil' to disable auto-saving.
   ;; Default value is `cache'.
But unfortunately there's not an actual var there other than undo-tree-auto-save-history -- maybe that's it? I just have it set to t. I'm afraid I don't recall if/when I set that myself; too long ago...

eggsyntax13:04:04

But I'd suggest checking for that in your .spacemacs.

clojer13:04:48

@eggsyntax Just refactor-nrepl or cider-nrepl as well?

eggsyntax13:04:23

Ah, ok, based on the template, it looks like it is undo-tree-auto-save-history.

eggsyntax13:04:40

@clojer I have both commented out in my ~/.lein/profiles

reefersleep13:04:51

uhm... I do have dotspacemacs-auto-save-file-location 'cache

reefersleep13:04:59

on my work pc, anyways

reefersleep13:04:04

I guess I'll have it at home, too

reefersleep13:04:53

But do you mean that having dotspacemacs-auto-save-file-location 'cache is the same as having undo-tree-auto-save-history set?

reefersleep13:04:15

looks up documentation

eggsyntax13:04:49

@clojer disclaimer: that's just based on what I happen to have, can't swear it's correct 😜 @reefersleep dunno, I'd have to go look at the docs also.

clojer13:04:48

@eggsyntax Just commented-out as suggested but no change in the Spacemacs error.

eggsyntax13:04:05

@reefersleep I've got both dotspacemacs-auto-save-file-location 'cache and undo-tree-auto-save-history t -- the former had just gotten misplaced to another part of my .spacemacs.

eggsyntax13:04:28

@clojer you're on current version of spacemacs? & I assume you did a spacemacs restart?

eggsyntax13:04:06

Hmm. Dunno then. It's possible that cider-nrepl isn't actually active for me; I forget what functionality that gives you.

eggsyntax13:04:30

You may want to see https://github.com/clojure-emacs/cider/issues/1140, although that could be outdated.

eggsyntax13:04:24

Oh, yeah, refactor-nrepl docs say:

*With CIDER and clj-refactor*
If you're using CIDER and clj-refator you don't have to do anything except call cider-jack-in. The dependencies are injected automagically.
Be aware that this isn't the case if you connect to an already running REPL process. See the cider documentation for more details.

reefersleep13:04:21

hmmmmm... My ~/emacs.d/.cache/auto-save/site/ dir contains a number of files beginning and ending with #. I assume these are files containing auto-save information. However, there are not nearly as many files as I have ever opened on this PC. Some of them, I haven't opened recently. And the ones I have opened right now are not there.

clojer13:04:46

Another cider/nrepl time-waster. Jeezus. I thought an effort was being made to make cider easier to use.

reefersleep13:04:02

I'm not sure what to make of that dir. Guess I'll check it at home, see if there's any useful info. I would still like to know the definitive consequences of these settings, so that I can use them properly 🙂

reefersleep13:04:26

*hoping that some spacemacs authority pics up on this

reefersleep13:04:53

Anyways, thanks a lot for your help, @eggsyntax , I'm much closer to the answers I'm seeking.

clojer13:04:47

@eggsyntax cider-jack-in solved it but it takes about 40 seconds longer than cider-connect on my workstation

eggsyntax13:04:59

@reefersleep yeah, NP, I’d be curious to hear what you end up finding out.

eggsyntax13:04:36

@clojer ah, yeah, gotcha. I use jack-in, so it’s a different story. If you’re connecting, I assume you need to have both libs in your personal profiles.

reefersleep13:04:50

Will keep you posted 🙂

clojer13:04:53

@eggsyntax Doesn’t work with cider-connect either way. I had everything in my ~/.lein/profiles.clj when I posted the error.

clojer13:04:22

@eggsyntax This is a fairly recent development as I didn’t have this error a few months back.

eggsyntax13:04:23

Damn. OK, outside my personal experience, then. Good luck!

clojer13:04:08

@eggsyntax Correction cider-jack-in is taking 90 seconds with a fairly stock Luminus project without any cljs, swagger etc.

clojer13:04:48

@eggsyntax That makes Spacemacs/Emacs/Cider an non-starter for me, I’m afraid

Sam H14:04:24

does it take that long on every cider-jack-in?

clojer14:04:04

@shan Yes. It’s nothing to do with the project

clojer14:04:29

Things have been generally a bit slower after the Sierra upgrade but not this bad.

Sam H14:04:35

even on a fresh new project? I’m on Sierra and just updated to the latest spacemacs + updated all my packages

clojer14:04:26

@shan 60 seconds with a new project

clojer14:04:10

@shan All I can say is cider ran a lot faster when I first tried it a year ago. Even on my 3-yr old Macbook Pro the project took 45 seconds with cider-jack-in

clojer14:04:04

@shan The workstation is a 7-year-old 2.8Ghz quad core i7

Sam H14:04:52

strange. Is this with a fresh install of spacemacs and any cider references removed from ~/.lein/profiles.clj

clojer14:04:54

@shan The Macbook Pro takes 25 seconds to boot a new project

clojer14:04:25

@shan References restored so still present. Will try without.

clojer14:04:40

@shan Removing ~/.lein entries for cider & refactor made no difference

clojer14:04:36

@shan Spacemacs and packages all up to date

eggsyntax14:04:27

Actually, might be worth trying with personal profiles removed entirely (or moved to backup file); I wonder if there could be another plugin/dep slowing things down.

eggsyntax14:04:44

Also -- up-to-date version of lein?

clojer14:04:08

@eggsyntax Good idea. Will try that. Yes, lein is up to date

Sam H14:04:12

on a current work project cider-jack-in takes about 25-30s

Sam H14:04:34

top spec’d 15" macbook pro mid 2015

eggsyntax14:04:36

I'd also be curious about startup time on lein new myproject rather than a new luminus project.

eggsyntax14:04:55

(if you're still creating them as luminus projects)

clojer14:04:57

@shan No, 45 seconds on the original project. 25 from a new basic project with no code.

clojer14:04:29

@eggsyntax 25 seconds is for a new base Clojure project, not Luminus

Sam H14:04:20

~15 seconds on a new project lein new app

eggsyntax14:04:35

So it sounds like you & shan are at least in the same ballpark now (25 sec vs 15).

clojer14:04:55

@shan Removed ~/.lein/profiles.clj entries but still 25 secods for a new blank Clojure app.

Sam H15:04:13

what spec macbook pro are you using?

clojer15:04:15

@shan …. with cider-jack-in, that is

clojer15:04:05

@shan Early 2013 2.4Ghz i7 with 8Gb RAM

Sam H15:04:33

probably about right then, it’s just generally slow 😞

Sam H15:04:06

considering I’m on a mid 2015 2.5 i& with 16 GB

eggsyntax15:04:34

FWIW, I'm on a project with > 60 sec startup. It's annoying, but def not a showstopper; I just use workflows that rarely require a full restart.

clojer15:04:42

@eggsyntax Corrrect me if I’m wrong but if I add a new library to a file via :require a repl reboot is required, no? Even with mount or component.

eggsyntax15:04:47

Yep. I think I've seen that there's a workaround to dynamically load it, but I've never used it.

eggsyntax15:04:21

<shrug> I probably average 2-3 repl reboots a day; I can live with that.

Sam H15:04:53

clojure-refactor in spacemac should autoload new dependancies

eggsyntax15:04:06

It's my moment to go get more coffee 😜

Sam H15:04:33

SPC-m-r-a-p

eggsyntax15:04:38

For me personally, I get enough productivity gain from spacemacs to make it worth while.

eggsyntax15:04:55

@shan ooooh, killer, didn't realize that! Sweeeeeet 😄

Sam H15:04:33

it’s pretty nice, allowing you to select specific versions

Sam H15:04:47

auto loads and adds to your project.clj file

clojer15:04:29

@eggsyntax I don’t see an M-x clojure-refactor option in Spacemacs

clojer15:04:32

@eggsyntax Sorry that should have been for @shan

eggsyntax15:04:02

Look for clj-refactor-mode.

eggsyntax15:04:25

And then the various refactorings are in your menu under SPC m r.

clojer15:04:55

@eggsyntax As far as I can make out SPC m r a p loads a lib but after I :require it doesn’t appear to be loaded

eggsyntax15:04:19

Well, I haven't used that one, that was @shan

clojer15:04:25

“adds” not “loads”

clojer15:04:52

@eggsyntax Damn. Did it again.

clojer15:04:50

@shan SPC m r a p seems to add a lib to the projects.clj file but when I :require it nothing is added to the current file’s namespace.

Sam H15:04:24

did you evaluate the file?

clojer15:04:02

@shan I addeed [selmer.parser] but after a Ctrl c l to load it into the repl the render symbol was not resolved

Sam H15:04:04

or try and load it in the repl? (require '[cheshire.core :as json])

beppu16:04:27

@clojer It's possible to load new dependencies into a running repl with SPC m r h d.

beppu16:04:10

I could have sworn SPC m r a p also loaded new libraries into the repl in addition to adding it to project.clj.

eggsyntax16:04:12

“hotload-dependency”, that makes more sense.

beppu16:04:36

@clojer After you do SPC m r a p, you probably have to say (require '[your.lib :as y]) in the repl.

clojer16:04:05

@beppu For some reason I tried hotloading selmer into a new Clojure project and received what appear to be unrelated errors beginning with:

clojer16:04:07

WARN: org.clojure/clojure version 1.7.0 requested, but 1.9.0-alpha15 already on classpath. Loaded dependencies: [[args4j “2.0.16”] [cheshire “5.6.3"]

clojer16:04:48

… hiccup … joda-time … guava ….

beppu16:04:50

If it's just a warning, I think you can ignore it.

clojer16:04:18

@beppu Maybe but why is the process referencing a ton of what appear to be unrelated libs?

beppu16:04:32

What did you try to load?

clojer16:04:19

… protobuf-java …. rhino ….. ?

clojer16:04:41

@beppu selmer.parser

clojer16:04:16

@beppu I add a function to the file and try to reload with C-c C-l and now receive the error: “Search failed. This means there is unmatched expression somewher or we are at the beginning/end of file.”

clojer16:04:51

@beppu Not at the beginning or end of the file.

clojer16:04:00

@beppu Sorry, that was a parent error.

beppu17:04:32

@clojer After I add a function to a file, I usually reload the whole buffer with SPC m s b or , s b (same thing).

beppu17:04:50

I find , s b easier to type.

ag20:04:11

does anyone know how to make cider-find-var , g g g d less stupid? Why the hell it would prompt for the symbol when the cursor is at the symbol?

ag21:04:17

I thought maybe I could use dumb-jump instead, but I could find a good way of setting spacemacs-jump-handlers-clojure-mode after it’s set in clojure layer. Besides sometimes dumb-jump is just that - too damn “dumb”. But cider-find-var doesn’t seem to be smarter either

ag21:04:41

has anyone solved jump-to-definition in clojure/clojurescript projects?

ag21:04:18

Another problem is that cider-find-var miserably fail if there’s no connected repl. Ideally what should happen I think is: 1) if repl is connected - apply cider-find-var to the current symbol 2) if no connected repl - use dumb-jump

ag21:04:58

I am to be honest utterly surprised that we haven’t solved this simple problem. Feels really bad of not having something basic like this and let Cursive users to gloat about that

eggsyntax21:04:48

While I agree that that's kinda weak, and your proposed behavior seems like a good fix, I'm just happy to know that dumb-jump exists; I hadn't run across it.

eggsyntax21:04:26

I'd suggest opening a spacemacs ticket pointing out that cider-find-var fails without a repl & proposing the fallback behavior that you described.

eggsyntax22:04:38

I'll go vote for that 🙂

eggsyntax22:04:02

Just noticed a minor annoyance, that dumb-jump forces a file save before use...

eggsyntax22:04:55

Ah. @ag FYI, cider-find-var does not normally ask me for a symbol, unless the repl isn't running.

ag22:04:35

yeah, I can’t figure out why it keeps prompting for a symbol