emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tramp and remote shell commands


From: Nic
Subject: tramp and remote shell commands
Date: Tue, 07 Aug 2007 05:04:02 +0100

I've been having a problem with remote shell commands and tramp for
quite a while. I'm not sure I've ever got it to work.

I always thought it must be me doing something wrong... but I've been
looking at the code and I think I found a few problems.


The problem was that, when editing a tramp located file, I couldn't do
something as simple as:

   C-u M-! date

What should happen is that tramp picks up the command, sends it over
the same communication channel as it uses for the file transfer,
executes it, and passes the data back.

In the C-u case of shell-command, of course, the data should be
inserted into the current buffer.

It was just failing. Never worked.


Here's a patch though that makes it work:

--- a/lisp/net/tramp.el Thu Aug 02 04:10:17 2007 +0000
+++ b/lisp/net/tramp.el Tue Aug 07 04:53:38 2007 +0100
@@ -3581,8 +3581,10 @@ beginning of local filename are not subs
              (tramp-send-command v command)
            ;; We should show the output anyway.
            (when outbuf
-             (with-current-buffer outbuf
-               (insert-buffer-substring (tramp-get-connection-buffer v)))
+              (let ((output-string (with-current-buffer 
(tramp-get-connection-buffer v)
+                                           (buffer-substring (point-min) 
(point-max)))))
+                (with-current-buffer outbuf
+                  (insert output-string)))
              (when display (display-buffer outbuf))))
        ;; When the user did interrupt, we should do it also.
        (error
@@ -3632,10 +3634,10 @@ beginning of local filename are not subs
            (apply 'tramp-handle-start-file-process
                   "*Async Shell*" buffer args)
          (apply 'tramp-handle-process-file
-                (car args) nil buffer nil (cdr args)))
+                (car args) nil buffer nil (cdr args)))
       ;; Insert error messages if they were separated.
       (when (listp buffer)
-       (with-current-buffer error-buffer
+       (with-current-buffer (or error-buffer (get-buffer-create 
"*tramp-shell-error*"))
          (insert-file-contents (cadr buffer)))
        (delete-file (cadr buffer))))))

Both those problems need to be fixed to make it work.

Hope that's of use to someone.

-- 
Nic Ferrier
http://prooveme.com - easy, simple, certificated OpenID




reply via email to

[Prev in Thread] Current Thread [Next in Thread]