Is doing mkdir ~/.emacs.d/personal/snippets/

the correct way and putting snippets there?

I've been reading https://github.com/bbatsov/prelude/issues/98

What I did:

;; personal.el
(prelude-require-packages '(                                                                                                                            

;; yasnippet                                                                                                                                            
(add-to-list 'load-path
(require 'yasnippet)
(yas-global-mode 1)

Added this snippet to the snippets folder: https://github.com/AndreaCrotti/yasnippet-snippets/blob/master/snippets/perl-mode/sub

Then restarted emacs

opened up up a ruby file ( emacs is an alias that does a -nw emacsclient)

emacs app/controllers/application_controller.rb

now on a new line I press sub and then tab, but nothing happens. What am I doing wrong.

  • Here is a link to my previous write-up (from a few years ago) of how to install Yasnippet for buffer-local usage. I have not tested it recently. I do not use Prelude. emacs.stackexchange.com/a/16743/2287 One of the maintainers of Yasnippet is a regular here in this forum, so go ahead and wait for an official answer by someone who knows more than me ... :) – lawlist Jan 29 at 3:52
  • 1
    In the linked example of how to configure yasnippet (for buffer-local usage), the variable yas-snippet-dirs is customized to a precise location of snippets -- that folder contains subfolders with the major-mode names, and within those major-mode folders are the snippets for each major-mode. In the edited example of the question above, the original poster has configured the load-path with the location for snippets. Customizing the load-path is not the correct method for telling yasnippet where to find the snippets. – lawlist Jan 29 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.