--- Begin Message ---
Subject: |
12.1.1; Forward search view command needs quotes around source file name |
Date: |
Fri, 30 Mar 2018 14:48:30 -0600 |
I'm using AucTeX on windows with the SumatraPDF viewer and noticed a
problem with forward search. I'm editing a file whose name contains
spaces and the view command AucTeX generates is:
SumatraPDF -reuse-instance -forward-search file name.tex 426 "file name.pdf"
This confuses SumatraPDF (I think it thinks the file is "file", the line
number is "name.tex" and then additionally tries to open a file named
"426"). With quotes around "file name.tex" it works correctly:
SumatraPDF -reuse-instance -forward-search "file name.tex" 426 "file name.pdf"
I think that maybe the %b placeholder, which expands to a file name
relative to the master file's directory, should always be surrounded in
quotes. (I'm not sure that's actually the best fix for this.) So, as a
workaround, I've added this to my configuration:
(setq TeX-expand-list
'(("%b" (lambda () (format "\"%s\""
(TeX-current-file-name-master-relative))))))
Emacs : GNU Emacs 25.3.1 (x86_64-w64-mingw32)
of 2017-09-26
Package: 12.1.1
current state:
==============
(setq
AUCTeX-date "2018-03-20"
window-system 'w32
LaTeX-version "2e"
TeX-style-path '("~/.emacs.d/auctex"
"c:/Users/Omar/.emacs.d/elpa/auctex-12.1.1/style"
"c:/Users/Omar/.emacs.d/auctex/auto"
"c:/Users/Omar/.emacs.d/auctex/style"
"auto" "style")
TeX-auto-save nil
TeX-parse-self nil
TeX-master t
TeX-command-list '(("TeX"
"%(PDF)%(tex) %(file-line-error) %(extraopts)
%`%S%(PDFout)%(mode)%' %t"
TeX-run-TeX nil (plain-tex-mode ams-tex-mode texinfo-mode)
:help
"Run plain TeX")
(#("LaTeX" 0 1 (idx 0)) "%`%l%(mode)%' %t" TeX-run-TeX nil
(latex-mode doctex-mode) :help "Run LaTeX")
("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
(texinfo-mode)
:help "Run Makeinfo with Info output")
("Makeinfo HTML" "makeinfo %(extraopts) --html %t"
TeX-run-compile nil
(texinfo-mode) :help "Run Makeinfo with HTML output")
("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %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" 0 1 (idx 1)) "bibtex %s" TeX-run-BibTeX nil t
:help
"Run BibTeX")
(#("Biber" 0 1 (idx 2)) "biber %s" TeX-run-Biber nil t
:help "Run Biber")
(#("View" 0 1 (idx 3)) "%V" TeX-run-discard-or-function t t
:help
"Run Viewer")
(#("Print" 0 1 (idx 4)) "%p" TeX-run-command t t :help
"Print the file")
(#("Queue" 0 1 (idx 5)) "%q" TeX-run-background nil t :help
"View the printer queue" :visible TeX-queue-command)
(#("File" 0 1 (idx 6)) "%(o?)dvips %d -o %f " TeX-run-dvips
t t :help
"Generate PostScript file")
(#("Dvips" 0 1 (idx 7)) "%(o?)dvips %d -o %f "
TeX-run-dvips nil t :help
"Convert DVI file to PostScript")
(#("Dvipdfmx" 0 1 (idx 8)) "dvipdfmx %d" TeX-run-dvipdfmx
nil t :help
"Convert DVI file to PDF with dvipdfmx")
(#("Ps2pdf" 0 1 (idx 9)) "ps2pdf %f" TeX-run-ps2pdf nil t
:help
"Convert PostScript file to PDF")
(#("Glossaries" 0 1 (idx 10)) "makeglossaries %s"
TeX-run-command nil t
:help "Run makeglossaries to create glossary file")
(#("Index" 0 1 (idx 11)) "makeindex %s" TeX-run-index nil t
:help
"Run makeindex to create index file")
(#("upMendex" 0 1 (idx 12)) "upmendex %s" TeX-run-index t t
:help
"Run upmendex to create index file")
(#("Xindy" 0 1 (idx 13)) "texindy %s" TeX-run-command nil t
:help
"Run xindy to create index file")
(#("Check" 0 1 (idx 14)) "lacheck %s" TeX-run-compile nil
(latex-mode)
:help "Check LaTeX file for correctness")
(#("ChkTeX" 0 1 (idx 15)) "chktex -v6 %s" TeX-run-compile
nil
(latex-mode) :help "Check LaTeX file for common mistakes")
(#("Spell" 0 1 (idx 16)) "(TeX-ispell-document \"\")"
TeX-run-function
nil t :help "Spell-check the document")
(#("Clean" 0 1 (idx 17)) "TeX-clean" TeX-run-function nil t
:help
"Delete generated intermediate files")
(#("Clean All" 0 1 (idx 18)) "(TeX-clean t)"
TeX-run-function nil t :help
"Delete generated intermediate and output files")
(#("Other" 0 1 (idx 19)) "" TeX-run-command t t :help
"Run an arbitrary command")
)
)
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#30999: 12.1.1; Forward search view command needs quotes around source file name |
Date: |
Sat, 07 Apr 2018 14:08:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 |
Ikumi Keita <address@hidden> writes:
>>>>>> Arash Esbati <address@hidden> writes:
>> thanks for your response. Actually, my preference is not to touch
>> `TeX-expand-list-builtin' and just fix this issue in
>> `TeX-view-program-list-builtin' like this:
>
>> diff --git a/tex.el b/tex.el
>> index 42759c56..8ec9e642 100644
>> --- a/tex.el
>> +++ b/tex.el
>> @@ -1365,7 +1365,7 @@ viewer."
>> "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout")
>> ("SumatraPDF"
>> ("SumatraPDF -reuse-instance"
>> - (mode-io-correlate " -forward-search %b %n") " %o")
>> + (mode-io-correlate " -forward-search \"%b\" %n") " %o")
>> "SumatraPDF")
>> ("dvips and start" "dvips %d -o && start \"\" %f" "dvips")
>> ("start" "start \"\" %o")))
>
>> WDYT?
>
> I think it's reasonable.
Patch applied. Thank you all.
Best, Arash
--- End Message ---