Hi Arash,

> I installed my proposed change incl. comments from Stefan with commit
> 22daed7c.

With this commit, when I try to open any .tex file (existing or not), I
get "(wrong-type-argument sequencep t)" errors like those in the
attached backtrace (reproduced with emacs -Q).  My TeX-master value is
t.  The patch below seems to do the trick (but I'll confess that I
haven't studied the "big picture" here).

Paul

diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el
index fea5be6dbd7..f7dd1452ca0 100644
--- a/lisp/international/latexenc.el
+++ b/lisp/international/latexenc.el
@@ -158,13 +158,14 @@ latexenc-find-file-coding-system
                               (match-string 2)
                             (or (bound-and-true-p TeX-master)
                                 (bound-and-true-p tex-main-file)))))
-                (dolist (ext `("" ,(if (boundp 'TeX-default-extension)
-                                       (concat "." TeX-default-extension)
-                                     "")
-                               ".tex" ".ltx" ".dtx" ".drv"))
-                  (if (and (null latexenc-main-file) ;Stop at first.
-                           (file-exists-p (concat file ext)))
-                      (setq latexenc-main-file (concat file ext))))))
+                (when (stringp file)
+                  (dolist (ext `("" ,(if (boundp 'TeX-default-extension)
+                                         (concat "." TeX-default-extension)
+                                       "")
+                                 ".tex" ".ltx" ".dtx" ".drv"))
+                    (if (and (null latexenc-main-file) ;Stop at first.
+                             (file-exists-p (concat file ext)))
+                        (setq latexenc-main-file (concat file ext)))))))
             ;; try tex-modes tex-guess-main-file
             (when (and (not latexenc-dont-use-tex-guess-main-file-flag)
                        (not latexenc-main-file))
Debugger entered--Lisp error: (wrong-type-argument sequencep t)
  concat(t "")
  (file-exists-p (concat file ext))
  (and (null latexenc-main-file) (file-exists-p (concat file ext)))
  (if (and (null latexenc-main-file) (file-exists-p (concat file ext))) (setq 
latexenc-main-file (concat file ext)))
  (let ((ext (car tail))) (if (and (null latexenc-main-file) (file-exists-p 
(concat file ext))) (setq latexenc-main-file (concat file ext))) (setq tail 
(cdr tail)))
  (while tail (let ((ext (car tail))) (if (and (null latexenc-main-file) 
(file-exists-p (concat file ext))) (setq latexenc-main-file (concat file ext))) 
(setq tail (cdr tail))))
  (let ((tail (cons "" (cons (if (boundp 'TeX-default-extension) (concat "." 
TeX-default-extension) "") '(".tex" ".ltx" ".dtx" ".drv"))))) (while tail (let 
((ext (car tail))) (if (and (null latexenc-main-file) (file-exists-p (concat 
file ext))) (setq latexenc-main-file (concat file ext))) (setq tail (cdr 
tail)))))
  (let ((file (if (re-search-forward "^%+ *\\(TeX-master\\|tex-main-file\\): 
*\"\\(.+\\)\"" nil t) (match-string 2) (or (and (boundp 'TeX-master) 
TeX-master) (and (boundp 'tex-main-file) tex-main-file))))) (let ((tail (cons 
"" (cons (if (boundp ...) (concat "." TeX-default-extension) "") '(".tex" 
".ltx" ".dtx" ".drv"))))) (while tail (let ((ext (car tail))) (if (and (null 
latexenc-main-file) (file-exists-p (concat file ext))) (setq latexenc-main-file 
(concat file ext))) (setq tail (cdr tail))))))
  (if latexenc-dont-use-TeX-master-flag nil (goto-char (point-max)) 
(search-backward "\n\f" (max (- (point-max) 3000) (point-min)) 'move) 
(re-search-forward "^%+ *Local Variables:" nil t) (let ((file (if 
(re-search-forward "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" nil 
t) (match-string 2) (or (and (boundp ...) TeX-master) (and (boundp ...) 
tex-main-file))))) (let ((tail (cons "" (cons (if ... ... "") '...)))) (while 
tail (let ((ext (car tail))) (if (and (null latexenc-main-file) (file-exists-p 
...)) (setq latexenc-main-file (concat file ext))) (setq tail (cdr tail)))))))
  (let ((default-directory (if (stringp (nth 1 arg-list)) (file-name-directory 
(nth 1 arg-list)) default-directory)) latexenc-main-file) (if 
latexenc-dont-use-TeX-master-flag nil (goto-char (point-max)) (search-backward 
"\n\f" (max (- (point-max) 3000) (point-min)) 'move) (re-search-forward "^%+ 
*Local Variables:" nil t) (let ((file (if (re-search-forward "^%+ 
*\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" nil t) (match-string 2) (or 
(and ... TeX-master) (and ... tex-main-file))))) (let ((tail (cons "" (cons ... 
...)))) (while tail (let ((ext ...)) (if (and ... ...) (setq latexenc-main-file 
...)) (setq tail (cdr tail))))))) (if (and (not 
latexenc-dont-use-tex-guess-main-file-flag) (not latexenc-main-file)) (progn 
(if (fboundp 'tex-guess-main-file) (progn (let ((tex-start-of-header 
"\\\\document\\(style\\|class\\)")) (setq latexenc-main-file 
(tex-guess-main-file))))))) (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) (latexenc-main-buffer (find-file-noselect 
latexenc-main-file t))) (coding-system-base (save-current-buffer (set-buffer 
latexenc-main-buffer) (or coding-system-for-write buffer-file-coding-system 
'undecided)))) 'undecided))
  (if (catch 'cs (let ((case-fold-search nil)) (while (search-forward 
"inputenc" nil t) (goto-char (match-beginning 0)) (beginning-of-line) (if (or 
(looking-at 
"[^%\n]*\\\\usepackage\\[\\([^]]*\\)\\]{\\([^}]*,\\)?inputenc\\(,[^}]*\\)?}") 
(looking-at "[^%\n]*\\\\inputencoding{\\([^}]*\\)}")) (throw 'cs t) (goto-char 
(match-end 0)))))) (let* ((match (match-string 1)) (sym (or 
(latexenc-inputenc-to-coding-system match) (intern match)))) (cond 
((coding-system-p sym) sym) ((and (require 'code-pages nil t) (coding-system-p 
sym)) sym) (t 'undecided))) (let ((default-directory (if (stringp (nth 1 
arg-list)) (file-name-directory (nth 1 arg-list)) default-directory)) 
latexenc-main-file) (if latexenc-dont-use-TeX-master-flag nil (goto-char 
(point-max)) (search-backward "\n\f" (max (- (point-max) 3000) (point-min)) 
'move) (re-search-forward "^%+ *Local Variables:" nil t) (let ((file (if 
(re-search-forward "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" nil 
t) (match-string 2) (or ... ...)))) (let ((tail (cons "" ...))) (while tail 
(let (...) (if ... ...) (setq tail ...)))))) (if (and (not 
latexenc-dont-use-tex-guess-main-file-flag) (not latexenc-main-file)) (progn 
(if (fboundp 'tex-guess-main-file) (progn (let (...) (setq latexenc-main-file 
...)))))) (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) (latexenc-main-buffer (find-file-noselect 
latexenc-main-file t))) (coding-system-base (save-current-buffer (set-buffer 
latexenc-main-buffer) (or coding-system-for-write buffer-file-coding-system 
'undecided)))) 'undecided)))
  (save-excursion (goto-char (point-min)) (if (catch 'cs (let 
((case-fold-search nil)) (while (search-forward "inputenc" nil t) (goto-char 
(match-beginning 0)) (beginning-of-line) (if (or (looking-at 
"[^%\n]*\\\\usepackage\\[\\([^]]*\\)\\]{\\([^}]*,\\)?inputenc\\(,[^}]*\\)?}") 
(looking-at "[^%\n]*\\\\inputencoding{\\([^}]*\\)}")) (throw 'cs t) (goto-char 
(match-end 0)))))) (let* ((match (match-string 1)) (sym (or 
(latexenc-inputenc-to-coding-system match) (intern match)))) (cond 
((coding-system-p sym) sym) ((and (require 'code-pages nil t) (coding-system-p 
sym)) sym) (t 'undecided))) (let ((default-directory (if (stringp (nth 1 
arg-list)) (file-name-directory (nth 1 arg-list)) default-directory)) 
latexenc-main-file) (if latexenc-dont-use-TeX-master-flag nil (goto-char 
(point-max)) (search-backward "\n\f" (max (- (point-max) 3000) (point-min)) 
'move) (re-search-forward "^%+ *Local Variables:" nil t) (let ((file (if ... 
... ...))) (let ((tail ...)) (while tail (let ... ... ...))))) (if (and (not 
latexenc-dont-use-tex-guess-main-file-flag) (not latexenc-main-file)) (progn 
(if (fboundp 'tex-guess-main-file) (progn (let ... ...))))) (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) (latexenc-main-buffer (find-file-noselect 
latexenc-main-file t))) (coding-system-base (save-current-buffer (set-buffer 
latexenc-main-buffer) (or coding-system-for-write buffer-file-coding-system 
...)))) 'undecided))))
  (if (eq (car arg-list) 'insert-file-contents) (save-excursion (goto-char 
(point-min)) (if (catch 'cs (let ((case-fold-search nil)) (while 
(search-forward "inputenc" nil t) (goto-char (match-beginning 0)) 
(beginning-of-line) (if (or ... ...) (throw ... t) (goto-char ...))))) (let* 
((match (match-string 1)) (sym (or (latexenc-inputenc-to-coding-system match) 
(intern match)))) (cond ((coding-system-p sym) sym) ((and (require ... nil t) 
(coding-system-p sym)) sym) (t 'undecided))) (let ((default-directory (if 
(stringp ...) (file-name-directory ...) default-directory)) latexenc-main-file) 
(if latexenc-dont-use-TeX-master-flag nil (goto-char (point-max)) 
(search-backward "\n\f" (max (- ... 3000) (point-min)) 'move) 
(re-search-forward "^%+ *Local Variables:" nil t) (let ((file ...)) (let (...) 
(while tail ...)))) (if (and (not latexenc-dont-use-tex-guess-main-file-flag) 
(not latexenc-main-file)) (progn (if (fboundp ...) (progn ...)))) (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) (latexenc-main-buffer ...)) 
(coding-system-base (save-current-buffer ... ...))) 'undecided)))) 'undecided)
  latexenc-find-file-coding-system((insert-file-contents 
"/Users/au710211/doit/test3.tex" t nil nil nil))
  insert-file-contents("~/doit/test3.tex" t)
  find-file-noselect-1(#<buffer test3.tex<doit>> "~/doit/test3.tex" nil nil 
"~/doit/test3.tex" (130263558 16777231))
  find-file-noselect("/Users/au710211/doit/test3.tex" nil nil nil)
  find-file("/Users/au710211/doit/test3.tex")
  dired--find-file(find-file "/Users/au710211/doit/test3.tex")
  dired--find-possibly-alternative-file("/Users/au710211/doit/test3.tex")
  dired-find-file()
  funcall-interactively(dired-find-file)
  command-execute(dired-find-file)
_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to