all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Retrieve values of variables in remote files
@ 2023-01-06 13:42 André A. Gomes
  2023-01-07 12:20 ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: André A. Gomes @ 2023-01-06 13:42 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: michael.albinus

Hi,

I expected that running the following on a remote Tramp buffer would
give me the right value.

--8<---------------cut here---------------start------------->8---
(with-connection-local-variables shell-file-name)
=> "/bin/sh"
--8<---------------cut here---------------end--------------->8---

The right value would be "/data/data/com.termux/files/urs/bin/bash"
since this is a remote buffer on Termux.

I'm a bit surprised since xref-matches-in-files uses
with-connection-local-variables and it always gets the right values.

Any idea?  Thank you.


-- 
André A. Gomes
"You cannot even find the ruins..."



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Retrieve values of variables in remote files
  2023-01-06 13:42 Retrieve values of variables in remote files André A. Gomes
@ 2023-01-07 12:20 ` Michael Albinus
  2023-01-10 12:39   ` André A. Gomes
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2023-01-07 12:20 UTC (permalink / raw)
  To: André A. Gomes; +Cc: help-gnu-emacs

André A. Gomes <andremegafone@gmail.com> writes:

> Hi,

Hi André,

> I expected that running the following on a remote Tramp buffer would
> give me the right value.
>
> (with-connection-local-variables shell-file-name)
> => "/bin/sh"
>
> The right value would be "/data/data/com.termux/files/urs/bin/bash"
> since this is a remote buffer on Termux.

Yes, but you must teach Tramp to know this. Tramp speaks about this in
its manual (info "(tramp) Android shell setup") but you can use that for
any other remote Termux setup.

What is the value of variables connection-local-criteria-alist,
connection-local-profile-alist and connection-local-variables-alist,
evaluated in the respective buffer?

> I'm a bit surprised since xref-matches-in-files uses
> with-connection-local-variables and it always gets the right values.

Btw, which Emacs version / Tramp version are you using?

> Any idea?  Thank you.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Retrieve values of variables in remote files
  2023-01-07 12:20 ` Michael Albinus
@ 2023-01-10 12:39   ` André A. Gomes
  2023-01-10 14:11     ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: André A. Gomes @ 2023-01-10 12:39 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Hi Michael,

Thank you for the reply.

I understood why I'm confused, so I'll rephrase it.  Here's my tramp
config:

