Dan Davison <[email protected]> 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.


_______________________________________________
Tramp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/tramp-devel

Reply via email to