3

How can I include a package that is available locally on my system that depends on the string library s with spacemacs?

I have an company internal package that adds functionality to magit available at /usr/share/emacs-config/neat-tool.el

neat-tool.el is something like:

;;; neat-tool.el --- Use neat tool

(require 'magit)
(require 's)
(magit-define-popup-action 'magit-dispatch-popup ?x
   "Neat commands"
   'neat-commands-popup)

I have a custom layer called my-layer with a packages.el of:

(defvar my-layer-packages
  '((neat-tool
     :location (recipe
                :fetcher url
                :url "file:///usr/share/emacs-config/neat-tool.el"))))

(defun my-layer/neat-tool ()
  "Init neat-tool."
  (use-package neat-tool
    :defer t
    :init
    (with-eval-after-load 'magit
      (require 'neat-tool))
    ))

Unfortunately, this fails with Cannot open load file: No such file or directory, s. s is correctly installed and up to date in ~/.emacs.d/elpa

I could wrap another with-eval-after-load in the :init, but that seems messy. Is there a better way to declare the dependency on s?

  • Not sure how the spacemacs init is layed out, but is it possible to call package-initialize earlier? If s is installed via melpa, then that should setup its autoloads. – npostavs Aug 9 '16 at 23:45
  • I ran into the same issue and found that I could individually activate and load the library I needed, does this answer help? emacs.stackexchange.com/a/36826/5495 – Croad Langshan Nov 12 '17 at 13:07
0

Did you add s to dotspacemacs-additional-packages in your init file? If so, require should find it as emacs is not doing relative loading (like e.g. npm).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.