Subject: bug#5562: Emacs 23.1 problem with "tex-bibtex-file" command

From: "Roland Winkler" <[email-masked]>
Date: Sat, 13 Feb 2010 20:04:01 -0600

On Sat Feb 13 2010 Chong Yidong wrote:
> Hi Roland, could you take a look at this bug report?  I'm not sure there
> is enough info to reproduce, but I'm not familiar with bibtex-mode.
> Thanks.
> 
> > In Emacs LaTeX mode, whenever I tried to invoke bibtex command on the
> > current file by using C-c Tab (equivalent to issusing command
> > "tex-bibtex-file"), emacs changed the current directory to the home
> > directory and thus not being able to find the corresponding *.aux
> > file.
> >
> > Note that I was actually using Emacs LaTeX mode, not AucTeX mode.

I can reproduce the bug easily with "emacs -q" for all my LaTeX
files. (Usually I use auctex instead of tex-mode.) But it's not
clear to me, what the code is supposed to do. tex-bibtex-file calls
tex-main-file, which returns a relative filename. If there is just
one LaTeX file, it is this file's name (without any directory). But
then the working directory for the bibtex command is what
file-name-directory returns for the relative file name returned by
tex-main-file. This directory is usually nil. So the working
directory for the bibtex command becomes the $HOME directory and
bibtex fails.

I suggest, someone should look at this who is more familiar with
what tex-mode.el is supposed to do. This is a bug that should be
fixed before the next release.