3

I have just install a version of emacs (GNU Emacs 24.5.1 i686-pc-mingw32) on a Windows 8 Machine. On trying to open an example SML file (Standard ML Language). An error occurred:

File mode specification error: (error "Autoloading failed to define function sml-mode")

On deeper inspection the debugger shows this:

Debugger entered--Lisp error: (error "Autoloading failed to define function sml-mode")
sml-mode()
set-auto-mode-0(sml-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(# "g:/example00.sml" nil nil "g:/example00.sml" ((512 4 . 8192) (48259 . 42323)))
find-file-noselect("g:/example00.sml" nil nil nil)
find-file("g:/example00.sml")
find-file-existing("g:/example00.sml")
menu-find-file-existing()
call-interactively(menu-find-file-existing nil nil)
command-execute(menu-find-file-existing)

How can I resolve this error?

Edit : I installed sml-mode via list-packages.

6
  • Is the directory that contains the library that defines sml-mode in your load-path? If not, that's your problem. Commented Feb 20, 2017 at 18:02
  • @Drew How do I do that? (To be honest, I am very new to using emacs.) Commented Feb 20, 2017 at 18:04
  • See the Emacs manual, node Lisp Libraries. In a nutshell, you use (add-to-list 'load-path "/path/to/your/directory/") and then you use (require 'the-library). Commented Feb 20, 2017 at 18:12
  • If you installed the library using the package interface then be sure to use (package-initialize). In that case, you should not need to fiddle with load-path and require. Commented Feb 20, 2017 at 18:13
  • 1
    Put that in your init file. Start by reading about your init file. Commented Feb 20, 2017 at 21:35

1 Answer 1

8

This is a problem of conflicting libraries in load-path. I think you should inspect your load-path to see if you have sml-mode directory in it twice. The first directory probably doesn't contain a definition for sml-mode and hence Emacs fails to load it from there.

You can do M-x list-load-path-shadows to see if some sml-mode like file is shadowing the original file with the right definitions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.