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

how to customize readtags path for a remote machine? #120

Open
askeySnip opened this issue Apr 28, 2022 · 6 comments
Open

how to customize readtags path for a remote machine? #120

askeySnip opened this issue Apr 28, 2022 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@askeySnip
Copy link

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!

@AmaiKinono
Copy link
Member

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.

@askeySnip
Copy link
Author

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.

@AmaiKinono AmaiKinono reopened this Apr 29, 2022
@AmaiKinono
Copy link
Member

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)

@fuzy112
Copy link

fuzy112 commented Oct 17, 2022

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.

citre/citre-core.el

Lines 58 to 65 in 1c0ca63

(defcustom citre-readtags-program nil
"The name or path of the readtags program.
Set this if readtags is not in your PATH, or its name is not
\"readtags\".
Citre requires the readtags program provided by Universal Ctags."
:type '(set file (const nil)))

@Ergus
Copy link

Ergus commented Feb 21, 2023

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

AmaiKinono added a commit that referenced this issue Apr 21, 2024
They should be "string" because they can also be the name (not the path)
of the executable, if it's in the PATH.

See #120 (comment).
@AmaiKinono
Copy link
Member

@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.

@AmaiKinono AmaiKinono added the help wanted Extra attention is needed label Apr 21, 2024
@AmaiKinono AmaiKinono changed the title how to customize readtags path? how to customize readtags path for a remote machine? Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants