all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* tramp and remote shell commands
@ 2007-08-07  4:04 Nic
  2007-08-07 20:36 ` Michael Albinus
  0 siblings, 1 reply; 2+ messages in thread
From: Nic @ 2007-08-07  4:04 UTC (permalink / raw)
  To: emacs-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tramp and remote shell commands
  2007-08-07  4:04 tramp and remote shell commands Nic
@ 2007-08-07 20:36 ` Michael Albinus
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Albinus @ 2007-08-07 20:36 UTC (permalink / raw)
  To: Nic; +Cc: emacs-devel

Nic <nferrier@tapsellferrier.co.uk> writes:

> 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.

[...]

> Here's a patch though that makes it work:

Thanks a lot for this. Your first patch fixes indeed a problem in
tramp-handle-process-file. I've committed it to the trunk.

With your second patch, I'm not sure whether it is really
necessary. However, I've reworked handling of output-buffer and
error-buffer in tramp-handle-shell-command; now it shall work without
problem. It's also committed to the trunk.

Could you, please, check whether it is OK for you now?

> Hope that's of use to someone.

Yep.

Best regards, Michael.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-07 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-07  4:04 tramp and remote shell commands Nic
2007-08-07 20:36 ` Michael Albinus

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.