git-gutter-plus
git-gutter-plus copied to clipboard
Error opening tramp files
When opening a version controlled file via tramp, the following error is occurs and the buffer fails to focus, however the file is still opened:
git-gutter+-refresh: Wrong type argument: arrayp, (tramp-file-name "ssh" "USERNAME" nil "hostname.whatever.lol" nil #("/u/USERNAME/path/to/file.c" 66 74 (ws-butler-chg chg)) nil)
Ran into same problem. See #39
Interestingly, those changes seem to lead to a timeout for tramp-file-name-handler
. I attempted using the ssh command that tramp is using (ssh -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none host.name.here
) and I'm successfully able to connect in my terminal.
@yangsheng6810 Were there additional steps that you had to take after modifying git-gutter+.el
?
No. For me it fixes the problem. Maybe because I have the following in .ssh/config
:
Host *
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
Another possible reason is the cache of tramp. Cleanup remote connections Run tramp-clear-up-all-connections
, close emacs, remove the cache file of tramp (located at .emacs.d/tramp
or .emacs.d/.cache/tramp
or some other similar place), remove control path socket (your tramp.%C
), and start emacs.
Same problem for me when saving a tramp file.
Making @yangsheng6810's changes to the .ssh/config
did fix this for me.
If nothing else, those instructions should be included in the documentation for this library.
@peschkaj can you specify what did you do to work around this issue? Add changes to the .ssh/config
didn't fix for me.
I modified my ssh config and it worked for me. Try clearing out your tramp cache as described in https://github.com/nonsequitur/git-gutter-plus/issues/42#issuecomment-399512479
Unfortunately those workarounds described here didn't work for me: Emacs 26.1, Arch Linux.
I am also on emacs 26.1 on Arch Linux. @kissge Did you apply the workarounds in https://github.com/nonsequitur/git-gutter-plus/pull/39 ?
@yangsheng6810 After applying this workarounds the problem still exists.
git-gutter+-refresh: Wrong type argument: arrayp, (tramp-file-name #("ssh" 0 3 (helm-ff-file t)) nil nil #("USERNAME" 0 9 (helm-ff-file t)) nil "PATH_TO_FILE" nil)
This is my env info if it helps:
#### System Info :computer:
- OS: gnu/linux
- Emacs: 26.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 8727b3181)
- Graphic display: nil
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
‘‘‘elisp
(multiple-cursors helm emacs-lisp neotree graphviz auto-completion syntax-checking version-control spell-checking restclient git github ansible docker nginx sql markdown yaml protobuf shell windows-scripts python erlang elixir
(c-c++ :variables c-c++-default-mode-for-headers ’c++-mode c-c++-enable-auto-newline t c-c++-backend ’lsp-cquery c-c++-lsp-executable "/home/user/.nix-profile/bin/cquery" c-c++-lsp-sem-highlight-method ’font-lock)
semantic html javascript typescript react
(go :variables go-use-test-args "-race -timeout 30s -v" godoc-at-point-function ’godoc-gogetdoc)
nixos evernote org neotree emoji pdf)
‘‘‘
- System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS
@szobov Have you cleaned up the cache for tramp?
Another possible reason is the cache of tramp. Cleanup remote connections Run
tramp-clear-up-all-connections
, close emacs, remove the cache file of tramp (located at.emacs.d/tramp
or.emacs.d/.cache/tramp
or some other similar place), remove control path socket (yourtramp.%C
), and start emacs.
@yangsheng6810 if you mean ~/emacs.d/.cache/tramp
then yes.
@szobov You also need to run tramp-clear-up-all-connections
.
@yangsheng6810 I usually use tramp-cleanup-all-buffers
plus tramp-cleanup-all-connections
every time I finish with tramp.
@szobov Could you toggle on toggle-debug-on-error
and run it again to show the debugger and call trace? It looks to me this might be a problem related to helm
.
FWIW, I ran into this when trying to manage my yadm repo with magit using tramp.
After applying the patch in #39 and restarting spacemacs, it worked fine both with find-file
and spacemacs/helm-find-files
.
@igoralmeida, how did you apply the patch in #39?
I have pasted the code snippet by yangsheng6810 (below) suggested there into my spacemacs/user-config without resolving the problem.
(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)))
I don't think you're supposed to put it in your user-config
. I patched git-gutter+.el
directly.
@paupereira, I have this in my spacemacs/user-config. The problem form your approach is that git-gutter+ is lazy loaded, and may be loaded after your redefinition.
(with-eval-after-load 'git-gutter+
(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))))
Adding this previous snippet in my user-config, plus a cleanup of my tramp connections, solved it for me on emacs 26.
@paupereira, I have this in my spacemacs/user-config. The problem form your approach is that git-gutter+ is lazy loaded, and may be loaded after your redefinition.
(with-eval-after-load 'git-gutter+ (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))))
Works for me, thanks!
@paupereira, I have this in my spacemacs/user-config. The problem form your approach is that git-gutter+ is lazy loaded, and may be loaded after your redefinition.
(with-eval-after-load 'git-gutter+ (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))))
works for me, emacs28+spacemacs