Since I have an Ubuntu system with multiple versions of TeXlive
installed from DVD as well as native TeX support, I use the following
command for switching around:

(defun TeXlive (year)
  "Use TeXlive with the given year (given as string), nil if no TeXlive."
  (interactive
   (let* ((year
           (directory-files "/usr/local/texlive/" nil "\\`[0-9]+\\'")))
     (setq year
           (completing-read (format "Year to use (default %s): "
                                    (car (last year)))
                            (cons "none" year)
                            nil t nil nil (car (last year))))
     (list (unless (string= year "none") year))))
  (let ((path (getenv "PATH")))
    (while (string-match "/usr/local/texlive/[0-9]+/bin/[^:/]*:" path)
      (setq path (replace-match "" t t path)))
    (when year
      (let* ((dir (format "/usr/local/texlive/%s/bin" year))
             (defs (directory-files dir nil "\\`[-a-zA-Z0-9_]+\\'"))
             (arch (cond ((null defs) (error "No architectures in %s" dir))
                         ((null (cdr defs)) (car defs))
                         (t
                          (completing-read "Architecture? " defs nil t nil nil 
defs)))))
        (setq path (concat dir "/" arch ":" path))))
    (setenv "PATH" path)))

It's pretty handy to have but likely somewhat system-dependent.

-- 
David Kastrup

_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to