Mercurial > emacs
comparison lisp/international/latexenc.el @ 68418:0927d6785ca7
(latexenc-find-file-coding-system): Make sure latexenc-main-file is
a regular file and is readable.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 27 Jan 2006 19:24:00 +0000 |
parents | d6c3138b1287 |
children | c72649ca09b5 |
comparison
equal
deleted
inserted
replaced
68417:01a242622a33 | 68418:0927d6785ca7 |
---|---|
154 (dolist (ext `("" ,(if (boundp 'TeX-default-extension) | 154 (dolist (ext `("" ,(if (boundp 'TeX-default-extension) |
155 (concat "." TeX-default-extension) | 155 (concat "." TeX-default-extension) |
156 "") | 156 "") |
157 ".tex" ".ltx" ".dtx" ".drv")) | 157 ".tex" ".ltx" ".dtx" ".drv")) |
158 (if (and (null latexenc-main-file) ;Stop at first. | 158 (if (and (null latexenc-main-file) ;Stop at first. |
159 (file-exists-p (concat file ext))) | 159 (file-regular-p (concat file ext)) |
160 (file-readable-p (concat file ext))) | |
160 (setq latexenc-main-file (concat file ext))))))) | 161 (setq latexenc-main-file (concat file ext))))))) |
161 ;; try tex-modes tex-guess-main-file | 162 ;; try tex-modes tex-guess-main-file |
162 (when (and (not latexenc-dont-use-tex-guess-main-file-flag) | 163 (when (and (not latexenc-dont-use-tex-guess-main-file-flag) |
163 (not latexenc-main-file)) | 164 (not latexenc-main-file)) |
164 ;; Use a separate `when' so the byte-compiler sees the fboundp. | 165 ;; Use a separate `when' so the byte-compiler sees the fboundp. |
165 (when (fboundp 'tex-guess-main-file) | 166 (when (fboundp 'tex-guess-main-file) |
166 (let ((tex-start-of-header "\\\\document\\(style\\|class\\)")) | 167 (let ((tex-start-of-header "\\\\document\\(style\\|class\\)")) |
167 (setq latexenc-main-file (tex-guess-main-file))))) | 168 (setq latexenc-main-file (tex-guess-main-file))))) |
168 ;; if we found a master/main file get the coding system from it | 169 ;; if we found a master/main file get the coding system from it |
169 (if (and latexenc-main-file | 170 (if (and latexenc-main-file |
170 (file-regular-p latexenc-main-file) | 171 (file-regular-p latexenc-main-file) |
171 (file-readable-p latexenc-main-file)) | 172 (file-readable-p latexenc-main-file)) |
172 (let* ((latexenc-dont-use-tex-guess-main-file-flag t) | 173 (let* ((latexenc-dont-use-tex-guess-main-file-flag t) |
173 (latexenc-dont-use-TeX-master-flag t) | 174 (latexenc-dont-use-TeX-master-flag t) |
174 (latexenc-main-buffer | 175 (latexenc-main-buffer |
175 (find-file-noselect latexenc-main-file t))) | 176 (find-file-noselect latexenc-main-file t))) |