1

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
phils
  • 71,335
  • 11
  • 153
  • 198
mark4rd
  • 255
  • 5
  • 12
  • 1
    The error indicates that `tuareg-imenu.el` is not in one of the directories specified by `load-path`. Please copy your settings into the question and we might be able to help. – sds Jun 16 '14 at 20:54
  • What settings do you mean? This happens both on emacs 23 and 24.I forgot to mention that the error message apears when I open an .ml programm with emacs. I edited the question. – mark4rd Jun 16 '14 at 21:05
  • copy and paste the relevant parts of your `.emacs` as well as the value of `load-path`. – sds Jun 16 '14 at 21:08
  • What does the README file tell you to do? The presence of Makefile suggests you might need to run `make`. – Dan Jun 16 '14 at 22:05

2 Answers2

3

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

phils
  • 71,335
  • 11
  • 153
  • 198
  • Thanks. Putting comments fixes the error message. When i press M-x imenu the result is the same as with every other mode , it moves the cursor to the function I type in the minibuffer. I assume autoload 'tuareg-imenu... would add an extra functionality or something like that. What I finally did was what you described in your edit with marmalade and now everything works fine . I still cant see any difference in imenu functionality . Finally the M-x package-install [RET] tuareg didn't find the package , but I installed it from the package list after pressing the M-x list-package command. – mark4rd Jun 17 '14 at 15:59
0

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)
Netsu
  • 355
  • 4
  • 13