2000-12-02 Stefan Monnier <monnier@cs.yale.edu>
+ * textmodes/tex-mode.el (tex-start-shell): Obey shell-file-name.
+ (tex-main-file, tex-file): Simplify.
+ (tex-generate-zap-file-name): Use subst-char-in-string.
+ (tex-strip-dots): Remove.
+
* tmm.el (tmm-get-keymap): Eval the menu name in `menu-item'.
* textmodes/ispell.el (check-ispell-version): Don't use match-beginning
(with-current-buffer
(make-comint
"tex-shell"
- (or tex-shell-file-name (getenv "ESHELL") (getenv "SHELL") "/bin/sh")
+ (or tex-shell-file-name (getenv "ESHELL") shell-file-name)
nil)
(let ((proc (get-process "tex-shell")))
(set-process-sentinel proc 'tex-shell-sentinel)
(re-search-forward header-re 10000 t)))
(throw 'found (expand-file-name buffer-file-name))))))))
-(defun tex-main-file (&optional realfile)
- "Return the name of the main file with the `.tex' extension stripped.
-If REALFILE is non-nil, return the pair (FILE . REALFILE) where FILE
-is the filename without the extension while REALFILE is the filename
-with extension."
+(defun tex-main-file ()
+ "Return the relative name of the main file."
(let* ((file (or tex-main-file
;; Compatibility with AUCTeX.
(and (boundp 'TeX-master) (stringp TeX-master)
;; This isn't the main file, let's try to find better,
(or (tex-guess-main-file)
;; (tex-guess-main-file t)
- buffer-file-name))))))
- (real (if (file-exists-p file) file (concat file ".tex"))))
- (when (string-match "\\.tex\\'" file)
- (setq file (substring file 0 (match-beginning 0))))
- (if realfile (cons file real) file)))
+ buffer-file-name)))))))
+ (if (file-exists-p file) file (concat file ".tex"))))
(defun tex-start-tex (command file &optional dir)
`.aux' file of LaTeX to have the correct name."
(interactive)
(let* ((source-file (tex-main-file))
- (file-dir (expand-file-name (or (file-name-directory source-file)
- default-directory))))
+ (file-dir (file-name-directory (expand-file-name source-file))))
(if tex-offer-save
(save-some-buffers))
(if (tex-shell-running)
;; don't work with file names that start with #.
(format "_TZ_%d-%s"
(process-id (get-buffer-process "*tex-shell*"))
- (tex-strip-dots (system-name))))
-
-(defun tex-strip-dots (s)
- (setq s (copy-sequence s))
- (while (string-match "\\." s)
- (aset s (match-beginning 0) ?-))
- s)
+ (subst-char-in-string ?. ?- (system-name))))
;; This will perhaps be useful for modifying TEXINPUTS.
;; Expand each file name, separated by colons, in the string S.