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: Michael Albinus
Subject: Re: shell-command-on-region doesn't run remotely
Date: Fri, 19 Feb 2010 09:26:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (gnu/linux)

Dan Davison <address@hidden> writes:

> I'd like to use shell-command-on-region with tramp, so that the shell
> process is running remotely. However, it seems that although
> shell-command behaves in this way, shell-command-on-region does
> not.

`shell-command-on-region' is not a magic file name operation like
`shell-command'. Internally, it calls `call-process-region', which isn't
magic neither. See (info "(elisp)Magic File Names")

> 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.
>
> But maybe I'm getting something wrong, as the above behaviour seems to
> contradict this 2008 thread on tramp-devel
>
> http://lists.gnu.org/archive/html/tramp-devel/2008-05/msg00025.html
>
> and also this Jan 2009 thread on help-gnu-emacs
>
> http://lists.gnu.org/archive/html/help-gnu-emacs/2009-01/msg00487.html

I've proposed to make `call-process and `call-process-region'
magic. This was rejected by the Emacs maintainers (with good
reasons). However, there still exists a prototype implementation for
`call-process-region' in Tramp. That's what you see here.

So the best solution might be to request, that `shell-command-on-region'
shall be a magic operation like `shell-command'. It won't find its way
into Emacs 23.2 (it's already in feature freeze), but it might be
accepted for a later release.

As workaround, you could try to use `tramp-handle-call-process-region'
(but I cannot guarantee it stays forever in Tramp). Something like this:

(defadvice call-process-region
  (around tramp-advice-call-process-region activate)
  "Invoke `tramp-handle-call-process-region' for Tramp files."
  (if (file-remote-p default-directory)
      (setq ad-return-value
            (apply 'tramp-handle-call-process-region (ad-get-args 0)))
    ad-do-it))

I haven't tested it, 'though.

> Dan

Best regards, Michael.




reply via email to

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