[OS X Emacs] Wiki code not working: Symbol's function definition is void: guess-TeX-master

Marius Hofert m_hofert at web.de
Sat Sep 10 15:24:54 EDT 2011


Dear all,

I put in the following code from http://www.emacswiki.org/emacs/AUCTeX#toc17 into my Preferences.el:

(setq TeX-master (guess-TeX-master (buffer-file-name)))
(defun guess-TeX-master (filename)
      "Guess the master file for FILENAME from currently open .tex files."
      (let ((candidate nil)
            (filename (file-name-nondirectory filename)))
        (save-excursion
          (dolist (buffer (buffer-list))
            (with-current-buffer buffer
              (let ((name (buffer-name))
                    (file buffer-file-name))
                (if (and file (string-match "\\.tex$" file))
                    (progn
                      (goto-char (point-min))
                      (if (re-search-forward (concat "\\\\input{" filename "}") nil t)
                          (setq candidate file))
                      (if (re-search-forward (concat "\\\\include{" (file-name-sans-extension filename) "}") nil t)
                          (setq candidate file))))))))
        (if candidate
            (message "TeX master document: %s" (file-name-nondirectory candidate)))
        candidate))

When opening Aquamacs, I obtain:

An error has occurred while loading `~/Library/Preferences/Aquamacs Emacs/Preferences.el (or .elc)':
Symbol's function definition is void: guess-TeX-master

What is wrong with the code on the wiki page?

Cheers,

Marius


More information about the MacOSX-Emacs mailing list