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

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

[nongnu] elpa/go-mode 96eb71e 153/495: fix godef-jump on Windows


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 96eb71e 153/495: fix godef-jump on Windows
Date: Sat, 7 Aug 2021 09:05:03 -0400 (EDT)

branch: elpa/go-mode
commit 96eb71ed97fb0aab0b4ca0990a936c9a0e319d86
Author: Charles Lee <zombie.fml@gmail.com>
Commit: Dominik Honnef <dominikh@fork-bomb.org>

    fix godef-jump on Windows
---
 go-mode.el | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index 23dc94c..59bafe6 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -878,16 +878,18 @@ will be commented, otherwise they will be removed 
completely."
 (defun godef--find-file-line-column (specifier other-window)
   "Given a file name in the format of `filename:line:column',
 visit FILENAME and go to line LINE and column COLUMN."
-  (let* ((components (split-string specifier ":"))
-         (line (string-to-number (nth 1 components)))
-         (column (string-to-number (nth 2 components))))
-    (with-current-buffer (funcall (if other-window 'find-file-other-window 
'find-file) (car components))
-      (goto-char (point-min))
-      (forward-line (1- line))
-      (beginning-of-line)
-      (forward-char (1- column))
-      (if (buffer-modified-p)
-          (message "Buffer is modified, file position might not have been 
correct")))))
+  (if (not (string-match "\\(.+\\):\\([0-9]+\\):\\([0-9]+\\)" specifier))
+      (error "Unexpected godef output: %s" specifier)
+    (let ((filename (match-string 1 specifier))
+          (line (string-to-number (match-string 2 specifier)))
+          (column (string-to-number (match-string 3 specifier))))
+      (with-current-buffer (funcall (if other-window 'find-file-other-window 
'find-file) filename)
+        (goto-char (point-min))
+        (forward-line (1- line))
+        (beginning-of-line)
+        (forward-char (1- column))
+        (if (buffer-modified-p)
+            (message "Buffer is modified, file position might not have been 
correct"))))))
 
 (defun godef--call (point)
   "Call godef, acquiring definition position and expression



reply via email to

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