Subject: 13.0.14; Non-file-visiting TeX buffers

From: Gustavo Barros <[email-masked]>
Date: Fri, 27 Aug 2021 09:20:54 -0300

Hi All,

Since the latest release (v13.0.14), I'm having problems opening a new 
`.tex' buffer (still non-file-visiting) when 
`TeX-view-evince-keep-focus' is `t'. As far as I can tell/recall, I did 
not face this until upgrading today (and this is a procedure I do 
commonly, but I did not rigorously test this to pin down the change).

An ECM to reproduce the issue is: start `emacs -Q'.

Do an initial setup:
#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/elpa/auctex-13.0.14")
(load "auctex.el" nil t t)
(setq TeX-parse-self t)
(setq TeX-auto-save t)
(setq TeX-view-evince-keep-focus t)
#+end_src

Now, find a `.tex' file which does not yet exist, say "~/test/test.tex" 
with `C-x C-f test/test.tex RET'.

We then get the error "File mode specification error: (file-missing 
Setting current directory No such file or directory 
/home/gustavo/test/)".

The file itself gets opened in fundamental mode.

With `M-x toggle-debug-on-error' and repeating the procedure, we get the 
following backtrace (its final part):

#+begin_example
Debugger entered--Lisp error: (file-missing "Setting current directory" 
"No such file or directory" "/home/gustavo/test/")
  call-process("/bin/bash" nil t nil "-c" "atril --help")
  call-process-shell-command("atril --help" nil t)
  shell-command("atril --help" t)
  shell-command-to-string("atril --help")
  TeX-view-program-select-evince("mate" "atril")
  byte-code("\10\301\267\202\n\0\302\207\303\207\304\305\306\307\310\311DE\312\313\314\315\316\317\"\320BB\321\315\322\323\"\324BB\325\315\326\327\"\330BB\331BBBBB..." 
  [system-type #<hash-table eq 2/2 0x1568422eeb89> (("Yap" ("yap -1" 
  (mode-io-correlate " -s %n%b") " %o") "yap") ("dviout" ("dviout -1 " 
  ((paper-a4 paper-portrait) "-y=A4 ") ((paper-a4 paper-landscape) 
  "-y=A4L ") ((paper-a5 paper-portrait) "-y=A5 ") ((paper-a5 
  paper-landscape) "-y=A5L ") ((paper-b5 paper-portrait) "-y=E5 ") 
  ((paper-b5 paper-landscape) "-y=E5L ") ((paper-b4jis paper-portrait) 
  "-y=B4 ") ((paper-b4jis paper-landscape) "-y=B4L ") ((paper-b5jis 
  paper-portrait) "-y=B5 ") ((paper-b5jis paper-landscape) "-y=B5L ") 
  (paper-legal "-y=Legal ") (paper-letter "-y=Letter ") (paper-executive 
  "-y=Executive ") "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout") 
  ("PDF Tools" TeX-pdf-tools-sync-view) ("SumatraPDF" ("SumatraPDF 
  -reuse-instance" (mode-io-correlate " -forward-search \"%b\" %n") " 
  %o") "SumatraPDF") ("dvips and start" "dvips %d -o && start \"\" %f" 
  "dvips") ("start" "start \"\" %o")) (("Preview.app" "open -a 
  Preview.app %o" "open") ("Skim" "open -a Skim.app %o" "open") ("PDF 
  Tools" TeX-pdf-tools-sync-view) ("displayline" "displayline %n %o %b" 
  "displayline") ("open" "open %o" "open")) ("dvi2tty" ("dvi2tty -q -w 
  132 %o")) ("xdvi" ("%(o?)xdvi" (mode-io-correlate " -sourceposition 
  \"%n %b\" -editor \"%cS\"") ((paper-a4 paper-portrait) " -paper a4") 
  ((paper-a4 paper-landscape) " -paper a4r") ((paper-a5 paper-portrait) 
  " -paper a5") ((paper-a5 paper-landscape) " -paper a5r") (paper-b5 " 
  -paper b5") (paper-letter " -paper us") (paper-legal " -paper legal") 
  (paper-executive " -paper 7.25x10.5in") " %d") "%(o?)xdvi") "dvips and 
  gv" "%(o?)dvips %d -o && gv %f" "%(o?)dvips" "gv" ("gv" "gv %o" "gv") 
  ("xpdf" ("xpdf -remote %s -raise %o" (mode-io-correlate " 
  %(outpage)")) "xpdf") "Evince" TeX-view-program-select-evince "gnome" 
  "evince" ("evince") "Atril" "mate" "atril" ("atril") "Xreader" "x" 
  "reader" ("xreader") (("Okular" ("okular --unique %o" 
  (mode-io-correlate "#src:%n%a")) "okular") ("xdg-open" "xdg-open %o" 
  "xdg-open") ("PDF Tools" TeX-pdf-tools-sync-view) ("Zathura" ("zathura 
  %o" (mode-io-correlate " --synctex-forward %n:0:\"%b\" -x 
  \"emacsclient +%{li...")) "zathura"))] 11)
  (defvar TeX-view-program-list-builtin (byte-code 
  "\10\301\267\202\n\0\302\207\303\207\304\305\306\307\310\311DE\312\313\314\315\316\317\"\320BB\321\315\322\323\"\324BB\325\315\326\327\"\330BB\331BBBBB..." 
  [system-type #<hash-table eq 2/2 0x1568422eeb89> (("Yap" ("yap -1" 
  (mode-io-correlate " -s %n%b") " %o") "yap") ("dviout" ("dviout -1 " 
  ((paper-a4 paper-portrait) "-y=A4 ") ((paper-a4 paper-landscape) 
  "-y=A4L ") ((paper-a5 paper-portrait) "-y=A5 ") ((paper-a5 
  paper-landscape) "-y=A5L ") ((paper-b5 paper-portrait) "-y=E5 ") 
  ((paper-b5 paper-landscape) "-y=E5L ") ((paper-b4jis paper-portrait) 
  "-y=B4 ") ((paper-b4jis paper-landscape) "-y=B4L ") ((paper-b5jis 
  paper-portrait) "-y=B5 ") ((paper-b5jis paper-landscape) "-y=B5L ") 
  (paper-legal "-y=Legal ") (paper-letter "-y=Letter ") (paper-executive 
  "-y=Executive ") "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout") 
  ("PDF Tools" TeX-pdf-tools-sync-view) ("SumatraPDF" ("SumatraPDF 
  -reuse-instance" (mode-io-correlate " -forward-search \"%b\" %n") " 
  %o") "SumatraPDF") ("dvips and start" "dvips %d -o && start \"\" %f" 
  "dvips") ("start" "start \"\" %o")) (("Preview.app" "open -a 
  Preview.app %o" "open") ("Skim" "open -a Skim.app %o" "open") ("PDF 
  Tools" TeX-pdf-tools-sync-view) ("displayline" "displayline %n %o %b" 
  "displayline") ("open" "open %o" "open")) ("dvi2tty" ("dvi2tty -q -w 
  132 %o")) ("xdvi" ("%(o?)xdvi" (mode-io-correlate " -sourceposition 
  \"%n %b\" -editor \"%cS\"") ((paper-a4 paper-portrait) " -paper a4") 
  ((paper-a4 paper-landscape) " -paper a4r") ((paper-a5 paper-portrait) 
  " -paper a5") ((paper-a5 paper-landscape) " -paper a5r") (paper-b5 " 
  -paper b5") (paper-letter " -paper us") (paper-legal " -paper legal") 
  (paper-executive " -paper 7.25x10.5in") " %d") "%(o?)xdvi") "dvips and 
  gv" "%(o?)dvips %d -o && gv %f" "%(o?)dvips" "gv" ("gv" "gv %o" "gv") 
  ("xpdf" ("xpdf -remote %s -raise %o" (mode-io-correlate " 
  %(outpage)")) "xpdf") "Evince" TeX-view-program-select-evince "gnome" 
  "evince" ("evince") "Atril" "mate" "atril" ("atril") "Xreader" "x" 
  "reader" ("xreader") (("Okular" ("okular --unique %o" 
  (mode-io-correlate "#src:%n%a")) "okular") ("xdg-open" "xdg-open %o" 
  "xdg-open") ("PDF Tools" TeX-pdf-tools-sync-view) ("Zathura" ("zathura 
  %o" (mode-io-correlate " --synctex-forward %n:0:\"%b\" -x 
  \"emacsclient +%{li...")) "zathura"))] 11) 
  ("/home/gustavo/.emacs.d/elpa/auctex-13.0.14/tex.elc" . 38206))
  TeX-tex-mode()
  apply(TeX-tex-mode nil)
  tex-mode()
  set-auto-mode-0(tex-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(t t)
  find-file-noselect-1(#<buffer test.tex> "~/test/test.tex" nil nil 
  "~/test/test.tex" nil)
  find-file-noselect("~/test/test.tex" nil nil t)
  find-file("~/test/test.tex" t)
#+end_example

Best regards,
Gustavo.

Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.20, cairo version 1.16.0)
 of 2021-03-25
