all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Help with async-shell-command
@ 2014-02-04 23:44 Pete Ley
  2014-02-05  1:17 ` Thorsten Jolitz
  2014-02-05  1:37 ` E Sabof
  0 siblings, 2 replies; 5+ messages in thread
From: Pete Ley @ 2014-02-04 23:44 UTC (permalink / raw)
  To: help-gnu-emacs

Hey,

Is there a way to call async-shell-command so that it doesn't open an
output buffer? I'm trying to write a sync routine that'll get called
pretty often and I'd like to use async-shell-command, but it always
opens an annoying *Async Shell Command* buffer, even when there is no
output. 

So far, I've sort of solved the problem by writing a wrapper function
that calls it and (delete-windows-on "*Async Shell Command*") afterward,
but this has the side effect of closing a window I was using if the
window wasn't split for the purpose of the buffer.

Is there a way I can 1) call a shell command asychronously 2) without
showing *Async Shell Command* and 3) without messing up my window setup?

Thanks
Pete



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

* Re: Help with async-shell-command
  2014-02-04 23:44 Help with async-shell-command Pete Ley
@ 2014-02-05  1:17 ` Thorsten Jolitz
  2014-02-05  5:00   ` Pete Ley
  2014-02-05  1:37 ` E Sabof
  1 sibling, 1 reply; 5+ messages in thread
From: Thorsten Jolitz @ 2014-02-05  1:17 UTC (permalink / raw)
  To: help-gnu-emacs

Pete Ley <peteley11235@gmail.com> writes:

> Hey,
>
> Is there a way to call async-shell-command so that it doesn't open an
> output buffer? I'm trying to write a sync routine that'll get called
> pretty often and I'd like to use async-shell-command, but it always
> opens an annoying *Async Shell Command* buffer, even when there is no
> output. 
>
> So far, I've sort of solved the problem by writing a wrapper function
> that calls it and (delete-windows-on "*Async Shell Command*") afterward,
> but this has the side effect of closing a window I was using if the
> window wasn't split for the purpose of the buffer.
>
> Is there a way I can 1) call a shell command asychronously 2) without
> showing *Async Shell Command* and 3) without messing up my window setup?

you can use

,--------------------------------------------------------------------------
| start-process is a built-in function in `C source code'.
| 
| (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)
| 
| Start a program in a subprocess.  Return the process object for it.
| NAME is name for process.  It is modified if necessary to make it unique.
| BUFFER is the buffer (or buffer name) to associate with the process.
| 
| Process output (both standard output and standard error streams) goes
| at end of BUFFER, unless you specify an output stream or filter
| function to handle the output.  BUFFER may also be nil, meaning that
| this process is not associated with any buffer.
`--------------------------------------------------------------------------

e.g. M-:

,--------------------------------------------------------------
| (start-process "mp" nil "mplayer"
|   "-playlist" "http://streams.greenhost.nl:8080/hardbop.m3u")
`--------------------------------------------------------------

and then M-:

,--------------------
| (kill-process "mp")
`--------------------


-- 
cheers,
Thorsten




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

* Re: Help with async-shell-command
  2014-02-04 23:44 Help with async-shell-command Pete Ley
  2014-02-05  1:17 ` Thorsten Jolitz
@ 2014-02-05  1:37 ` E Sabof
  2014-02-05  3:25   ` Stefan Monnier
  1 sibling, 1 reply; 5+ messages in thread
From: E Sabof @ 2014-02-05  1:37 UTC (permalink / raw)
  To: Pete Ley; +Cc: help-gnu-emacs

This is the usual way of preserving layout:

(save-window-excursion
  (async-shell-command))

Evgeni

peteley11235@gmail.com writes:

> Hey,
>
> Is there a way to call async-shell-command so that it doesn't open an
> output buffer? I'm trying to write a sync routine that'll get called
> pretty often and I'd like to use async-shell-command, but it always
> opens an annoying *Async Shell Command* buffer, even when there is no
> output.
>
> So far, I've sort of solved the problem by writing a wrapper function
> that calls it and (delete-windows-on "*Async Shell Command*") afterward,
> but this has the side effect of closing a window I was using if the
> window wasn't split for the purpose of the buffer.
>
> Is there a way I can 1) call a shell command asychronously 2) without
> showing *Async Shell Command* and 3) without messing up my window setup?
>
> Thanks
> Pete



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

* Re: Help with async-shell-command
  2014-02-05  1:37 ` E Sabof
@ 2014-02-05  3:25   ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-02-05  3:25 UTC (permalink / raw)
  To: help-gnu-emacs

> This is the usual way of preserving layout:
> (save-window-excursion

Nope.  This is the usual way of trying to patch over code which messes
up the layout, but that fails miserably if you have something like popup
frames or other display-buffer-alist settings.

I think using `start-process' is the better solution, so the layout is
not affected and there's no need to try and undo it.


        Stefan




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

* Re: Help with async-shell-command
  2014-02-05  1:17 ` Thorsten Jolitz
@ 2014-02-05  5:00   ` Pete Ley
  0 siblings, 0 replies; 5+ messages in thread
From: Pete Ley @ 2014-02-05  5:00 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

> ,--------------------------------------------------------------------------
> | start-process is a built-in function in `C source code'.
> | 
> | (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)
> | 
> | Start a program in a subprocess.  Return the process object for it.
> | NAME is name for process.  It is modified if necessary to make it unique.
> | BUFFER is the buffer (or buffer name) to associate with the process.
> | 
> | Process output (both standard output and standard error streams) goes
> | at end of BUFFER, unless you specify an output stream or filter
> | function to handle the output.  BUFFER may also be nil, meaning that
> | this process is not associated with any buffer.
> `--------------------------------------------------------------------------

Perfect! Exactly what I'm looking for. 



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

end of thread, other threads:[~2014-02-05  5:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-04 23:44 Help with async-shell-command Pete Ley
2014-02-05  1:17 ` Thorsten Jolitz
2014-02-05  5:00   ` Pete Ley
2014-02-05  1:37 ` E Sabof
2014-02-05  3:25   ` 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.