When I run cal-tex-cursor-month in calendar mode, I'm supposed to get a LaTeX 
calendar buffer for the month the cursor is on. This works as expected with 
emacs -Q, but in my setup (using auctex), I'm getting a "Wrong type argument: 
stringp, nil" error.

As far as I can tell by turning debugging on, here's whats happening.

cal-tex-cursor-month calls latex-mode, which activates the auctex provided mode 
for me.

This eventually leads to a call to reftex-TeX-master-file, which correctly 
determines that auctex is loaded (instead of the default Emacs latex mode), and 
calls TeX-master-file.

Early on in TeX-master-file, there is this code.

  (let ((my-name (if (buffer-file-name)
                     (TeX-strip-extension nil (list TeX-default-extension) t)
                   "<none>")))

I'm guessing the main cause of the problem is that the buffer in which the 
LaTeX code has been dumped is called calendar.tex, but hasn't been saved yet, 
so (buffer-file-name) returns nil.

I haven't been able to fully understand what's going on in the rest of 
TeX-master-file, but it appears to return <none>.tex as master to 
reftex-TeX-master-file.

Because master is not nil, the (null master) check (line 383 of reftex.el in my 
version) fails, and I don't get the "Need a filename for this buffer, please 
save it first" error. Instead, reftex-TeX-master-file calls (expand-file-name 
nil) at the end, which dies with the "Wrong type argument: stringp, nil" error.

Sorry for that loong story. What's the quickest way to fix this? And what would 
be the "best" way to fix this: in cal-tex-cursor-month, reftex-TeX-master-file, 
or TeX-master-file?

Thanks for any suggestions!
-mandar

Reply via email to