2

I'm trying to modify the package ediprolog, which was installed and working before, with use-package, from ELPA. I copied the file from the elpa folder to a folder called ediprolog.el and used:

(use-package ediprolog
    :load-path "./extern/") 

The problem is now I'm getting an error saying

File mode specification error: (error Autoloading file ~/.emacs.d/extern/ediprolog.el failed to define function ediprolog)

(even with the original code for ediprolog.el). Further, even if I remove the :load-path and try to load the package from ELPA, I still get the same error. Also, even though it fails, it seems to find functions like ediprolog-dwim which has an autoload cookie and is defined in that file, but they don't work.

(I have tried deleting the elpa folder and redownloading all the packages, removing only the ediprolog folder and removing ediprolog from the list of selected packages, but still the same results)

How can I make use-package load the package properly again?


Adding

;;;###autoload (defun ediprolog ())

in the file makes the error go away, but this doesn't seem like the correct thing to do.

7
  • Is ".ediprolog/" a directory in your user-emacs-directory? If not, you might need to provide the absolute path to that directory.
    – andrej
    Dec 6, 2018 at 12:55
  • It's finding the file. It's able to pull in at least the names of the functions, like ediprolog-dwim Dec 6, 2018 at 12:57
  • Are you sure that it is finding the file from that load-path? Could be that package-initialize or something is loading your library from elpa. Try to delete the package and only use the use-package declaration. Note that in the elpa directory the file ediprolog-autoloads.el is produced during the installation.
    – andrej
    Dec 6, 2018 at 14:13
  • @andrej Please see my edit. I removed it from the list of selected packages and it's still the same Dec 6, 2018 at 22:10
  • @Fólkvangr Yes, but how do I fix it? It doesn't say that when loading from elpa Dec 7, 2018 at 10:03

1 Answer 1

1

Your load path is saying :load-path "./ediprolog/", the error is saying ~/.emacs.d/extern/ediprolog.el I assume that ediprolog.el is found because the directory ~/.emacs.d/extern/ is in the load-path.

In your use-package declaration you tell emacs to look for it somewhere else, namely in ~/.emacs.d/.ediprolog/. I think in your case (require 'ediprolog) would be enough, or try :load-path "/extern"

The following declaration works for me without any errors:

(use-package ediprolog
:load-path "~/extern/ediprolog")

Note that here ediprolog is a directory in which the file ediprolog.el is found.

EDIT: If ediprolog.el is in ~/.emacs.d/extern/ then

(use-package ediprolog
 :load-path "extern")

should work.

5
  • Sorry, that was a mistake on my part, I forgot to update that part of the question. Thank you for the answer, but it doesn't solve the problem; yes require probably would work, but I want to use use-package, because it makes the configuration much cleaner. So, yeah, even after completely purging and reinstalling emacs and cleaning the elpa dir and everything else, I still get this error unless I add an empty definition of a function named ediprolog Dec 7, 2018 at 9:55
  • 1
    So can you update the question and include the minimal part of your configuration that reproduces the error. Also tell us where exactly the file is that you want to load. Is it its own directory or is it in ` ~/.emacs.d/extern/`? Otherwise it is difficult to help.
    – andrej
    Dec 7, 2018 at 11:43
  • 1
    I've updated it already. It's in ~/.emacs.d/extern/ediprolog.el Dec 7, 2018 at 11:45
  • It says in the question "I copied the file from the elpa folder to a folder called ediprolog.el" Also is the folder extern already in your load path?
    – andrej
    Dec 7, 2018 at 11:47
  • Thank you for the help, but Fólkvangr 's comment seems to have done the trick. emacs.stackexchange.com/questions/46345/… still don't know why, though... Dec 7, 2018 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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