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

Win Treese treese at acm.org
Sun Sep 11 19:44:43 EDT 2011


On Sep 11, 2011, at 3:55 PM, Marius Hofert wrote:

> Dear Win,
> 
> thanks a lot for your help. I changed the code accordingly. On starting Aquamacs, I obtain:
> 
> Loading prestart plugin files ...
> ... done.
> Shell: /bin/bash
> Loading `emulate-mac-keyboard-mode': old-style backquotes detected!
> Loading /Users/mhofert/Library/Preferences/Aquamacs Emacs/Recent Files.el (source)...done
> Cleaning up the recentf list...
> 25 environment variables imported from login shell (/bin/bash).
> Loading /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/auctex.el (source)...done
> Loading plugins ...
> Loading /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start.el (source)...done
> ... done.
> Loading /Users/mhofert/Library/Preferences/Aquamacs Emacs/customizations.el (source)...done
> Loading /Users/mhofert/Library/Preferences/Aquamacs Emacs/Preferences.el (source)...
> 
> 
> An error has occurred while loading `~/Library/Preferences/Aquamacs Emacs/Preferences.el (or .elc)':
> 
> Wrong type argument: stringp, nil

Marius,

Ah, I replied too quickly, and I should have looked at the wiki page. The key part is:

	An alternative is to add the following line to your latex-mode-hook:

   		 (setq TeX-master (guess-TeX-master (buffer-file-name)))

What this is saying is that you want to arrange for Emacs to run guess-TeX-master when it open
a TeX file, not at startup. The function definition (the part with the defun) does get run at startup.

Emacs uses a technique called "hooks" for this, and most major modes define a variable that lists
functions to be run when a file using that major mode is opened. What you want to do here, I think,
is add the line:

(setq 'LaTeX-mode-hook
	'(lambda ()
		(setq TeX-master (guess-TeX-master (buffer-file-name)))))

AUCTeX uses the hook named LaTeX-mode-hook instead of the one given on the wiki page.

(I also updated the spelling on the wiki page.)

Hope this helps,

Win




More information about the MacOSX-Emacs mailing list