I write code on one system (x86) and ssh into another (ARM) to compile my code. I use tramp to ssh from within emacs. Projectile command (projectile-project-root) give this info:
/home/userX/projectY
The buffer name after sshing into remote system and be under same project is:
/ssh:userX@sxy-ss-02:/home/userX/projectY
What is a lisp code that would:
Basically, matching (from the list of opened buffer) on /ssh:....../projectY
Untested - add this to your init file:
(setq remote-user "userX")
(setq remote-host "sxy-ss-02")
(defun switch-buffer-to-remote-project ()
(interactive)
(let ((tramp-name (format "/ssh:%s@%s:%s" remote-user remote-host (projectile-project-root))))
(find-file tramp-name)))
(global-set-key (kbd "C-c C-Z") #'switch-buffer-to-remote-project)
It binds the command to C-c C-z
which was undefined in my case, but you might want to choose a different keybinding for it.