0

I created a custom minor mode for my Wordpress projects:

(define-minor-mode wordpress-mode
  "Wordpress minor mode"
  :lighter " Wordpress")

(provide 'wordpress-mode)

And on my init.el I load the package, associate the minor mode to the major mode web-mode and enable yasnippets for this extra minor mode.

;; ---- Wordpress Custom Minor Mode --------
;; Loads Wordpress Custom Minor Mode Manually
(use-package wordpress
  :load-path ("~/.emacs.d/elpa-offline/wordpress")

  :init
  ;; Turn on `Wordpress mode and snippets when web-mode on.
  (add-hook 'web-mode-hook (lambda ()
                 (wordpress-mode 1)
                 (yas-activate-extra-mode 'wordpress-mode )
                 )
        )

 )

Just to clarify, everything works fine, but everytime I open Emacs I get an error:

Error (use-package): wordpress/:catch: Required feature ‘wordpress’ was not provide

I tried removing the lambda function and leaving just the load-path and enabling the minor mode by hand with M-x wordpress-mode. I still get the same error on Emacs opening.

1

(provide 'wordpress-mode) provides a feature named wordpress-mode and your use-package config clearly wants to (require 'wordpress) and is, naturally, failing to do so.

Check the use-package documentation -- I'm sure there's a simple way to specify that the feature symbol name and the library name are not the same. Without use-package, this would be: (require 'wordpress-mode "wordpress")

Or just (provide 'wordpress) instead -- it's your library, after all, so you can call the feature whatever you want to.

  • (provide 'wordpress) did the trick, now I got no error or warning. Thank you – Fabman Jul 10 '18 at 12:36

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.