[Tex/LaTex] AUCTeX/Emacs not recognizing correct commands automatically

auctexbibtexemacspdftex

On my previous OS install, Debian Squeeze with FluxBox, my workflow was as follows:

With *.bib file open, I enter C-c C-c. The BibTeX command was recognized as necessary and ret executed it.

Then I would go back to the *.tex document, C-c C-c, and AUCTeX would recognize to execute LaTeX, C-c C-c again, and AUCTex would recognize to execute BibTeX, and a few more C-c C-c's and the PDF with bibliography would be viewed.

I recently updated the operating system to Debian Sid with xfce. Everything is working fine except that when I have a *.bib file open C-c C-c only brings up the View command. When a *.tex file is open the BibTeX command is never brought up using C-c C-c. However, when I enter the proper command manually everything works fine.

My .emacs is:

(set-face-foreground 'font-lock-comment-face "light blue")

(setq-default auto-fill-mode t)
(setq fill-column 120)

(setq make-backup-files nil)
(setq auto-save-default nil)

(setq auto-mode-alist (cons '("\\.\\(pde\\|ino\\)$" . arduino-mode) auto-mode-alist))
(autoload 'arduino-mode "arduino-mode" "Arduino editing mode." t)

(setq auto-mode-alist (cons '("\\.m$" . matlab-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.oct$" . matlab-mode) auto-mode-alist))

(setq auto-mode-alist (cons '("\\.tex$" . TeX-latex-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.bib$" . TeX-latex-mode) auto-mode-alist))

(setq auto-mode-alist (cons '("\\.f03$" . fortran-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.f90$" . fortran-mode) auto-mode-alist))

(defun pdfevince ()
  (add-to-list 'TeX-output-view-style
               (quote ("^pdf$" "." "evince %o %(outpage)")))
)

(add-hook 'LaTeX-mode-hook 'pdfevince t)

(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'auto-fill-mode)
(add-hook 'tex-mode-hook 'auto-fill-mode)
(add-hook 'tex-mode-hook 'flyspell-mode)
(add-hook 'bibtex-mode-hook 'flyspell-mode)

(add-hook 'LaTeX-mode-hook (lambda () (set-fill-column 120)))
(add-hook 'teX-mode-hook (lambda () (set-fill-column 120)))

(line-number-mode 1)
(column-number-mode 1)

(global-hl-line-mode 1)

Greatly indebted to any advice on this problem.

Best Answer

Nothing is wrong with your init file. You need to configure AucTeX with the option ./configure <tab>--with-emacs, then just make and sudo make install.

Of course, in a perfect world emacs ought to be compiled by the user. But either way, this is assuming that your emacs is working as it should.

As a side note, you can always (add-to-list 'load-path "~/path/to/auctex-11.87/"), verify it with C-x C-e.

The easiest way to test it out, since we are dealing with bib files, is to make a small change in the bib file, say in one of the fields of either the author, or in the title of a miscellaneous item, or article, or book or whatever, and remember to save this bib file. Then go to your tex file and invoke C-c C-c again. It should return Command: (default BibTeX).

If it does not return the above Command: (default BibTeX) immediately, then, either your emacs was not compiled as it should have been compiled, or AucTeX needs to be compiled by one of the other options as outlined in http://www.gnu.org/software/auctex/manual/auctex.html#Installation .