Created
March 18, 2016 17:32
-
-
Save dvnmk/c76105bf0eb5a73565ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
;; If you want to create a file, visit that file with C-x C-f, | |
;; then enter the text in that file's own buffer. | |
this is startx-buffer | |
(async-shell-command "mpv --no-video 'https://www.youtube.com/playlist?list=PLybUJn1adI6uRSBhf0skinofrnkT_jcTN'") | |
;C-c-c stop CHILD | |
(start-process "jujuclub" "jujuclub-musik" "mpv" "https://www.youtube.com/playlist?list=PLybUJn1adI6uRSBhf0skinofrnkT_jcTN") | |
;NO C-c-c STOP CHILD | |
(call-process "mpv" nil 0 nil "--no-video" "https://www.youtube.com/playlist?list=PLybUJn1adI6uRSBhf0skinofrnkT_jcTN") | |
(call-process "killall" nil 0 nil "mpv") | |
(shell-command "sleep 5") | |
| synchronous | asynchronous | |
-------------------+--------------------------+-------------------------+ | |
interactive | shell-command | async-shell-command | |
programmatically | call-process | start-process | |
interactive: from the editing environment | |
programmatically: from elisp | |
synchronous: start and wait till done | |
asynchronous: start and return immediately while it is running in the background. | |
(call-process "open" nil 0 nil "-a" "finder") | |
Executing external programs as their own process | |
Using shell-command runs the app as a child, even when done asynchronously | |
start-process also runs as a child process | |
Both commands result in the child process being killed when emacs is shutdown. For a command to have the ability to stay alive past that point you’ll need to use call-process to start the program as its own distinct process. | |
(call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) | |
Setting BUFFER to 0 runs the program asynchronously, while nil will wait for the process to exits before resuming emacs. | |
(shell-command "ls") | |
(start-process "ls" "jj" "ls") | |
(call-process "ls" nil 0 nil "~/") | |
(shell-command "pwd") | |
(call-process "pwd" nil 0) | |
(call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment