]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix #20: Incorrect generation of relative file names
authorLeo Liu <sdl.web@gmail.com>
Tue, 12 Nov 2013 15:01:33 +0000 (23:01 +0800)
committerLeo Liu <sdl.web@gmail.com>
Tue, 12 Nov 2013 15:11:50 +0000 (23:11 +0800)
ggtags.el

index 7f060dedf9eee2c6196ebdf865db664486dd39c4..c69c7d58a06c7c037054ff7c2b325cd8eff71735 100644 (file)
--- a/ggtags.el
+++ b/ggtags.el
@@ -517,11 +517,15 @@ With a prefix arg (non-nil DEFINITION) always find definitions."
           (and (ggtags-find-project)
                (not (ggtags-project-has-rtags (ggtags-find-project)))))
       (ggtags-find-tag 'definition name)
-    (ggtags-find-tag (format "--from-here=%d:%s"
-                             (line-number-at-pos)
-                             (shell-quote-argument
-                              (file-relative-name buffer-file-name)))
-                     name)))
+    (ggtags-find-tag
+     (format "--from-here=%d:%s"
+             (line-number-at-pos)
+             (shell-quote-argument
+              ;; Note `ggtags-global-start' binds default-directory to
+              ;; project root.
+              (file-relative-name buffer-file-name
+                                  (ggtags-current-project-root))))
+     name)))
 
 (defun ggtags-find-reference (name)
   (interactive (list (ggtags-read-tag)))