Fork me on GitHub

wait, I just witnessed a behavior I wish I knew more about: I was working on a file in a project, than I followed some symbol definition in a dependency, I made some modifications there and I could immediately use the new function in my project. But then, I closed emacs. When I reopened it, and started a new repl, the dependency still had the patch. How is that possible? Where's the patched version stored?


I found them in ~/.gitlibs, but where's the reference to a particular checkout stored in my project then?


Ok, I see that some kind of info has to be contained in the .cpcache folder in my project, but I'd still like to know better how it works. Are these caches per-project?


You should be able to see the filename when you jump to a dependency's file. That will tell you what thing you are changing. I use mostly leiningen and there the modifications aren't easily "saveable" in the same way, I think (because such dependencies are typically JAR files)


The mechanism is pretty easy to understand:

~/.gitlibs/libs/eftest/eftest $ ls
there's one dir per git SHA. if two projects consume the same git dep at the same git sha, they use the same dir If they specify different SHAs, there will be two different checkouts residing in two independent directories


it makes sense that modifications are persistent - these are vanilla checkouts that you can modify like any other one. Perhaps CIDER should enable read-only-mode to not make modifications so easy (after you would M-x read-only-mode to disable it again if you know what you're doing)


With lein deps it's typically read-only but I guess that's because they are JAR files.


No, I love the fact that they are so easily editable! 😍


This may be for @tomd, but others may know... Please note: I don't really know emacs at all. If you say, "Have you tried X" then my response will be, "I didn't know that X existed, and I have no idea how to even start trying to use it". With a basic setup of emacs+evil, does anyone know how I can get ^R to do "redo", please? My previous system worked correctly, but I've just installed emacs on 2 new systems and am encountering this problem. I note that the, so I'm wondering if it's a more general issue? I discovered the evil-undo-system setting, but installing undo-tree and setting it to that didn't work, and neither did installing undo-fu and trying that one. (I only kept one installed at a time).

πŸ‘ 2

evil's maps should set this up for you by default:

(define-key evil-normal-state-map "\C-r" 'evil-redo)
what happens if you do C-h k C-r in normal mode?


(`C-h k` is describe-key which is handy for debugging this sort of thing)


also if you do C-h v evil-undo-system <return> and let me know what that is - customizing this is the easiest way to make redo just workβ„’ and probably the actual answer to your question


I do have "C-h k" in my notes, and I use it a lot πŸ™‚ When you say, "normal mode" do you mean when evil is not enabled? Or evil is enabled and you're not in insert mode? (if it's the latter, then it's bound to (evil-redo count)


evil-undo-system is set to nil


BTW, the system I fiddled with all weekend is another machine. This one right now is basically emacs+cider+evil, and not much else. There is very little manual config at all


sorry, technically I meant "normal state" (the latter)


That's OK. It's what I thought you meant, but I didn't want to mess you up

πŸ™‚ 1

ok so you just need to customize evil-undo-system and you should be fine:

(customize-set-variable 'evil-undo-system 'undo-tree)
in your init.el should do it


Oh... I wasn't aware of the customize- prefix


yeah it's the "proper" way to set things that were defcustom'd


oh... now it wants me to enabled 'global-undo-tree-mode' to use undo-tree commands?


ah sorry I thought you had undo-tree up and running. you can choose undo-fu if you have that


like I said, new install


sorry you mentioned something about undo tree at the top and I didn't read properly


you can choose undo-redo if you're on emacs 28 or later, and that's built in


(they're all much of a muchness afaic, but if you have specific undo/requirements, then you may want to look into the differences)


Sorry... On the weekend I was trying this with another machine. I installed undo-tree, and that didn't work. I then uninstalled it and installed undo-fu, and that didn't work. Today I'm on a work machine. I haven't installed either undo-tree nor undo-fu, mostly because I don't know how to use them, and I couldn't hook them up to evil

πŸ‘Œ 1

if you're not on emacs 28, I'd install undo-fu and set that as you evil-undo-system. it's very simple from my experience


Sorry... I was just trying to see if I could get brew to update to a more recent emacs, but it doesn't seem to know about anything after 27.2


Whew. This worked. Thank you very much.


I was stuck on trying: (setq evil-undo-system 'undo-fu) as this doesn't work


(or (set 'evil-undo-system 'undo-fu), which I believe is the same thing, but I tried both anyway πŸ™‚ )


ah glad it's up and running for you πŸ™‚


customize-set-variable ftw

πŸ‘ 1

@ericdallo is there a way to show nested levels of a map in lsp breadcrumbs header? i.e. when the cursor positioned in a map like {:foo {:bar {:zap 1}}} inside the innermost element, could I make it to display in breadcrumbs :foo :bar :zap?


I think it could be possible, but it'd need a some work on clojure-lsp side, not that easy though


Alright, I was curious thinking maybe lsp does that already. lsp does so many cool things, I don't even know anymore what it can and can't do... lol

πŸ˜… 1

This is a little helper I wrote some time ago for Emacs+CIDER - at the time, I don't think there was an equivalent (not sure if there is now):

(defun my-cider-tinker ()
  "Evals current defn at point and attempts to call it with user args."
  (lexical-let* ((my-form (read-string "args: "))
                 (eval-result (call-interactively #'cider-eval-defun-at-point))
                 (my-buffer (current-buffer))
                 (my-place (cider-defun-at-point 'bounds)))
      "(let [x (@*1 %s)]
(prn \"my-cider-tinker result:\")
(prn x)
     (cider-interactive-eval-handler my-buffer my-place))))
When executed on a form (typically a function defn), it prompts the user for args, and then runs the form/fn with those args and prints the result


fyi: lexical-let is obsolete since the introduction of true lexical binding in Emacs 24.1.