doomemacs / doomemacs/core

Snippets are unreliable

Open
#4,330 1 comment 0 reactions 0 assignees View on GitHub
:editor snippets is:bug
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

**What did you expect to happen?**
When creating a snippet with `+snippets/new`, `yas-load-snippet-buffer-and-close` should guess something, but it always asks for the mode and folder instead.

**What actually happened?**
Snippet creation and loading is inconsistent.

**Additional details:**
- [Private config](https://github.com/mrbig033/doom2/blob/main/config.org)

I have updated this config to completely remove the `snippets` module. Yanisppet now works. [Open this commit](https://github.com/mrbig033/doom2/commit/7e53c61f71a1d5b13e9edd8833251a2daa8682dc) to see the exact settings in which the issue occurs.

**Steps to reproduce:**
1. Open any file
2. `C-c & C-n` or `M-x +snippets/new`
3. Create new snippet
4. Yasnippet should guess or remember mode
5. Add mode and folder manually
6. `yas-load-snippet-buffer-and-close`
7. Try expanding snippet
8. More than half the time, this doesn't work.

**-->** Sometimes, when trying to visit new snippets with `+snippets/edit`, I get this message: `or: Wrong type argument: yas--template, nil`. Calling `M-x yas-visit-snippet-file` directly does not give me this error. Binding a key to `yas-visit-snippet-file` ends up calling `+snippets/edit`.

**System information:**

```

SYSTEM type gnu/linux
config x86_64-pc-linux-gnu
shell /bin/bash
uname Linux 5.8.0-29-generic #31-Ubuntu SMP Fri Nov 6 12:37:59 UTC 2020 x86_64
path (/home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin ~/.fzf/bin ~/maps/scripts ~/.nimble/bin /usr/lib/emacs/27.1/x86_64-linux-gnu)
EMACS dir ~/.emacs.d/
version 27.1
build set 19, 2020
buildopts --build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp --program-suffix=27 --with-modules --with-file-notification=inotify --with-mailutils --with-harfbuzz --with-json --with-x=yes --with-x-toolkit=gtk3 --with-lcms2 --with-cairo --with-xpm=yes --with-gif=yes --with-gnutls=yes --with-jpeg=yes --with-png=yes --with-tiff=yes --with-xwidgets 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs27-bifpWT/emacs27-27.1~1.git86d8d76aa3=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie'
features XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP
traits (batch server-running envvar-file)
DOOM dir ~/.doom.d/
version 2.0.9
build grafted, HEAD -> develop, origin/develop, origin/HEAD ee6c27c 2020-11-06 02:33:53 -0500
elc-files 1
modules (:completion company (ivy +prescient) :ui doom modeline ophints (popup +defaults) :editor (evil +everywhere) file-templates fold lispy multiple-cursors snippets word-wrap :emacs (dired +ranger) electric undo vc :checkers syntax (spell +flyspell) :tools (eval +overlay) (lookup +dictionary +offline) :lang emacs-lisp markdown (org +pomodoro) (racket +xp) sh :config (default +bindings +smartparens))
packages ((clipmon) (cycle-buffer :recipe (:local-repo /home/jones/.doom.d/lisp/cycle-buffer)) (typo) (olivetti) (eyebrowse) (caps-lock) (super-save) (engine-mode) (hl-sentence) (lorem-ipsum) (better-jumper) (google-translate) (electric-operator) (git-auto-commit-mode) (evil-better-visual-line) (aggressive-fill-paragraph) (elmacro :disable t) (pabbrev :disable t) (evil-lion :disable t) (poet-theme :disable t) (evil-snipe :disable t) (kaolin-themes :disable t) (dracula-theme :disable t) (badwolf-theme :disable t) (fountain-mode :disable t) (url-shortener :disable t))
unpin (n/a)
elpa (n/a)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.