0

I have a package which has various features that depend on AUCTeX. As it stands, it requires hand-configuration:

(defvar AucTeX-used nil)

(if AucTeX-used
  (progn
    (require 'tex-site)
    (require 'latex))
  (require 'latex-mode)
  (setq TeX-command-list nil))

Is there a way to find out whether AUCTeX is available on the machine, to avoid having to set AucTeX-Used by hand?

(I'm using GNU Emacs 23.1.1 for Max OS X).

Simon Wright
  • 25,108
  • 2
  • 35
  • 62

3 Answers3

3

You can use the locate-library function and do this:

(if (locate-library "auctex")
  (progn
    (require 'tex-site)
    (require 'latex))
  (require 'latex-mode)
  (setq TeX-command-list nil))
Nathaniel Flath
  • 15,477
  • 19
  • 69
  • 94
1

Another possibility would be:

(if (require 'tex-site nil t)
    (require 'latex)
  (require 'latex-mode) 
  (setq TeX-command-list nil))

If the optional third argument of require is non-nil, then require will return nil if the file is not found instead of signaling an error

Rémi
  • 8,172
  • 2
  • 27
  • 32
1

Another less demanding possibility would be to use

(featurep 'tex-site)

which is true/false depending on if AUCTeX has been loaded or not.

vitaminace33
  • 133
  • 6