reddit / emacs

Is there a simple way to swap between two versions of the same straight.el package on the fly?

SignSpice · 2022-07-16 18:19
**For example:** `(use-package symex` `:straight '(symex` `:type git` `:host github` `:repo "countvajhula/symex.el")` `:config)` **and also:** `(use-package symex` `:straight '(symex` `:type git` `:host github` `:repo "polaris64/symex.el"` `:branch "feature/ts-integration")` `:config)`
akirakom · 2022-07-16 18:23
No. AFAIK straight.el doesn't allow multiple recipes for the same package.
lastnamebird · 2022-07-16 20:28
I think you can use a custom package name, keep the recipes as you have them but add a `:local-repo` property.
ieure · 2022-07-16 23:24
Sounds like you need to make your own repo and merge whatever stuff is in those two, then use that.
SignSpice · 2022-07-16 23:50
Not quite my use-case here: I actually want to be able to toggle between the two versions while editing a file. Or switch between them depending on the major mode.
ieure · 2022-07-17 00:44
Why?
quokka70 · 2022-07-17 01:26
Does it matter?
SignSpice · 2022-07-17 01:37
Aha, so I could do something like this? unload current version: (let* ((symex-features (cl-remove-if-not (lambda (feature) (string-prefix-p "symex" (cl-prin1-to-string feature))) features))) (dolist (symex-feature symex-features) (unload-feature symex-feature)))) and then call this (or the other) again to load it back in? (use-package symex :straight '(symex :type git :host github :repo "countvajhula/symex.el") :config)
SignSpice · 2022-07-17 01:46
Because the other version is a pull request in progress that completely changes how symex (for structural editing) works -> to allow it to work with tree-sitter and therefore many more languages other than just lisps. Once it is finished it will work for both lisps and other langs, but for now it only half-way works for ANY language.
SignSpice · 2022-07-17 01:50
Sorry for all the rapid edits, still have yet to grok reddit code formatting rules.
ieure · 2022-07-17 02:46
I see, thanks for the explanation.
onetom · 2022-07-17 04:07
why don't you run separate Emacs processes for the 2 implementations? i don't think this problem would exist, if there were some automated tests for this package. that would allow refactoring without fear and without regressions. so instead of trying something manually on the original implementation, then switching over to your implementation and trying the (hopefully) same operation using your implementation, you automate the operation you tried and compare the result with your expectation. then you can run the resulting automated test against your implementation as you are developing it. you would only need the original implementation, when you are capturing new examples of its behavior.