help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: playing sounds from Emacs


From: Emanuel Berg
Subject: Re: playing sounds from Emacs
Date: Mon, 14 Aug 2017 23:49:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

> (shell-command "omx-play-sound ~/bo/up.mp3")

To use `shell-command' like that means
everything halts until the command has been
executed, which we can't have, but simply
putting an "&" after - to make it
"asynchronous" which is a nice way of saying
the command will be executed in yet another
shell, a subshell - that won't work. I get ugly
output in buffer "*Async Shell Command*".
and an error message:

    exited abnormally with code 1.

Perhaps some shell color codes are, well,
"async"! (So yes, in principle it should work.)

Anyway without digging into that, I have
another function that will do the job if an
ampersand (&) is appended the command. Here it
is:

    (defun shell-command-silent (command)
      "Execute a shell COMMAND.
    Use & after the command to execute it in the background,
    without output to the echo area."
      (process-file shell-file-name
                    nil ; INFILE
                    nil ; BUFFER
                    nil ; DISPLAY
                    shell-command-switch command) )

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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