tramp-devel
[Top][All Lists]
Advanced

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

Re: shell-command-on-region doesn't run remotely


From: Alexey Lebedeff
Subject: Re: shell-command-on-region doesn't run remotely
Date: Fri, 19 Feb 2010 13:22:16 +0300
User-agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.7 Emacs/23.1 (i386-mingw-nt5.1.2600) MULE/6.0 (HANACHIRUSATO)

At Thu, 18 Feb 2010 10:47:07 -0500,
Dan Davison wrote:
> I'm curious as to whether this is intended behaviour or a bug, and would
> appreciate any suggestions for a nice way to implement my own version of
> shell-command-on-region (using tramp technology?) that does run
> remotely.

Don't sure that it's nice, but I'm using following function.
It handles whole buffer, not region, which can be easily fixed.

(defun buffer->process-file (program &optional output-buffer display &rest args)
  "Stores current buffer to temporary file, and passes this file
to process-file. In this way we can send buffer contents to
commands on other hosts (via tramp)"
  (let ((temp-buffer (get-buffer-create "*buffer-process-file-temp*"))
        (temp-file-name (make-temp-file "buffer-process-file-temp"))
        (current-buffer (current-buffer)))
    (unwind-protect
        (progn 
          (with-current-buffer temp-buffer
            (erase-buffer)
            (insert-buffer-substring current-buffer)
            (write-file temp-file-name))
          (apply #'process-file program temp-file-name output-buffer display 
args))
      (delete-file temp-file-name))))





reply via email to

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