Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions emacs.org
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,31 @@ Apparently all the cool kids have moved from auto-complete to Company
these days. Should probably look into LSP at the same time. Maybe I'll
go without for a bit first...

** Yasnippet

This is a really nice customisable completion system. For now I am
avoiding external packages full of completions. Let's keep it lean and
personalised.

#+begin_src elisp
(use-package yasnippet
:hook ((python-mode . yas-minor-mode))
:config
(yas-recompile-all)
(yas-reload-all)
)
#+end_src

*** Snippets
#+begin_src conf :tangle "emacs/.emacs.d/snippets/python-mode/import_numpy" :mkdirp yes
# -*- mode: snippet -*-
# name: import numpy
# key: <inp
# --
import numpy as np
$0
#+end_src

* File management

I used to lean heavily on [[https://github.com/sunrise-commander/sunrise-commander][sunrise-commander]], but haven't used it much
Expand Down
13 changes: 13 additions & 0 deletions tests/elisp/test-yasnippet.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(progn
(find-file "tmp.py")
(insert "<inp")
(yas-expand)
(cl-assert
(string-equal
(buffer-substring 1 20)
"import numpy as np
"))
(set-buffer-modified-p nil)
(kill-current-buffer)
)

6 changes: 6 additions & 0 deletions tests/emacs_tests.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
setup_file() {
# One-time setup: start the emacs daemon
emacs --daemon=test

export ELISP_TEST_DIR="$(dirname "$BATS_TEST_FILENAME")/elisp"
}

@test "magit available" {
Expand All @@ -13,6 +15,10 @@ setup_file() {
emacsclient -s test -e "(ace-window t)"
}

@test "yasnippet" {
emacsclient -s test -e "(load \"${ELISP_TEST_DIR}/test-yasnippet.el\")"
}

teardown_file() {
# Kill the emacs daemon
emacs --batch --exec "(progn (require 'server) (server-eval-at \"test\" '(kill-emacs)))"
Expand Down