]> Cypherpunks repositories - gostls13.git/commitdiff
misc/emacs: fix godef-jump on Windows.
authorCharles Lee <zombie.fml@gmail.com>
Wed, 26 Jun 2013 20:59:25 +0000 (13:59 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 26 Jun 2013 20:59:25 +0000 (13:59 -0700)
Fixes #5555.

R=adonovan, dominik.honnef, iant
CC=gobot, golang-dev
https://golang.org/cl/9762045

misc/emacs/go-mode.el

index d3c425cdca482b2a71f689d9793a60e7844cc29e..c61c2545e62b48e1efb690eec02aee19f80bf3c3 100644 (file)
@@ -873,16 +873,18 @@ will be commented, otherwise they will be removed completely."
 (defun godef--find-file-line-column (specifier)
   "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 (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 (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