--8<---------------cut here---------------start------------->8---
(dolist (path '("/run/setuid-programs"
                "/run/current-system/profile/bin"
                "/run/current-system/profile/sbin"
                "/data/data/com.termux/files/usr/bin"
                "/home/aadcg/.guix-profile/bin"
                "/home/aadcg/.guix-profile/sbin"))
  (add-to-list 'tramp-remote-path path))

(add-to-list 'tramp-remote-path 'tramp-own-remote-path)

(dolist (prop '(("/ssh:termux:" "remote-shell" "sh")
                ("/ssh:termux:" "remote-path" ("/data/data/com.termux/files/usr/bin"))
                ("/ssh:termux:" "tmpdir" "/data/data/com.termux/files/usr/tmp")))
  (add-to-list 'tramp-connection-properties prop))
--8<---------------cut here---------------end--------------->8---

When I'm on a remote Termux buffer, evaluating
(with-connection-local-variables temporary-file-directory) gives me
"/tmp/", which is wrong.  But when I run the command
xref-matches-in-files on a remote buffer, I get the following in the
*Messages* buffer:

--8<---------------cut here---------------start------------->8---
Copying /tmp/ppfrSh2Q4t to /ssh:termux:/data/data/com.termux/files/usr/tmp/tramp.lT1BW5...done
--8<---------------cut here---------------end--------------->8---

Which indicated me that Tramp is pointing to the right temp dir at
Termux.  I don't understand what's happening here...  

> What is the value of variables connection-local-criteria-alist,
> connection-local-profile-alist and connection-local-variables-alist,
> evaluated in the respective buffer?

Respectively:

--8<---------------cut here---------------start------------->8---
(((:application tramp :protocol "adb")
tramp-adb-connection-local-default-shell-profile
tramp-adb-connection-local-default-ps-profile) ((:application tramp)
tramp-connection-local-default-system-profile
tramp-connection-local-default-shell-profile))
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
(((:application tramp :protocol "adb")
tramp-adb-connection-local-default-shell-profile
tramp-adb-connection-local-default-ps-profile) ((:application tramp)
tramp-connection-local-default-system-profile
tramp-connection-local-default-shell-profile))
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
nil
--8<---------------cut here---------------end--------------->8---

> Btw, which Emacs version / Tramp version are you using?

Emacs version 28.2, tramp version 2.6.0.

Thanks.


-- 
André A. Gomes
"You cannot even find the ruins..."



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Retrieve values of variables in remote files
  2023-01-10 12:39   ` André A. Gomes
@ 2023-01-10 14:11     ` Michael Albinus
  2023-01-10 14:57       ` André A. Gomes
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2023-01-10 14:11 UTC (permalink / raw)
  To: André A. Gomes; +Cc: help-gnu-emacs

André A. Gomes <andremegafone@gmail.com> writes:

> Hi Michael,

Hi André,

> I understood why I'm confused, so I'll rephrase it.  Here's my tramp
> config:
>
> (dolist (path '("/run/setuid-programs"
>                 "/run/current-system/profile/bin"
>                 "/run/current-system/profile/sbin"
>                 "/data/data/com.termux/files/usr/bin"
>                 "/home/aadcg/.guix-profile/bin"
>                 "/home/aadcg/.guix-profile/sbin"))
>   (add-to-list 'tramp-remote-path path))
>
> (add-to-list 'tramp-remote-path 'tramp-own-remote-path)
>
> (dolist (prop '(("/ssh:termux:" "remote-shell" "sh")
>                 ("/ssh:termux:" "remote-path" ("/data/data/com.termux/files/usr/bin"))
>                 ("/ssh:termux:" "tmpdir" "/data/data/com.termux/files/usr/tmp")))
>   (add-to-list 'tramp-connection-properties prop))
>
>
> When I'm on a remote Termux buffer, evaluating
> (with-connection-local-variables temporary-file-directory) gives me
> "/tmp/", which is wrong.

`temporary-file-directory' isn't handled as connection-local-variable, so
it is always "/tmp".

> But when I run the command
> xref-matches-in-files on a remote buffer, I get the following in the
> *Messages* buffer:
>
> Copying /tmp/ppfrSh2Q4t to /ssh:termux:/data/data/com.termux/files/usr/tmp/tramp.lT1BW5...done
>
>
> Which indicated me that Tramp is pointing to the right temp dir at
> Termux.  I don't understand what's happening here...  

Tramp DTRT :-)

It doesn't use the variable `temporary-file-directory', but the function
with the same name. What happens, if you eval (temporary-file-directory)
in a buffer with a remote default-directory?

> Thanks.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Retrieve values of variables in remote files
  2023-01-10 14:11     ` Michael Albinus
@ 2023-01-10 14:57       ` André A. Gomes
  0 siblings, 0 replies; 5+ messages in thread
From: André A. Gomes @ 2023-01-10 14:57 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Michael Albinus <michael.albinus@gmx.de> writes:

> It doesn't use the variable `temporary-file-directory', but the function
> with the same name. What happens, if you eval (temporary-file-directory)
> in a buffer with a remote default-directory?

Oh, now it all makes sense!  Thank you Michael :)


-- 
André A. Gomes
"You cannot even find the ruins..."



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-10 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 13:42 Retrieve values of variables in remote files André A. Gomes
2023-01-07 12:20 ` Michael Albinus
2023-01-10 12:39   ` André A. Gomes
2023-01-10 14:11     ` Michael Albinus
2023-01-10 14:57       ` André A. Gomes

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.