Created
August 1, 2014 20:26
-
-
Save darrik/c0f7995fb0bcaadab942 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
(defun darrik/isrunning-p (argv) | |
"Return `t' if `argv' is running." | |
(or (listp argv) | |
(setq argv (list argv))) | |
(dolist (pid (list-system-processes)) | |
(let* ((pdata (process-attributes pid)) | |
(x (assoc 'comm pdata)) | |
(exe (cdr x))) | |
(when (member exe argv) | |
(return t))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(darrik/isrunning-p "emacs") ; t
(darrik/isrunning-p '("emacs")) ; t
(darrik/isrunning-p '("emac")) ; nil
(darrik/isrunning-p '("emac" "zsh")) ; t
Don't forget to add ".exe" if you're on Windows.
(darrik/isrunning-p "emacs.exe") ; t