Skip to content

Instantly share code, notes, and snippets.

@xuchunyang
Created April 3, 2015 15:55
Show Gist options
  • Save xuchunyang/565500cc933846e5bfad to your computer and use it in GitHub Desktop.
Save xuchunyang/565500cc933846e5bfad to your computer and use it in GitHub Desktop.
elisp-process-demo.el
;;; Emacs Lisp Process
(call-process "pwd" nil t nil)
(call-process "grep" nil "bar" nil "root" "/etc/passwd")
(let ((default-directory "/tmp/"))
(call-process "pwd" nil t))
(call-process-region 1 6 "cat" nil t)
(process-lines "ls" "-1")
(let ((pro (start-process "my-process" "foo" "sleep" "100")))
(insert (process-tty-name pro) "\n")
(sit-for 3)
(insert (pp-to-string (process-list)))
(sit-for 3)
(insert (pp-to-string (process-name (get-process "my-process"))) "\n")
(sit-for 3)
(insert (process-status (get-buffer "foo")))
(sit-for 3)
(delete-process pro))
(start-process "my-process" "foo" "ls" "-l" "bin")
(start-process "shell" "my-shell-buffer" "bash")
#<process shell>
#<process shell>
(process-send-string "shell" "ls\n")
nil
nil
(process-send-eof "shell")
"shell"
(defun keep-output (process output)
(setq kept (cons output kept)))
(set-process-filter (get-process "shell") 'keep-output)
(defun msg-me (process event)
(princ
(format "Process: %s had the event '%s'" process event)))
(set-process-sentinel (get-process "shell") #'msg-me)
(kill-process (get-process "shell"))
(list-system-processes)
(network-interface-list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment