all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Gist: get output of an external program on region
@ 2015-08-26  4:50 Ian Zimmerman
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Zimmerman @ 2015-08-26  4:50 UTC (permalink / raw)
  To: help-gnu-emacs

I couldn't believe this didn't already exist.

There is shell-command-on-region and shell-command-as-string, but
nothing that combines the input marshalling and the output marshalling.

https://gist.github.com/nobrowser/dbeb2df55bdcbe93d39f

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: Gist: get output of an external program on region
       [not found] <mailman.112.1440564636.28410.help-gnu-emacs@gnu.org>
@ 2015-08-26  6:11 ` Pascal J. Bourguignon
  2015-08-26  6:59   ` Ian Zimmerman
  0 siblings, 1 reply; 4+ messages in thread
From: Pascal J. Bourguignon @ 2015-08-26  6:11 UTC (permalink / raw)
  To: help-gnu-emacs

Ian Zimmerman <itz@buug.org> writes:

> I couldn't believe this didn't already exist.
>
> There is shell-command-on-region and shell-command-as-string, but
> nothing that combines the input marshalling and the output marshalling.

You mean, just like C-u M-| ?


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: Gist: get output of an external program on region
  2015-08-26  6:11 ` Pascal J. Bourguignon
@ 2015-08-26  6:59   ` Ian Zimmerman
  2015-08-26 15:18     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Zimmerman @ 2015-08-26  6:59 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-08-26 08:11 +0200, Pascal J. Bourguignon wrote:

> > There is shell-command-on-region and shell-command-as-string, but
> > nothing that combines the input marshalling and the output marshalling.

> You mean, just like C-u M-| ?

No:

  M-| runs the command shell-command-on-region, which is an interactive
  compiled Lisp function in `simple.el'.

  It is bound to M-|, <menu-bar> <tools> <shell-on-region>.

  (shell-command-on-region START END COMMAND &optional OUTPUT-BUFFER
  REPLACE ERROR-BUFFER DISPLAY-ERROR-BUFFER)

  Execute string COMMAND in inferior shell with region as input.
  Normally display output (if any) in temp buffer `*Shell Command
  Output*';
  Prefix arg means replace the region with it.  Return the exit code of
  COMMAND.

1. I need the output _as a string_.  Not in some " *itz-temp-buffer*" which
I then have to messily kill.

2. I need to pass the region to the program _as stdin_.

and also

3. I need to avoid the interactive side-effects of
shell-command-on-region, such as its tendency to create a new window to
view the output buffer.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: Gist: get output of an external program on region
  2015-08-26  6:59   ` Ian Zimmerman
@ 2015-08-26 15:18     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-08-26 15:18 UTC (permalink / raw)
  To: help-gnu-emacs

> 3. I need to avoid the interactive side-effects of
> shell-command-on-region, such as its tendency to create a new window to
> view the output buffer.

Of course.  Elisp code rarely if ever needs/wants to call things like
shell-command-on-region.  It should use call-process and friends.


        Stefan




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

end of thread, other threads:[~2015-08-26 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26  4:50 Gist: get output of an external program on region Ian Zimmerman
     [not found] <mailman.112.1440564636.28410.help-gnu-emacs@gnu.org>
2015-08-26  6:11 ` Pascal J. Bourguignon
2015-08-26  6:59   ` Ian Zimmerman
2015-08-26 15:18     ` Stefan Monnier

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.