]> code.delx.au - gnu-emacs/blobdiff - lisp/international/latexenc.el
Merged from emacs@sv.gnu.org
[gnu-emacs] / lisp / international / latexenc.el
index 15a0d1067e1c8f9b3c2e9f2ef911fe5938a177c5..e19cff0eacef1a5bd39849fbcf2b36ca0e31395c 100644 (file)
@@ -1,6 +1,6 @@
-;;; latexenc.el --- guess correct coding system in LaTeX files
+;;; latexenc.el --- guess correct coding system in LaTeX files -*-coding: iso-2022-7bit -*-
 
-;; Copyright (C) 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Arne J\e,Ax\e(Brgensen <arne@arnested.dk>
 ;; Keywords: mule, coding system, latex
@@ -63,7 +63,7 @@
     ("cp437" . cp437) ; IBM code page 437: 225 is \beta
     ("cp850" . cp850) ; IBM code page 850
     ("cp852" . cp852) ; IBM code page 852
-    ;; ("cp858" . undecided) ; IBM code page 850 but with a euro symbol
+    ("cp858" . cp858) ; IBM code page 850 but with a euro symbol
     ("cp865" . cp865) ; IBM code page 865
     ;; The DECMultinational charaterset used by the OpenVMS system
     ;; ("decmulti" . undecided)
@@ -78,7 +78,7 @@
     ("next" . next) ; The Next encoding
     ("utf8" . utf-8)
     ("utf8x" . utf-8)) ; used by the Unicode LaTeX package
-  "Mapping from LaTeX encodings to Emacs coding systems.
+  "Mapping from LaTeX encodings in \"inputenc.sty\" to Emacs coding systems.
 LaTeX encodings are specified with \"\\usepackage[encoding]{inputenc}\".
 Used by the function `latexenc-find-file-coding-system'."
   :group 'files
@@ -138,8 +138,14 @@ coding system names is determined from `latex-inputenc-coding-alist'."
                ((and (require 'code-pages nil t) (coding-system-p sym)) sym)
                (t 'undecided)))
           ;; else try to find it in the master/main file
-          (let ((default-directory (file-name-directory (nth 1 arg-list)))
-                latexenc-main-file)
+
+         ;; Fixme: If the current file is in an archive (e.g. tar,
+         ;; zip), we should find the master file in that archive.
+         ;; But, that is not yet implemented.   -- K.Handa
+          (let ((default-directory (if (stringp (nth 1 arg-list))
+                                      (file-name-directory (nth 1 arg-list))
+                                    default-directory))
+               latexenc-main-file)
             ;; Is there a TeX-master or tex-main-file in the local variables
             ;; section?
             (unless latexenc-dont-use-TeX-master-flag
@@ -167,6 +173,7 @@ coding system names is determined from `latex-inputenc-coding-alist'."
                   (setq latexenc-main-file (tex-guess-main-file)))))
             ;; if we found a master/main file get the coding system from it
             (if (and latexenc-main-file
+                     (file-regular-p latexenc-main-file)
                      (file-readable-p latexenc-main-file))
                 (let* ((latexenc-dont-use-tex-guess-main-file-flag t)
                        (latexenc-dont-use-TeX-master-flag t)