all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nic <nferrier@tapsellferrier.co.uk>
To: emacs-devel@gnu.org
Subject: tramp and remote shell commands
Date: Tue, 07 Aug 2007 05:04:02 +0100	[thread overview]
Message-ID: <873aywgfd9.fsf@nicferrier.tapsellferrier.co.uk> (raw)

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	other threads:[~2007-08-07  4:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-07  4:04 Nic [this message]
2007-08-07 20:36 ` tramp and remote shell commands 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

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

  git send-email \
    --in-reply-to=873aywgfd9.fsf@nicferrier.tapsellferrier.co.uk \
    --to=nferrier@tapsellferrier.co.uk \
    --cc=emacs-devel@gnu.org \
    /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 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.