Jürgen Hötzel <[email protected]> writes: > Hi Michael,
Hi Juergen, >> How do you want to get them? Per email? > > Either GitHub pull requests or per email using "git format-patch". Appended are the patches what I have done so far. > Thanks > > Jürgen Best regards, Michael.
>From e23289d46875cdb0cf528960700403d62542fbd2 Mon Sep 17 00:00:00 2001 From: Michael Albinus <[email protected]> Date: Fri, 20 May 2011 21:03:46 +0200 Subject: [PATCH 1/3] Add tramp-autoload cookie for file-name-handler setting. --- tramp-adb.el | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tramp-adb.el b/tramp-adb.el index fdebcfb..56d2666 100644 --- a/tramp-adb.el +++ b/tramp-adb.el @@ -42,6 +42,7 @@ (add-to-list 'tramp-default-method-alist (list "\\`adb" nil tramp-adb-method)) +;;;###tramp-autoload (add-to-list 'tramp-foreign-file-name-handler-alist (cons 'tramp-adb-file-name-p 'tramp-adb-file-name-handler)) @@ -77,7 +78,7 @@ (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) (vc-registered . ignore) ;no vc control files on Android devices (write-region . tramp-adb-handle-write-region) - (rename-file . tramp-sh-handle-rename-file)) + (rename-file . tramp-sh-handle-rename-file)) "Alist of handler functions for Tramp ADB method.") ;;;###tramp-autoload @@ -139,10 +140,10 @@ pass to the OPERATION." (is-symlink (eq ?l (aref mod-string 0))) (symlink-target (and is-symlink (cadr (split-string (buffer-string) "\\( -> \\|\n\\)")))) (uid (nth 1 columns)) - (gid (nth 2 columns)) + (gid (nth 2 columns)) (date (format "%s %s" (nth 4 columns) (nth 5 columns))) (size (string-to-int (nth 3 columns)))) - (list + (list (or is-dir symlink-target) 1 ;link-count ;; no way to handle numeric ids in Androids ash @@ -160,10 +161,10 @@ pass to the OPERATION." (switches) "Almquist shell can't handle multiple arguments. Convert (\"-al\") to (\"-a\" \"-l\")" (split-string (apply 'concat (mapcar (lambda (s) - (replace-regexp-in-string "\\(.\\)" " -\\1" - (replace-regexp-in-string "^-" "" s))) + (replace-regexp-in-string "\\(.\\)" " -\\1" + (replace-regexp-in-string "^-" "" s))) ;; FIXME: Warning about removed switches (long and non-dash) - (remove-if (lambda (s) + (remove-if (lambda (s) (string-match "\\(^--\\|^[^-]\\)" s)) switches))))) @@ -176,7 +177,7 @@ pass to the OPERATION." (when (member "-t" switches) (setq switches (delete "-t" switches)) (tramp-message v 1 "adb: ls can't handle \"-t\" switch")) - (let ((cmd (format "ls %s \"%s\"" (mapconcat 'identity switches " ") + (let ((cmd (format "ls %s \"%s\"" (mapconcat 'identity switches " ") localname))) (tramp-adb-send-command v cmd) (insert @@ -194,7 +195,7 @@ pass to the OPERATION." (defun tramp-adb-handle-directory-files (dir &optional full match nosort files-only) "Like `directory-files' for Tramp files." (with-parsed-tramp-file-name dir nil - (tramp-adb-send-command + (tramp-adb-send-command v (format "%s %s" "ls" (tramp-shell-quote-argument localname))) @@ -249,7 +250,7 @@ pass to the OPERATION." (save-match-data (mapcar (lambda (f) - (if (file-directory-p f) + (if (file-directory-p f) (file-name-as-directory f) f)) (directory-files directory))))))) @@ -329,7 +330,7 @@ pass to the OPERATION." (defun tramp-adb-execute-adb-command (&rest args) "Returns nil on success error-output on failure." (let ((adb-program (expand-file-name "platform-tools/adb" (file-name-as-directory tramp-adb-sdk-dir)))) - (with-temp-buffer + (with-temp-buffer (unless (zerop (apply 'call-process-shell-command adb-program nil t nil args)) (buffer-string))))) -- 1.7.4.1
>From dfc1151ec51b9815f5a08916db0199d403834d61 Mon Sep 17 00:00:00 2001 From: Michael Albinus <[email protected]> Date: Fri, 20 May 2011 21:22:04 +0200 Subject: [PATCH 2/3] Explain in Commentary, how to activate this package. --- tramp-adb.el | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/tramp-adb.el b/tramp-adb.el index 56d2666..8362855 100644 --- a/tramp-adb.el +++ b/tramp-adb.el @@ -20,6 +20,17 @@ ;;; Commentary: +;; In order to activate this package, perform the following steps: +;; +;; - Add a symlink into the Tramp directory +;; ln -s /path/to/this/tramp-adb.el /path/to/tramp/lisp/tramp-adb.el +;; +;; - Regenerate tramp-loaddefs.el +;; cd /path/to/tramp; rm lisp/tramp-loaddefs.el; make +;; +;; - Add the following form into your .emacs +;; (setq tramp-adb-sdk-dir "/path/to/android/sdk") + ;;; Code: (require 'tramp-sh) -- 1.7.4.1
>From 2d862e8b40dd6ff5a6cac264d2fdde7e208825dc Mon Sep 17 00:00:00 2001 From: Michael Albinus <[email protected]> Date: Sat, 21 May 2011 00:35:05 +0200 Subject: [PATCH 3/3] Insert "." and ".." in directory listings. Sort them. --- tramp-adb.el | 39 +++++++++++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 10 deletions(-) diff --git a/tramp-adb.el b/tramp-adb.el index 8362855..22e4d56 100644 --- a/tramp-adb.el +++ b/tramp-adb.el @@ -184,24 +184,44 @@ pass to the OPERATION." "Like `insert-directory' for Tramp files." (when (stringp switches) (setq switches (tramp-adb--gnu-switches-to-ash (split-string switches)))) + ;; FIXME: tramp-adb-handle-expand-file-name does not handle name/. and name/.. (with-parsed-tramp-file-name (expand-file-name filename) nil (when (member "-t" switches) (setq switches (delete "-t" switches)) (tramp-message v 1 "adb: ls can't handle \"-t\" switch")) - (let ((cmd (format "ls %s \"%s\"" (mapconcat 'identity switches " ") - localname))) - (tramp-adb-send-command v cmd) - (insert - (with-current-buffer (tramp-get-buffer v) - (buffer-string))) + (let ((cmd (format "ls %s %%s" (mapconcat 'identity switches " "))) + (name (tramp-shell-quote-argument (file-name-as-directory localname)))) + (dolist (string + (list (concat "-d " name ".") + (concat "-d " name "..") + name)) + (tramp-adb-send-command v (format cmd string)) + (insert + (with-current-buffer (tramp-get-buffer v) + (buffer-string)))) (tramp-adb-sh-fix-ls-outout)))) (defun tramp-adb-sh-fix-ls-outout () - "Andorids ls command doesn't insert size column for directories: Emacs dired can't find files. Insert dummy 0 in empty size columns." + "Androids ls command doesn't insert size column for directories: Emacs dired can't find files. Insert dummy 0 in empty size columns." (save-excursion + ;; Insert missing size. (goto-char (point-min)) - (while (search-forward-regexp "[[:space:]]\\([[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]]\\)" nil t) - (replace-match "0\\1" "\\1" nil )))) + (while (search-forward-regexp "[[:space:]]\\([[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]]\\)" nil t) + (replace-match "0\\1" "\\1" nil)) + ;; Sort entries. + (let* ((lines (split-string (buffer-string) "\n" t)) + (sorted-lines + (sort + lines + (lambda (a b) + (let (posa posb) + (string-match dired-move-to-filename-regexp a) + (setq posa (match-end 0)) + (string-match dired-move-to-filename-regexp b) + (setq posb (match-end 0)) + (string-lessp (substring a posa) (substring b posb))))))) + (delete-region (point-min) (point-max)) + (insert " " (mapconcat 'identity sorted-lines "\n "))))) (defun tramp-adb-handle-directory-files (dir &optional full match nosort files-only) "Like `directory-files' for Tramp files." @@ -415,4 +435,3 @@ connection if a previous connection has died for some reason." (provide 'tramp-adb) ;;; tramp-adb.el ends here - -- 1.7.4.1
_______________________________________________ Tramp-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/tramp-devel
