[OS X Emacs] Wiki code not working: Symbol's function

Hofert Jan Marius marius.hofert at math.ethz.ch
Mon Sep 12 09:26:07 EDT 2011


Dear Win,

thanks a lot for your answer. I tried your approach and obtained:

An error has occurred while loading `~/Library/Preferences/Aquamacs Emacs/Preferences.el (or .elc)':

Wrong type argument: symbolp, (quote LaTeX-mode-hook)

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

Do you know what went wrong? This is the part in my Preferences.el:

(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))
(setq 'LaTeX-mode-hook
	'(lambda ()
		(setq TeX-master (guess-TeX-master (buffer-file-name)))))

The same question/problem was asked here: http://stackoverflow.com/questions/6222030/guess-tex-master-bug
But also without working solution.
Sorry I can't be of more help, I only started using emacs a couple of days ago. But it's really nice and I guess I am slowly getting used to this "hook mechanism".

Cheers,

Marius


More information about the MacOSX-Emacs mailing list