diff options
| author | Michael Albinus | 2009-08-09 14:29:11 +0000 |
|---|---|---|
| committer | Michael Albinus | 2009-08-09 14:29:11 +0000 |
| commit | 8e754ea218196646ce0d331ac5c2d8b1970a66da (patch) | |
| tree | 3a65770b746e77d96574b1094bbb1ba566899f61 | |
| parent | 18d433a76155f6079e14d27d5cd7edbc206cacef (diff) | |
| download | emacs-8e754ea218196646ce0d331ac5c2d8b1970a66da.tar.gz emacs-8e754ea218196646ce0d331ac5c2d8b1970a66da.zip | |
* net/tramp.el (tramp-get-ls-command-with-dired): New defun.
(tramp-handle-insert-directory): Handle "--dired". (Bug#4075)
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 57 |
2 files changed, 50 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b95de0d804b..85242eacf7b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2009-08-09 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-get-ls-command-with-dired): New defun. | ||
| 4 | (tramp-handle-insert-directory): Handle "--dired". (Bug#4075) | ||
| 5 | |||
| 1 | 2009-08-09 Chong Yidong <cyd@stupidchicken.com> | 6 | 2009-08-09 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * subr.el: Provide hashtable-print-readable. | 8 | * subr.el: Provide hashtable-print-readable. |
| @@ -290,7 +295,7 @@ | |||
| 290 | 2009-08-04 Michael Albinus <michael.albinus@gmx.de> | 295 | 2009-08-04 Michael Albinus <michael.albinus@gmx.de> |
| 291 | 296 | ||
| 292 | * net/tramp.el (top): Make check for tramp-gvfs loading more | 297 | * net/tramp.el (top): Make check for tramp-gvfs loading more |
| 293 | robust. | 298 | robust. (Bug#3977) |
| 294 | (tramp-handle-insert-file-contents): `unwind-protect' must be | 299 | (tramp-handle-insert-file-contents): `unwind-protect' must be |
| 295 | inside `with-parsed-tramp-file-name'. | 300 | inside `with-parsed-tramp-file-name'. |
| 296 | 301 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4ccf2ab6e58..94b4858a074 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -141,7 +141,8 @@ | |||
| 141 | 'tramp-fish | 141 | 'tramp-fish |
| 142 | 142 | ||
| 143 | ;; tramp-gvfs needs D-Bus messages. Available since Emacs 23 | 143 | ;; tramp-gvfs needs D-Bus messages. Available since Emacs 23 |
| 144 | ;; on some system types. | 144 | ;; on some system types. We don't call `dbus-ping', because |
| 145 | ;; this would load dbus.el. | ||
| 145 | (when (and (featurep 'dbusbind) | 146 | (when (and (featurep 'dbusbind) |
| 146 | (condition-case nil | 147 | (condition-case nil |
| 147 | (funcall 'dbus-get-unique-name :session) | 148 | (funcall 'dbus-get-unique-name :session) |
| @@ -3641,10 +3642,8 @@ This is like `dired-recursive-delete-directory' for Tramp files." | |||
| 3641 | (not (symbol-value 'ls-lisp-use-insert-directory-program))) | 3642 | (not (symbol-value 'ls-lisp-use-insert-directory-program))) |
| 3642 | (tramp-run-real-handler | 3643 | (tramp-run-real-handler |
| 3643 | 'insert-directory (list filename switches wildcard full-directory-p)) | 3644 | 'insert-directory (list filename switches wildcard full-directory-p)) |
| 3644 | ;; For the moment, we assume that the remote "ls" program does not | 3645 | (when (and (string-match "^--dired\\s-+" switches) |
| 3645 | ;; grok "--dired". In the future, we should detect this on | 3646 | (not (tramp-get-ls-command-with-dired v))) |
| 3646 | ;; connection setup. | ||
| 3647 | (when (string-match "^--dired\\s-+" switches) | ||
| 3648 | (setq switches (replace-match "" nil t switches))) | 3647 | (setq switches (replace-match "" nil t switches))) |
| 3649 | (tramp-message | 3648 | (tramp-message |
| 3650 | v 4 "Inserting directory `ls %s %s', wildcard %s, fulldir %s" | 3649 | v 4 "Inserting directory `ls %s %s', wildcard %s, fulldir %s" |
| @@ -3693,12 +3692,38 @@ This is like `dired-recursive-delete-directory' for Tramp files." | |||
| 3693 | (tramp-shell-quote-argument | 3692 | (tramp-shell-quote-argument |
| 3694 | (tramp-run-real-handler | 3693 | (tramp-run-real-handler |
| 3695 | 'file-name-nondirectory (list localname))))))) | 3694 | 'file-name-nondirectory (list localname))))))) |
| 3696 | ;; We cannot use `insert-buffer-substring' because the Tramp buffer | 3695 | (let ((beg (point))) |
| 3697 | ;; changes its contents before insertion due to calling | 3696 | ;; We cannot use `insert-buffer-substring' because the Tramp |
| 3698 | ;; `expand-file' and alike. | 3697 | ;; buffer changes its contents before insertion due to calling |
| 3699 | (insert | 3698 | ;; `expand-file' and alike. |
| 3700 | (with-current-buffer (tramp-get-buffer v) | 3699 | (insert |
| 3701 | (buffer-string)))))) | 3700 | (with-current-buffer (tramp-get-buffer v) |
| 3701 | (buffer-string))) | ||
| 3702 | |||
| 3703 | ;; Check for "--dired" output. | ||
| 3704 | (goto-char (point-max)) | ||
| 3705 | (forward-line -2) | ||
| 3706 | (when (looking-at "//DIRED//") | ||
| 3707 | (let ((end (line-end-position)) | ||
| 3708 | (linebeg (point))) | ||
| 3709 | ;; Now read the numeric positions of file names. | ||
| 3710 | (goto-char linebeg) | ||
| 3711 | (forward-word 1) | ||
| 3712 | (forward-char 3) | ||
| 3713 | (while (< (point) end) | ||
| 3714 | (let ((start (+ beg (read (current-buffer)))) | ||
| 3715 | (end (+ beg (read (current-buffer))))) | ||
| 3716 | (if (memq (char-after end) '(?\n ?\s)) | ||
| 3717 | ;; End is followed by \n or by " -> ". | ||
| 3718 | (put-text-property start end 'dired-filename t))))) | ||
| 3719 | ;; Reove training lines. | ||
| 3720 | (goto-char (point-max)) | ||
| 3721 | (forward-line -1) | ||
| 3722 | (while (looking-at "//") | ||
| 3723 | (forward-line 1) | ||
| 3724 | (delete-region (match-beginning 0) (point)) | ||
| 3725 | (forward-line -1)))) | ||
| 3726 | (goto-char (point-max))))) | ||
| 3702 | 3727 | ||
| 3703 | (defun tramp-handle-unhandled-file-name-directory (filename) | 3728 | (defun tramp-handle-unhandled-file-name-directory (filename) |
| 3704 | "Like `unhandled-file-name-directory' for Tramp files." | 3729 | "Like `unhandled-file-name-directory' for Tramp files." |
| @@ -7359,6 +7384,13 @@ necessary only. This function will be used in file name completion." | |||
| 7359 | (setq dl (cdr dl)))))) | 7384 | (setq dl (cdr dl)))))) |
| 7360 | (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))) | 7385 | (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))) |
| 7361 | 7386 | ||
| 7387 | (defun tramp-get-ls-command-with-dired (vec) | ||
| 7388 | (save-match-data | ||
| 7389 | (with-connection-property vec "ls-dired" | ||
| 7390 | (tramp-message vec 5 "Checking, whether `ls --dired' works") | ||
| 7391 | (zerop (tramp-send-command-and-check | ||
| 7392 | vec (format "%s --diredd /" (tramp-get-ls-command vec))))))) | ||
| 7393 | |||
| 7362 | (defun tramp-get-test-command (vec) | 7394 | (defun tramp-get-test-command (vec) |
| 7363 | (with-connection-property vec "test" | 7395 | (with-connection-property vec "test" |
| 7364 | (with-current-buffer (tramp-get-buffer vec) | 7396 | (with-current-buffer (tramp-get-buffer vec) |
| @@ -7814,7 +7846,6 @@ Only works for Bourne-like shells." | |||
| 7814 | ;; within Tramp around one of its calls to accept-process-output (or | 7846 | ;; within Tramp around one of its calls to accept-process-output (or |
| 7815 | ;; around one of the loops that calls accept-process-output) | 7847 | ;; around one of the loops that calls accept-process-output) |
| 7816 | ;; (Stefan Monnier). | 7848 | ;; (Stefan Monnier). |
| 7817 | ;; * Autodetect if remote `ls' groks the "--dired" switch. | ||
| 7818 | ;; * Rewrite `tramp-shell-quote-argument' to abstain from using | 7849 | ;; * Rewrite `tramp-shell-quote-argument' to abstain from using |
| 7819 | ;; `shell-quote-argument'. | 7850 | ;; `shell-quote-argument'. |
| 7820 | ;; * In Emacs 21, `insert-directory' shows total number of bytes used | 7851 | ;; * In Emacs 21, `insert-directory' shows total number of bytes used |
| @@ -7831,7 +7862,7 @@ Only works for Bourne-like shells." | |||
| 7831 | ;; * Grok `append' parameter for `write-region'. | 7862 | ;; * Grok `append' parameter for `write-region'. |
| 7832 | ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? | 7863 | ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? |
| 7833 | ;; * abbreviate-file-name | 7864 | ;; * abbreviate-file-name |
| 7834 | ;; * better error checking. At least whenever we see something | 7865 | ;; * Better error checking. At least whenever we see something |
| 7835 | ;; strange when doing zerop, we should kill the process and start | 7866 | ;; strange when doing zerop, we should kill the process and start |
| 7836 | ;; again. (Greg Stark) | 7867 | ;; again. (Greg Stark) |
| 7837 | ;; * Provide a local cache of old versions of remote files for the rsync | 7868 | ;; * Provide a local cache of old versions of remote files for the rsync |