Package: 13.0.14

current state:
==============
(setq
 AUCTeX-date "2021-08-26"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex" 
 "/home/gustavo/.emacs.d/elpa/auctex-13.0.14/style"
		  "/home/gustavo/.emacs.d/auctex/auto" 
		  "/home/gustavo/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX" "%(PDF)%(tex) %(file-line-error) 
 %`%(extraopts) %S%(PDFout)%(mode)%' %(output-dir) %t"
		     TeX-run-TeX nil (plain-tex-mode ams-tex-mode 
		     texinfo-mode) :help "Run plain TeX")
		    ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil 
		    (latex-mode doctex-mode) :help "Run LaTeX")
		    ("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" 
		    TeX-run-compile nil (texinfo-mode) :help
		     "Run Makeinfo with Info output")
		    ("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) 
		    --html %t" TeX-run-compile nil
		     (texinfo-mode) :help "Run Makeinfo with HTML 
		     output")
		    ("AmSTeX" "amstex %(PDFout) %`%(extraopts) 
		    %S%(mode)%' %(output-dir) %t" TeX-run-TeX nil
		     (ams-tex-mode) :help "Run AMSTeX")
		    ("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) 
		    %(execopts)%t" TeX-run-TeX nil
		     (context-mode) :help "Run ConTeXt once")
		    ("ConTeXt Full" "%(cntxcom) %(extraopts) 
		    %(execopts)%t" TeX-run-TeX nil (context-mode) :help
		     "Run ConTeXt until completion")
		    ("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode context-mode) :help
		     "Run BibTeX")
		    ("Biber" "biber %(output-dir) %s" TeX-run-Biber nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help "Run Biber")
		    ("Texindex" "texindex %s.??" TeX-run-command nil 
		    (texinfo-mode) :help "Run Texindex")
		    ("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil 
		    (texinfo-mode) :help
		     "Run Texi2dvi or Texi2pdf")
		    ("View" "%V" TeX-run-discard-or-function t t :help 
		    "Run Viewer")
		    ("Print" "%p" TeX-run-command t t :help "Print the 
		    file")
		    ("Queue" "%q" TeX-run-background nil t :help "View 
		    the printer queue" :visible
		     TeX-queue-command)
		    ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Generate PostScript file")
		    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Convert DVI file to PostScript")
		    ("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" 
		    TeX-run-dvipdfmx nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Convert DVI file to PDF with dvipdfmx")
		    ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Convert PostScript file to PDF")
		    ("Glossaries" "makeglossaries %(d-dir) %s" 
		    TeX-run-command nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Run makeglossaries to create glossary file")
		    ("Index" "makeindex %(O?idx)" TeX-run-index nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Run makeindex to create index file")
		    ("upMendex" "upmendex %(O?idx)" TeX-run-index t
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Run upmendex to create index file")
		    ("Xindy" "texindy %s" TeX-run-command nil
		     (plain-tex-mode latex-mode doctex-mode ams-tex-mode 
		     texinfo-mode) :help
		     "Run xindy to create index file")
		    ("Check" "lacheck %s" TeX-run-compile nil 
		    (latex-mode) :help
		     "Check LaTeX file for correctness")
		    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil 
		    (latex-mode) :help
		     "Check LaTeX file for common mistakes")
		    ("Spell" "(TeX-ispell-document \"\")" 
		    TeX-run-function nil t :help "Spell-check the 
		    document")
		    ("Clean" "TeX-clean" TeX-run-function nil t :help 
		    "Delete generated intermediate files")
		    ("Clean All" "(TeX-clean t)" TeX-run-function nil t 
		    :help
		     "Delete generated intermediate and output files")
		    ("Other" "" TeX-run-command t t :help "Run an 
		    arbitrary command"))
 )