unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: master babe6a5e948 1/2: Introduce a new TRAMP method `androidsu'
Date: Sun, 03 Mar 2024 11:00:41 +0100	[thread overview]
Message-ID: <877cijhbxy.fsf@gmx.de> (raw)
In-Reply-To: <87sf182ep4.fsf@yahoo.com> (Po Lu's message of "Sun, 03 Mar 2024 11:10:15 +0800")

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

Po Lu <luangruo@yahoo.com> writes:

Hi,

>> Btw, all what I propose in the following is just based on code reading. I
>> have no chance to test it. Does there exist an emulation, where I could
>> run Emacs in an Android environment? Note that I'm a n00b wrt Android
>> development. tramp-adb.el was contributed by somebody else, and I test
>> it on my Samsung Galaxy S6 and Pixel 6.

Do you have a recommendation how I could use an emulator?

>> This is not very convenient. Why not using the method "su"? It is
>> obvious, that on `android' systems `tramp-androidsu-file-name-handler'
>> is used, and `tramp-sh-file-name-handler' otherwise. We have already a
>> similar constellation: the "smb" method is implemented in both
>> tramp-smb.el and tramp-gvfs.el.
>
> That's fine by me, but please explain how to implement this or direct me
> to documentation with this information, because I did not find any that
> covered writing new methods.

It's not documented :-(

I cannot test myself, but the appended patch might do. Could you, pls, check?

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1443 bytes --]

diff --git a/lisp/net/tramp-androidsu.el b/lisp/net/tramp-androidsu.el
index 1623a0341b2..8704d22e00c 100644
--- a/lisp/net/tramp-androidsu.el
+++ b/lisp/net/tramp-androidsu.el
@@ -37,7 +37,7 @@
 (require 'tramp-sh)

 ;;;###tramp-autoload
-(defconst tramp-androidsu-method "androidsu"
+(defconst tramp-androidsu-method "su"
   "When this method name is used, forward all calls to su.")

 ;;;###tramp-autoload
@@ -66,10 +66,7 @@ tramp-androidsu-su-mm-supported
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-tmpdir               "/data/local/tmp")
-                (tramp-connection-timeout   10)))
-
- (add-to-list 'tramp-default-host-alist
-              `(,tramp-androidsu-method nil "localhost")))
+                (tramp-connection-timeout   10))))

 (defvar android-use-exec-loader) ; androidfns.c.

@@ -645,7 +642,8 @@ tramp-androidsu-file-name-handler-alist
 (defsubst tramp-androidsu-file-name-p (vec-or-filename)
   "Check whether VEC-OR-FILENAME is for the `androidsu' method."
   (when-let* ((vec (tramp-ensure-dissected-file-name vec-or-filename)))
-    (equal (tramp-file-name-method vec) tramp-androidsu-method)))
+    (and (eq system-type 'android)
+         (equal (tramp-file-name-method vec) tramp-androidsu-method))))

 ;;;###tramp-autoload
 (defun tramp-androidsu-file-name-handler (operation &rest args)

  reply	other threads:[~2024-03-03 10:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <170892805989.23297.10872025500935567738@vcs2.savannah.gnu.org>
     [not found] ` <20240226061420.EF1D4C00231@vcs2.savannah.gnu.org>
2024-02-26  8:51   ` master babe6a5e948 1/2: Introduce a new TRAMP method `androidsu' Michael Albinus
2024-02-26  9:02     ` Po Lu
2024-02-26  9:19       ` Michael Albinus
2024-02-26 10:54         ` Po Lu
2024-02-28 15:38           ` Michael Albinus
2024-03-02 14:53           ` Michael Albinus
2024-03-03  3:10             ` Po Lu
2024-03-03 10:00               ` Michael Albinus [this message]
2024-03-03 11:03                 ` Po Lu
2024-03-03 11:31                   ` Michael Albinus
2024-03-03 12:09                 ` Po Lu
2024-03-03 12:17                   ` Michael Albinus
2024-03-03 12:35                     ` Po Lu
2024-03-03 12:50                       ` Michael Albinus
2024-03-04  3:29                         ` Po Lu
2024-03-04 14:47                           ` Michael Albinus
2024-03-03 11:30               ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cijhbxy.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).