1
votes

Since I updated to emacs 24 I cannot get AUCTeX to load the LaTeX-mode hooks, e.g.

(add-hook 'LaTeX-mode-hook 'visual-line-mode)

despite:

  1. C-h m tells me that my major mode is Major mode in AUCTeX for editing LaTeX files.
  2. the AUCTeX mode help states:

    Entering LaTeX mode calls the value of `text-mode-hook',
    then the value of `TeX-mode-hook', and then the value
    of `LaTeX-mode-hook'.
    

    (Indeed, the text-mode hooks are not loaded either.)

Hooks for other modes (e.g. for Markdown or Python) do work.

And, of course, I have tested that manual activation, e.g. M-x visual-line-mode, does work.

Thanks!

2
You might need to recompile the package auctex. The easiest way to do this is uninstall and reinstall from the package manager.Andrew Swann

2 Answers

0
votes

This is strange C-hm gives me

Entering Latex mode runs the hook text-mode-hook', then tex-mode-hook', and finally `latex-mode-hook'.

Notice that it is latex-mode-hook and not LaTeX-mode-hook.

EDIT - I do not have auctex installed maybe that explains why the help messages are different for us, ignore the part above. You can try the below as an alternative

(add-hook 'latex-mode-hook 'visual-line-mode)
0
votes

As is noted in the comments in the other answer, this issue is caused by AucTeX being unable to create XPM images. This occurs when when Emacs is not compiled with the libxpm library, which might be the case when you run Emacs primarily inside your favorite terminal emulator.

Anyways, you can still correct this issue without recompiling Emacs. In fact, the images are only used for the AucTeX toolbar. Thus, disabling it will effectively remove the problem altogether. You can do this by adding:

(unless (image-type-available-p 'xpm)
  (setq LaTeX-enable-toolbar nil))

To your .emacs (or .emacs.d/init.el) file.

This snippet simply checks if XPM images are available in the Emacs installation and if not, it disables the toolbar.