git-gutter-plus icon indicating copy to clipboard operation
git-gutter-plus copied to clipboard

BUG: `tramp-dissect-file-name' apparently used to return an array

Open KarlHegbloom opened this issue 6 years ago • 6 comments

... but now it returns an object of type tramp-file-name', which is a cl-structure-class'.

KarlHegbloom avatar Jan 09 '18 23:01 KarlHegbloom

Thanks for sending a PR for this (I just ran into this issue myself).

Note that the tramp-file-name-* functions you're now calling if you don't get an array aren't new in Emacs 26. They were introduced in 2010 (see https://github.com/emacs-mirror/emacs/commit/0f34aa7719df0621663d41defa5deaf79004c52c), implemented using aref up until now. So I think you don't need to check if you got a vector and keep the old code for those: just always use those helpers.

marienz avatar Apr 10 '18 12:04 marienz

I ran into the same bug, and here is my workaround (it also adds the missing support for non-default port):

(defun git-gutter+-remote-default-directory (dir file)
  (let* ((vec (tramp-dissect-file-name file))
          (method (tramp-file-name-method vec))
          (user (tramp-file-name-user vec))
          (domain (tramp-file-name-domain vec))
          (host (tramp-file-name-host vec))
          (port (tramp-file-name-port vec)))
     (tramp-make-tramp-file-name method user domain host port dir)))

(defun git-gutter+-remote-file-path (dir file)
  (let ((file (tramp-file-name-localname (tramp-dissect-file-name file))))
    (replace-regexp-in-string (concat "\\`" dir) "" file)))

yangsheng6810 avatar Jun 22 '18 09:06 yangsheng6810

Can @yangsheng6810 's or @KarlHegbloom solution be merged into the package? What's holding it back?

It'd be nice if magit-gutter-plus worked with TRAMP off-the-shelf.

coroa avatar Jul 01 '19 10:07 coroa

@yangsheng6810
The same issue for me. After adding your codes, it works now. Thanks a lot!

Could you please merge it into the package?

beyondpie avatar Sep 12 '19 14:09 beyondpie

@beyondpie I am not the owner of this repo so I do not have the permission. I will submit a PR with my workaround though, after checking backward compatibility with older versions of Emacs

yangsheng6810 avatar Sep 12 '19 22:09 yangsheng6810

@beyondpie PR submitted.

yangsheng6810 avatar Sep 12 '19 23:09 yangsheng6810