I have cloned yasnippets repo repo in ~/.emacs.d/yasnippet-snippets
.
I would like to synchronize it each time I start Emacs (btw, it would be nice to do it only if there is a connection available), my current (pretty raw) code is:
;; ~/.emacs
(use-package yasnippet
:config
(cd "~/.emacs.d/yasnippet-snippets")
(magit-submodule-update)
(yas-reload-all)
(cd "~/"))
But I am getting this error in *Messages*
, probably because it changes directory before finishing the magit process:
error in process sentinel: user-error: Not inside a Git repository
error in process sentinel: Not inside a Git repository
*Using: use-package
cd
andmagit-submodule-update
are intended for interactive use. I would start by replacingcd
with(setq default-directory ...)
, then add debug statements that print the current-buffer and default-directory to see what's going on.magit-submodule-update
runs git asynchronously and returns before it finishes, so putting theyas-reload-all
after it will not guarantee that the updated snippets are loaded. Also, yasnippet-snippets repo doesn't have submodules, did you (mean to) clone yasnippet or yasnippet-snippets repo?git submodule update --init
.subdmodule update
in the yasnippet repo to update yasnippet-snippets. If you did actually clone the yasnippet repo, then it's a bit confusing to have it in a directory named yasnippet-snippets.