Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KarlHegbloom
Copy link

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

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

marienz commented Apr 10, 2018

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 emacs-mirror/emacs@0f34aa7), 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.

@yangsheng6810
Copy link

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)))

@coroa
Copy link

coroa commented Jul 1, 2019

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.

@beyondpie
Copy link

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

Could you please merge it into the package?

@yangsheng6810
Copy link

@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
Copy link

@beyondpie PR submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants