auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] TeXlive command


From: David Kastrup
Subject: [AUCTeX] TeXlive command
Date: Fri, 30 Aug 2013 15:15:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]