Search code examples
regexemacselpa

Avoiding version numbers from elpa in my init.el file


How do I avoid hardcoding version numbers in my load paths when writing my init.el file?

Every time I go through and update my packages, I have to do the same in my init.el file.

It'd be great if I could do something like this:

(setq yas-snippet-dirs
      '("~/.emacs.d/snippets/"
       (regexp-quote "~/.emacs.d/elpa/yasnippet-[.*]/snippets/"))

This wasn't working for me, but then again I tried kludging it together from this example real fast, so honestly I'm not surprised. Can someone let me know if this is the preferred way of handling this, and if so, how you'd go about doing it?


Solution

  • I think you are looking for something like this:

    (setq yas-snippet-dirs
        '("~/.emacs.d/snippets/"
         (file-expand-wildcards "~/.emacs.d/elpa/yasnippet-*/snippets"))
    

    But I think you don't need it...

    For load-path variable... package-initialize should update it automatically, so this would not be needed.

    For yas-snippet-dirs installed with elpa... just doing M-x yas-global-mode sets the value of that variable just to what you want.