Richard Hansen | 13 Mar 2012 21:39
Picon

[PATCH] Add support for symlinks in TeX-synctex-output-page

If the path leading up to TeX-master contains symbolic links,
expand-file-name might not return a path that matches the synctex
file.  This patch changes TeX-synctex-output-page to also try the
result of file-truename when looking for the output page.
---
 tex.el |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tex.el b/tex.el
index 3d2500e..65b291c 100644
--- a/tex.el
+++ b/tex.el
 <at>  <at>  -1610,14 +1610,20  <at>  <at>  enabled and the `synctex' binary is available."
   (let* ((file (file-relative-name (buffer-file-name)
 				   (file-name-directory
 				    (TeX-active-master))))
-	 (abs-file (concat (expand-file-name (or (file-name-directory (TeX-active-master))
-						 (file-name-directory (buffer-file-name))))
-			   "./" file)))
+	 (master-dir-relmaybe (or (file-name-directory (TeX-active-master))
+				  (file-name-directory (buffer-file-name))))
+	 (abs-file (concat (expand-file-name master-dir-relmaybe) "./" file))
+	 (master-dir-abs (if (file-name-absolute-p master-dir-relmaybe)
+			     master-dir-relmaybe
+			   (concat (file-name-as-directory default-directory)
+				   master-dir-relmaybe)))
+	 (true-file (concat (file-truename master-dir-abs) "./" file)))
     ;; It's known that depending on synctex version one of
     ;; /absolute/path/./foo/bar.tex, foo/bar.tex, or ./foo/bar.tex (relative to
     ;; TeX-master, and the "." in the absolute path is important) are needed.
(Continue reading)


Gmane