bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-AUCTeX] 11.84; C-c C-c doesn't suggest "View" for file name with sp


From: Ikumi Keita
Subject: [Bug-AUCTeX] 11.84; C-c C-c doesn't suggest "View" for file name with space.
Date: Tue, 06 Mar 2007 00:09:30 +0900

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.

Be sure to consult the FAQ section in the manual before submitting
a bug report.  If the bug (or problem) is triggered by a specific
(La)TeX file, you should try to produce a minimal sample file
showing the problem and include it in your report.

Your bug report will be posted to the AUCTeX bug reporting list.
------------------------------------------------------------------------

For ordinary LaTeX files, AUCTeX suggests "View" as its default when
typing C-c C-c sufficiently many times.  However, it doesn't do so if
the LaTeX file name contains spaces.

How to reproduce:
1. Save the following content under the file name "/tmp/bbb ccc.tex".
======================================================================
\documentclass{article}

\begin{document}
bbb ccc
\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
======================================================================
2. Open the file with AUCTeX.
3. C-c C-c RET
4. Typeset finishes normally. Then C-c C-c RET again.
5. The minibuffer prompts with "Command: (default LaTeX)", not
   "Command: (default View)".
6. C-c C-c RET again and again and again... but AUCTeX never suggests
   "View" as its default.

Analysis:
With the file name "bbb ccc.tex", (TeX-save-document (TeX-master-file)),
in the function TeX-command-query, returns t even after invocating C-c
C-c sufficiently many times, so AUCTeX wrongly regards that typesetting
is not ready yet.  That is caused by the fact that
(TeX-output-extension), in the function TeX-save-document, returns
"dvi\"", not "dvi".  The reason of it is that the function
TeX-TeX-sentinel-check does not cater for the case that the file name
reported by LaTeX is surrounded by doble quotes when the file name
contains space.  LaTeX emits a message like

Output written on "bbb ccc.dvi" (1 page, 224 bytes).

so the surrounding dobule quotes must be removed to obtain the corrent
output file name.

Tentative fix:
--- tex-buf.el~ Mon Jan 29 22:15:45 2007
+++ tex-buf.el  Mon Feb 12 23:28:27 2007
@@ -840,6 +840,11 @@
                            nil t)
        (let ((output-file (TeX-match-buffer 1)))
          (setq TeX-current-page (concat "{" (TeX-match-buffer 2) "}"))
+         ;; Remove surrounding double quotes, if present, for file names
+         ;; with spaces.
+         (if (and (eq (aref output-file 0) ?\")
+                  (eq (aref output-file (1- (length output-file))) ?\"))
+             (setq output-file (substring output-file 1 -1)))
          (setq TeX-output-extension
                (if (string-match "\\.\\([^.]*\\)$" output-file)
                    (match-string 1 output-file)


Emacs  : GNU Emacs 21.4.1 (i386-unknown-freebsd4.11, X toolkit, Xaw3d scroll 
bars, emcws)
 of 2005-03-02 on myname.my.domain
Package: 11.84

current state:
==============
(setq
 AUCTeX-date "2007-01-12"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("style" "auto" "/home/keita/tex/style"
                  "/home/keita/tex/auto"
                  "/usr/local/share/emacs/site-lisp/auctex/style"
                  "/usr/local/var/auctex")
 TeX-auto-save nil
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %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 %t" TeX-run-compile nil
                     (texinfo-mode) :help "Run Makeinfo with Info output")
                    ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil
                     (texinfo-mode) :help "Run Makeinfo with HTML output")
                    ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t"
                     TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
                    ("ConTeXt" "texexec --once --texutil %(execopts)%t"
                     TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
                    ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil
                     (context-mode) :help "Run ConTeXt until completion")
                    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help
                     "Run BibTeX")
                    ("View" "%V" TeX-run-discard 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-command t t :help
                     "Generate PostScript file")
                    ("Index" "makeindex %s" TeX-run-command nil t :help
                     "Create index file")
                    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode)
                     :help "Check LaTeX file for correctness")
                    ("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")
                    )
 )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]