citre
citre copied to clipboard
how to customize readtags path for a remote machine?
the question is when I use tramp for remote dev, it use the remote readtags or the local readtags? and how can I config the readtags located in remote machine for citre to use? thanks!
Actually I don't have a remote machine so I can't answer this question. I test TRAMP using local files.
To the best of my knowledge, TRAMP uses remote programs when visiting remote files.
Actually I don't have a remote machine so I can't answer this question. I test TRAMP using local files.
To the best of my knowledge, TRAMP uses remote programs when visiting remote files.
You are right. So I want to know how to config different path?
The temp solution is using source
to add the remote different readtags path into PATH.
Thanks for your reply.
What about this:
(defun set-remote-ctags-env ()
"Set readtags path according to host name."
(when-let* ((remote-host (file-remote-p (buffer-file-name) 'host)))
(setq-local citre-readtags-program
(pcase remote-host
;; Put your pair of hostname and readtags path here
("remote-host-1" "readtags-program-path-1")
("remote-host-2" "readtags-program-path-2")))))
(add-hook 'find-file-hook #'set-remote-ctags-env)
citre-readtags-program
is defined as (set file (const nil))
in citre-core.el
, but it is used as a string, so if you customize this variable using Easy Customization, an error will occur when running citre commands.
https://github.com/universal-ctags/citre/blob/1c0ca637c7993559a0175e3001941457b8c71211/citre-core.el#L58-L65
Hi:
Related to this, the oficial emacs solution for these problems is to use connection-local-variables.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Connection-Local-Variables.html
I made the gtags-mode implementation for emacs with full tramp support and I use them to enable full remote executable detection and some memoization (to avoid the impact of calling executable-find more than needed) but at the same time it checks when gtags is not available remotely to avoid nasty errors
https://github.com/Ergus/gtags-mode
Just my 5 cents
@Ergus Thanks very much, and sorry for the late response.
I think I understand the overall approach, but I have trouble understanding your implementation. To me it seems like all the things we should do is wrapping the codes that start a process in with-connection-local-variables
.
Also, as I don't have a remote machine, I cannot test the code or write a user document explaining how to customize executable paths on remote machines.
What we need is a TRAMP user to help use write the code and documentation.