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)
                                   (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.
     ;; 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))
        "1")))
-- 
1.7.9.2


_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to