syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.71k stars 4.9k forks source link

yas-snippet-dirs does not exist after each upgrade, causing warning #10316

Closed Blaisorblade closed 6 years ago

Blaisorblade commented 6 years ago

Description :octocat:

On Spacemacs stable, since a few weeks, upgrading yasnippet gives on each reboot a warning such as

[yas] Check your `yas-snippet-dirs': /Users/pgiarrusso/.emacs.d/elpa/yasnippet-20180204.1613/snippets is not a directory

until I manually create the named folder. Since the folder name is version-based, the warning is triggered anew with each upgrade.

I also suspect the content of the folder isn't migrated with the upgrade.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

[yas] Check your `yas-snippet-dirs': /Users/pgiarrusso/.emacs.d/elpa/yasnippet-20180204.1613/snippets is not a directory

Expected behaviour: :heart: :smile:

No warning.

System Info :computer:

duianto commented 6 years ago

Yasnippet no longer bundles snippets directly, but it's very easy to get some!

source: https://github.com/joaotavora/yasnippet#where-are-the-snippets

The Spacemacs auto-completion layer has added the yasnippet-snippets package on the develop branch: auto-completion: add yasnippet-snippets #10156

I'm not sure what the fix is on the master branch.

Maybe yasnippet is able to see the snippets if yasnippet-snippets is installed (add it to the dotspacemacs-additional-packages variable in .spacemacs).

Or maybe the path to the snippets need to be specified manually, by setting the yas-snippet-dirs variable, like in the example from the url above:

(setq yas-snippet-dirs
      '("~/.emacs.d/snippets"                 ;; personal snippets
        "/path/to/some/collection/"           ;; foo-mode and bar-mode snippet collection
        "/path/to/yasnippet/yasmate/snippets" ;; the yasmate collection
        ))
deisi commented 6 years ago

I can confirm, adding yasnippet-snippets to dotspacemacs-additional-packages fixes the issue

Blaisorblade commented 6 years ago

@deisi that worked for me too! So I guess yasnippet-snippets should also be added to the master branch, by backporting #10156 and 091800b2?

Or just wait for develop to be merged into master with the next release. I'm happy enough for now, so closing the issue.

sr105 commented 6 years ago

In case anyone else ends up here via search like I did:

  1. Adding yasnippet-snippets to dotspacemacs-additional-packages does NOT fix it.
  2. Setting yas-snippet-dirs DOES fix it, but defeats the purpose of the auto-complete layer.

The problem is that the auto-complete layer adds a no-longer existing directory to yas-snippet-dirs which causes yas-snippets to complain on initialization.

https://github.com/syl20bnr/spacemacs/blob/master/layers/%2Bcompletion/auto-completion/packages.el#L213

This is all fixed in the develop branch which is now a year ahead of master.

breneser commented 6 years ago

Is this going to be merged to master anytime soon ?

oliveratutexas commented 6 years ago

Guessing this still hasn't been merged in?

sdwolfz commented 6 years ago

You are right, these changes were not released to master yet, but unfortunately I don't have an ETA for the next release.

Blaisorblade commented 6 years ago

The next release from develop will take a while, interested users can either switch to develop or contribute a backport of #10156.

oliveratutexas commented 6 years ago

I don't think main has been updated for a while.

oliveratutexas commented 6 years ago

@Blaisorblade how could I help with backporting? I'd be starting from square 0 w/ this, I'm a vim user of spacemacs who doesn't do much configuration outside of adding lines into my .spacemacs flie

dogweather commented 5 years ago

2019, and still seeing this.

Is there something we can do to help?

CuyiGuaton commented 5 years ago

I've the same problem with the directories.

nullablemind commented 4 years ago

I too.

yelizariev commented 4 years ago

Switching to develop branch fixes the issue:

cd
cd .emacs.d
git fetch origin
git checkout develop
# restart emacs
cinerea0 commented 4 years ago

Why is this issue marked "closed" when the fix still hasn't been merged into master?

duianto commented 4 years ago

The issue author said the following in the comment above: https://github.com/syl20bnr/spacemacs/issues/10316#issuecomment-367426093

I'm happy enough for now, so closing the issue.


The develop branch is the recommended branch until the next version is released (I have no insight into when that is).

To try the develop branch:

Backup your current setup and make sure that there isn't a .emacs.d directory or a .spacemacs file in your home directory. Then navigate to your home directory in a terminal (or command prompt) and clone directly to the develop branch with:

git clone -b develop https://github.com/syl20bnr/spacemacs .emacs.d
Blaisorblade commented 4 years ago

The develop branch is the recommended branch until the next version is released (I have no insight into when that is).

👍 in practice, I've been using develop for ages — not sure the recommendation is official but it's reasonable.

stormwatch commented 3 years ago

I've found out very recently that my snippet tables were empty!

The auto-completion layer ensures yasnippet-snippets is available

And yasnippet-snippets autoloads yasnippet-snippets-initialize

(eval-after-load 'yasnippet
   '(yasnippet-snippets-initialize))

~But I found out that yasnippet-snippets-initialize was apparently not being run. I am guessing that maybe it has to do with using eval-after-load.~

~My current workaround consists of adding~

(use-package yasnippet-snippets
  :defer t
  :config
  (yasnippet-snippets-initialize))

to my dotspacemacs/user-config

lebensterben commented 3 years ago

@stormwatch According to https://github.com/syl20bnr/spacemacs/pull/10156#issue-288443684

Note yasnippet-snippets does not need to be initialized with use-package; simply installing it and putting it in the load-path is enough for yasnippet to find the snippets.


What I found is:

That is to say, there's no need to call yasnipeet-snippets-initialize manually.

stormwatch commented 3 years ago

@lebensterben Thank you!