Here, treemacs is correctly cloned in the :local-repo location. However, when I invoke treemacs, treemacs is re-cloned in straight/repos when other packages reference it. eg here we see treemacs recloned in repos when I call (treemacs) bound to M-0 . treemacs-icons-dired doesn't realise treemacs is installed and built
Cloning treemacs (for treemacs-icons-dired)...done
Building treemacs-icons-dired...done
Building treemacs-projectile...done
Building treemacs-magit...done
My treemacs config:-
(use-package
treemacs
:straight (:local-repo "~/development/projects/emacs/treemacs/" :fork ( :type git :host github :repo "rileyrg/treemacs"))
:custom
(treemacs-follow-after-init t)
:config
(treemacs-follow-mode +1)
(treemacs-fringe-indicator-mode)
(treemacs-git-mode 'deferred)
(use-package treemacs-icons-dired
:config (treemacs-icons-dired-mode))
(use-package treemacs-projectile)
(use-package treemacs-magit)
:bind
("M-0" . (lambda()(interactive)(treemacs t)))
(:map treemacs-mode-map
("<right>" . treemacs-peek)))
I'm guessing the issue is the trailing slash on :local-repo. I suspect this is a bug where we have to adjust straight.el to automatically strip trailing slashes on :local-repo values.
Yikes. I thought I'd tested that as that does crop up in so many packages. I shall test and get back to you. As an aside:local-repo is great - removes repos from the straight repo's root (which I have redirected using no-littering anyway) which simplifies things like treemacs bookmarks and projectile.
Sorry, that's not it. The same happens with or without trailing slash. As it happens, I had remembered to test that late last night.
Okay, interesting. I re-read your report and I have another idea. Is your use-package form for treemacs in a separate file that is not always loaded during startup? If so, then straight.el won't know about your custom recipe for treemacs until that file is loaded. For that reason, if another package is requested that depends on treemacs, but your custom recipe for treemacs isn't loaded yet, then treemacs will be cloned into its default location.
This is due to the way the treemacs package is structured.
All of the extra packages (treemacs-magit, treemacs-evil, et al.) are hosted under the main repository in the
src/extra directory:
https://github.com/Alexander-Miller/treemacs/tree/master/src/extra
So your recipe for treemacs is registered (and presumably) builds correctly.
But the default recipe for the extra packages specify "treemacs" as their :local-repo.
For example:
(straight--convert-recipe (straight-recipes-retrieve 'treemacs-magit))
Returns the recipe:
(:type git :flavor melpa :files
("src/extra/treemacs-magit.el" "treemacs-magit-pkg.el")
:host github :repo "Alexander-Miller/treemacs" :package "treemacs-magit" :local-repo "treemacs")
To work around this you could alter the recipe for treemacs to include the src/extra directory (it is excluded by default) or a subset of that directory.
The following test case seems to behave appropriately:
Test Case
(straight-bug-report
:user-dir "treemacs.straight"
:preserve t
:post-bootstrap
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(use-package treemacs :straight
(:local-repo "/tmp/treemacs.git/" :fork
(:type git :host github :repo "rileyrg/treemacs" :files
(:defaults "Changelog.org" "icons" "src/elisp/treemacs*.el" "src/scripts/treemacs*.py" "treemacs-pkg.el" "src/extra/*")))
:custom
(treemacs-follow-after-init t)
:config
(treemacs-follow-mode 1)
(treemacs-fringe-indicator-mode)
(treemacs-git-mode 'deferred)
(use-package treemacs-icons-dired :straight nil :config
(treemacs-icons-dired-mode))
(use-package treemacs-projectile :straight nil)
(use-package treemacs-magit :straight nil)
:bind
("M-0" lambda nil
(interactive)
(treemacs t))
(:map treemacs-mode-map
("<right>" . treemacs-peek))))
2021-04-27 14:24:37gnu/linuxprerelease (HEAD -> feat/single-branch-clone-depth, fork/feat/single-branch-clone-depth) a4cc1ee 2021-04-27GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars)
of 2021-04-26Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe β Cloning melpa...
Looking for gnu-elpa-mirror recipe β Cloning melpa...done
Looking for emacsmirror-mirror recipe β Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe β Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe β Cloning el-get...
Looking for emacsmirror-mirror recipe β Cloning el-get...done
Looking for straight recipe β Cloning emacsmirror-mirror...
Looking for straight recipe β Cloning emacsmirror-mirror...done
Building straight...
Building straight...done
Test run with version: prerelease (HEAD -> develop, origin/develop) 253d7db 2021-04-27
Cloning use-package...
Cloning use-package...done
Building use-package...
Building use-package β Building bind-key...
Building use-package β Building bind-key...done
Building use-package...
Building use-package...done
Cloning /tmp/treemacs.git/ (for treemacs)...
Cloning /tmp/treemacs.git/ (for treemacs)...done
Building treemacs...
Building treemacs β Cloning dash.el...
Building treemacs β Cloning dash.el...done
Building treemacs β Building dash...
Building treemacs β Building dash...done
Building treemacs β Cloning s.el...
Building treemacs β Cloning s.el...done
Building treemacs β Building s...
Building treemacs β Building s...done
Building treemacs β Cloning ace-window...
Building treemacs β Cloning ace-window...done
Building treemacs β Building ace-window...
Building treemacs β Building ace-window β Cloning avy...
Building treemacs β Building ace-window β Cloning avy...done
Building treemacs β Building ace-window β Building avy...
Building treemacs β Building ace-window β Building avy...done
Building treemacs β Building ace-window...
Building treemacs β Building ace-window...done
Building treemacs β Cloning pfuture...
Building treemacs β Cloning pfuture...done
Building treemacs β Building pfuture...
Building treemacs β Building pfuture...done
Building treemacs β Cloning hydra...
Building treemacs β Cloning hydra...done
Building treemacs β Building hydra...
Building treemacs β Building hydra β Building lv...
Building treemacs β Building hydra β Building lv...done
Building treemacs β Building hydra...
Building treemacs β Building hydra...done
Building treemacs β Cloning ht.el...
Building treemacs β Cloning ht.el...done
Building treemacs β Building ht...
Building treemacs β Building ht...done
Building treemacs β Cloning cfrs...
Building treemacs β Cloning cfrs...done
Building treemacs β Building cfrs...
Building treemacs β Building cfrs β Cloning posframe...
Building treemacs β Building cfrs β Cloning posframe...done
Building treemacs β Building cfrs β Building posframe...
Building treemacs β Building cfrs β Building posframe...done
Building treemacs β Building cfrs...
Building treemacs β Building cfrs...done
Building treemacs...
Building treemacs...done
Packages:
"org-elpa" n/a n/a
"melpa" n/a master c8bd3d8b 2021-04-26
"gnu-elpa-mirror" n/a master 3e7e586 2021-04-17
"el-get" melpa master 84dd1837 2021-02-07
"emacsmirror-mirror" n/a master 1c24bce 2021-04-08
"straight" n/a develop 253d7db 2021-04-27
"use-package" melpa master a7422fb 2021-02-10
"bind-key" melpa master a7422fb 2021-02-10
"treemacs" melpa master 154ab07 2021-04-21
"dash" melpa master b9286a8 2021-03-30
"s" melpa master 3a5166c 2021-04-02
"ace-window" melpa master c7cb315 2020-06-06
"avy" melpa master e92cb37 2020-12-26
"pfuture" melpa master d7926de 2020-04-25
"hydra" melpa master 2d55378 2020-11-15
"lv" melpa master 2d55378 2020-11-15
"ht" melpa master c4c1be4 2021-01-18
"cfrs" melpa master 7c42f2c 2021-02-17
"posframe" melpa master 739d8fd 2021-04-23
Does that help?
I forgot we added suport for the :includes keyword, which should make things a little cleaner. You can set it to the list of extra packages in the recipe for treemacs. This will inform straight that those packages are included with treemacs, so straight will not attempt to install them when requested later on. The following should work:
(use-package treemacs
:straight ( :host github
:fork (:repo "rileyrg/treemacs")
:local-repo "/tmp/treemacs.git/"
:files (:defaults "Changelog.org"
"icons"
"src/elisp/treemacs*.el"
"src/scripts/treemacs*.py"
"treemacs-pkg.el"
"src/extra/*")
:includes (treemacs-all-the-icons
treemacs-evil
treemacs-icons-dired
treemacs-magit
treemacs-persp
treemacs-pesrpective
treemacs-projectile))
:custom
(treemacs-follow-after-init t)
:config
(treemacs-follow-mode 1)
(treemacs-fringe-indicator-mode)
(treemacs-git-mode 'deferred)
(use-package treemacs-icons-dired
:config (treemacs-icons-dired-mode))
(use-package treemacs-projectile)
(use-package treemacs-magit))
@rileyrg: Any luck with this?
Hi, I just saw this. Apologies. I'll get to it next couple of days.
@rileyrg: Closing this now, as I'm fairly confident the recipe I've provided above should address the problem.
If you run into any other issues, please comment and we'll reopen.