branch: externals/ggtags commit 40635a1effd3a9c2adef63c4760010c9468a7a4d Author: Leo Liu <sdl....@gmail.com> Commit: Leo Liu <sdl....@gmail.com>
Correct xref locations due to misaligned default-directory Fixes #218. --- ggtags.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ggtags.el b/ggtags.el index caba1a3c32..ba14d88396 100644 --- a/ggtags.el +++ b/ggtags.el @@ -2417,7 +2417,7 @@ properties in the summary text of each xref." with re = (cadr (assq 'grep ggtags-global-error-regexp-alist-alist)) while (re-search-forward re nil t) for summary = (buffer-substring (1+ (match-end 2)) (line-end-position)) - for file = (expand-file-name (match-string 1) root) + for file = (expand-file-name (match-string 1)) for line = (string-to-number (match-string 2)) for column = (string-match-p tag summary) if colored do (setq summary (ansi-color-apply summary)) end @@ -2450,12 +2450,13 @@ Return the list of xrefs for TAG." (ggtags-project-has-color project)))) (kill-buffer (current-buffer))))) (ggtags-with-current-project - (ggtags-global-output - (get-buffer-create " *ggtags-xref*") - (append - (split-string (ggtags-global-build-command cmd)) - (list "--" (shell-quote-argument tag))) - collect ggtags--xref-limit 'sync) + (let ((default-directory (ggtags-current-project-root))) + (ggtags-global-output + (get-buffer-create " *ggtags-xref*") + (append + (split-string (ggtags-global-build-command cmd)) + (list "--" (shell-quote-argument tag))) + collect ggtags--xref-limit 'sync)) xrefs))) (cl-defmethod xref-backend-definitions ((_backend (eql ggtags)) tag)