[Top][All Lists]

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

[AUCTeX-devel] [PATCH] Add support for symlinks in TeX-synctex-output-pa

From: Richard Hansen
Subject: [AUCTeX-devel] [PATCH] Add support for symlinks in TeX-synctex-output-page
Date: Tue, 13 Mar 2012 16:39:44 -0400

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
@@ -1610,14 +1610,20 @@ enabled and the `synctex' binary is available."
   (let* ((file (file-relative-name (buffer-file-name)
-        (abs-file (concat (expand-file-name (or (file-name-directory 
-                                                (file-name-directory 
-                          "./" 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.
     ;; So try all variants before falling back to page 1.
     (or (TeX-synctex-output-page-1 abs-file)
+       (TeX-synctex-output-page-1 true-file)
        (TeX-synctex-output-page-1 file)
        (TeX-synctex-output-page-1 (concat "./" file))

reply via email to

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