emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ggtags 8e16861392 2/2: Fix #214: unbreak xref support o


From: Stefan Monnier
Subject: [elpa] externals/ggtags 8e16861392 2/2: Fix #214: unbreak xref support on Emacs <= 27
Date: Wed, 5 Jan 2022 18:36:26 -0500 (EST)

branch: externals/ggtags
commit 8e16861392d7499bf3a212db1f5e9e0ef2e4fba9
Author: Leo Liu <sdl.web@gmail.com>
Commit: Leo Liu <sdl.web@gmail.com>

    Fix #214: unbreak xref support on Emacs <= 27
---
 ggtags.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ggtags.el b/ggtags.el
index 85e6fd30f6..3e9e9bc2f2 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -2371,11 +2371,23 @@ Function `ggtags-eldoc-function' disabled for eldoc in 
current buffer: %S" err))
 
 (cl-defstruct (ggtags-xref-location
                (:constructor ggtags-make-xref-location (file line column 
project-root)))
-  file project-root)
+  file line column project-root)
 
 (cl-defmethod xref-location-group ((l ggtags-xref-location))
   (file-relative-name (ggtags-xref-location-file l) 
(ggtags-xref-location-project-root l)))
 
+(cl-defmethod xref-location-marker ((l ggtags-xref-location))
+  (let ((buffer (find-file-noselect (ggtags-xref-location-file l))))
+    (with-current-buffer buffer
+      (save-excursion
+        (goto-char (point-min))
+        (forward-line (1- (ggtags-xref-location-line l)))
+        (move-to-column (1- (ggtags-xref-location-column l)))
+        (point-marker)))))
+
+(cl-defmethod xref-location-line ((l ggtags-xref-location))
+  (ggtags-xref-location-line l))
+
 (defun ggtags--xref-backend ()
   (and (ggtags-find-project)
        (let ((tag (ggtags-tag-at-point)))



reply via email to

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