I'm trying to use the guess-TeX-master function (from emacswiki auctex) but I get this error:
Wrong type argument: stringp, nil
My elisp knowledge is quite poor. Does somebody know the problem?
[EDIT]
This error was because I forgot do it the latex hook.
Anyway I trying to do something different. I want to find the file (in the same directory) that has the "begin{document}". Because my elisp skills are poor, I do it in a script:
In my .emacs:
(add-hook 'LaTeX-mode-hook (lambda () (setq TeX-master (execvp "guess-TeX-master" (file-name-directory (buffer-file-name))))))
execvp defun is here: http://www.emacswiki.org/emacs/ExecuteExternalCommand
The guess-TeX-master script is:
grep "begin{document}" $1/*.tex | cut -d ':' -f 1 | tr -d '\n'
How to do the same using elisp only?
M-x toggle-debug-on-error RET
, and then trigger the error again. That will provide you with a stack trace. If you post the contents of the stack trace, that would help to debug the issue. – phils