emacs : file mode specification error

3.4k Views Asked by At

I want to install tuareg-mode for emacs and I followed these instructions.

I have downloaded the tuareg-2.0.7 version which contains the following: Makefile,ocamldebug.el,README,tuareg.el,tuareg-pkg.el,tuareg-site-file.el.

I copied all those contents here ~/.elisp/tuareg-mode as described and I configured the .emacs file as explained. When i open a .ml file with emacs i get this error:

file mode specification error : (file-error "Cannot open load file" "tuareg-imenu")

Does anybody know how to fix it ?

In detail :

.emacs :

(add-to-list 'load-path "~/.elisp/tuareg-mode")

(autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)

(autoload 'camldebug "camldebug" "Run the Caml debugger" t)

(autoload 'tuareg-imenu-set-imenu "tuareg-imenu"
  "Configuration of imenu for tuareg" t)

(add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu)

(setq auto-mode-alist
        (append '(("\\.ml[ily]?$" . tuareg-mode)
              ("\\.topml$" . tuareg-mode))
                  auto-mode-alist))

path where tuareg-2.0.7 contents are copied : ~/.elisp/tuareg-mode


contents of ~/.elisp/tuareg-mode :

Makefile
ocamldebug.el
README
tuareg.el
tuareg-pkg.el
tuareg-site-file.el
2

There are 2 best solutions below

1
On BEST ANSWER

Looks like the Emacs Wiki page is out of date?

Comment out the imenu-related lines, like so:

;; (autoload 'tuareg-imenu-set-imenu "tuareg-imenu"
;;  "Configuration of imenu for tuareg" t)
;;
;; (add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu)

If that works, and if you still have imenu functionality, you could edit that Wiki page accordingly.

Edit: The package on the Marmalade repo looks like it's up to date, so you're probably best to remove what you downloaded, and the .emacs changes, and install it from there.

See http://marmalade-repo.org/ and then:

M-x package-install RET tuareg RET

0
On

Looks like caml-mode is deprecated, and caml-create-index-function is unavailable. So, imenu support in tuareg-mode now broken. But there's a workaround:

(defalias 'tuareg-imenu-create-index 'merlin-imenu-create-index)