     (when name
       (intero-canonicalize-path (substring-no-properties name)))))
 
+(defun intero-tramp-path-p (path)
+  "Return t if PATH is a path to be handled by TRAMP, and nil otherwise."
+  (eq 0 (string-match tramp-file-name-regexp path)))
+
+(defun intero-paths-for-same-file (path-1 path-2)
+  "Compare PATH-1 and PATH-2 to see if they represent the same file."
+  (let ((simplify-path #'(lambda (path)
+                           (if (intero-tramp-path-p path)
+                               (let* ((dissection (tramp-dissect-file-name path))
+                                      (host (tramp-file-name-host dissection))
+                                      (localname (tramp-file-name-localname dissection)))
+                                 (concat host ":" localname))
+                             path))))
+    (string= (funcall simplify-path path-1) (funcall simplify-path path-2))))
+
 (defun intero-buffer-host (&optional buffer)
-  "Get the hostname of the box hosting the file behind the buffer."
+  "Get the hostname of the box hosting the file behind the BUFFER."
   (with-current-buffer (or buffer (current-buffer))
     (let ((file (intero-buffer-file-name)))
       (if intero-buffer-host
           intero-buffer-host
         (setq intero-buffer-host
               (when file
-                (if (eq 0 (string-match tramp-file-name-regexp file))
+                (if (intero-tramp-path-p file)
                     (tramp-file-name-host (tramp-dissect-file-name file))
                   "")))))))
 
 (defun intero-extend-path-by-buffer-host (path &optional buffer)
-  "Take a path, and extend it by the host of the provided buffer (default to current buffer). Return path unchanged if the file is local, or the buffer has no host."
+  "Take a PATH, and extend it by the host of the provided BUFFER (default to current buffer).  Return PATH unchanged if the file is local, or the BUFFER has no host."
   (with-current-buffer (or buffer (current-buffer))
     (if (or (eq nil (intero-buffer-host)) (eq "" (intero-buffer-host)))
 	path


(defun intero-localize-path (path)
  "Turn a possibly remote path to a purely local one. This is used to create paths which a remote intero process can load."
  (if (eq 0 (string-match tramp-file-name-regexp path))
      (tramp-file-name-localname (tramp-dissect-file-name path))
    path))


                       line column type
                       msg
                       :checker checker
                       :buffer (when (intero-paths-for-same-file temp-file file)
                                 buffer)
                       :filename (intero-buffer-file-name buffer))
                      messages)))
