bug-auctex
[Top][All Lists]
Advanced

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

Re: [Bug-AUCTeX] 2011-05-15; TeX-source-correlate-method synctex instead


From: linuxfever
Subject: Re: [Bug-AUCTeX] 2011-05-15; TeX-source-correlate-method synctex instead of source-specials
Date: Wed, 26 Oct 2011 05:53:38 -0700 (PDT)

Actually, it seems that Auctex is guessing wrongly about which type to
choose, source-specials or synctex. The function that determines which one
to use is given in tex.el as follows:

(defun TeX-source-correlate-determine-method ()
  "Determine which method is available for forward and inverse search."
  (let ((help (condition-case nil
                  (with-output-to-string
                    (call-process LaTeX-command
                                  nil (list standard-output nil) nil "--help"))
                (error ""))))
    (if (string-match "^[ ]*-synctex" help)
        'synctex
      'source-specials)))

which essentially runs the command "latex --help" and tests if the output
contains the word "synctex", which, in my distro, it does. Therefore, no
matter which type you want to use, AucTex will always be choosing synctex.

The above function is called whenever the correlate-mode is enabled for the
first time. Once it is enabled, it sets the variable
"TeX-source-correlate-method-active" to the type returned by
"TeX-source-correlate-determine-method" and once set, you cannot unset it.

This of course means, that if you want to switch from a PDF document to a
DVI document, you will always have synctex enabled and vice versa.

A simple way I found to address this problem is to add the following to the
.emacs file:

(add-hook 'TeX-PDF-mode-hook 
(lambda () (setq TeX-source-correlate-method-active
        (if TeX-PDF-mode 'synctex 'source-specials))))


which essentially sets the correct type according to whether PDF-mode is on
or off.



Rares Vernica-4 wrote:
> 
> 
> 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.  In addition check if the bug is reproducable with an
> up-to-date version of AUCTeX.  So please upgrade to the version
> available from http://www.gnu.org/software/auctex/ if your
> installation is older than the one available from the web site.
> 
> If the bug 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.
> ------------------------------------------------------------------------
> 
>   I have checked out and compiled the latest auctex from CVS. I started
>   emacs with "emacs -Q", I loaded tex-site.el, and wrote a short .tex
>   file:
> 
>     \documentclass{article}
>     \begin{document}
>     a
>     \end{document}
> 
>   After that I enabled TeX-source-correlate-mode:
> 
>     M-x TeX-source-correlate-mode
> 
>   I compiled the .tex file. The compile command was:
> 
>     latex --synctex=1 -interaction=nonstopmode "\input" a.tex
> 
>   Notice the use of --synctex=1. After compilation, the View command was:
> 
>     xdvi -sourceposition "4 a.tex" -editor
>     "/home/rares/usr/bin/emacsclient --no-wait +%l %f" a.dvi
> 
>   Notice -sourceposition. Xdvi gives the following waring:
> 
>     No source specials in this DVI file - couldn't do reverse search.
> 
>   So, Xdvi needs source-specials, but the file is compiled with
>   synctex. I checked the TeX-source-correlate-method variable and it
>   says:
> 
>     TeX-source-correlate-method is a variable defined in `tex.el'.
>     Its value is auto
> 
>     Documentation:
>     Method to use for enabling forward and inverse search.
>     This can be `source-specials' if source specials should be used,
>     `synctex' if SyncTeX should be used, or`auto' if AUCTeX should
>     decide.
>   
>   A workaround is to do:
> 
>     (setq TeX-source-correlate-method 'source-specials)
> 
>   before TeX-source-correlate-mode is enabled.
> 
>   Thanks!
> 
> Emacs  : GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4)
>  of 2011-05-16 on avocado
> Package: 2011-05-15
> 
> current state:
> ==============
> (setq
>  AUCTeX-date "2011-05-15"
>  window-system 'x
>  LaTeX-version "2e"
>  TeX-style-path '("/home/rares/usr/var/auctex"
>                 "/home/rares/usr/share/emacs/site-lisp/auctex/style"
>                 "/home/rares/.emacs.d/auctex/auto"
>                 "/home/rares/.emacs.d/auctex/style" "auto" "style")
>  TeX-auto-save nil
>  TeX-parse-self nil
>  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-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-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")
>                   )
>  )
> 
> _______________________________________________
> bug-auctex mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-auctex
> 
> 

-- 
View this message in context: 
http://old.nabble.com/2011-05-15--TeX-source-correlate-method-synctex-instead-of-source-specials-tp31653479p32724110.html
Sent from the Gnu - AUCTeX - Bugs mailing list archive at Nabble.com.




reply via email to

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