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

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

Re: How to detect two emacs process in Elisp code?


From: Eli Zaretskii
Subject: Re: How to detect two emacs process in Elisp code?
Date: Thu, 03 Sep 2020 16:13:52 +0300

> From: stardiviner <numbchild@gmail.com>
> Date: Fri, 17 Jul 2020 22:54:50 +0800
> 
> (let ((emacs-processes
>        (length (mapcar
>                 'string-to-number
>                 (seq-filter
>                  (lambda (str)
>                    (not (string-empty-p str)))
>                  (split-string
>                   ;; (shell-command-to-string "ps -C emacs -o pid=")
>                   (shell-command-to-string "ps -C emacs -o pid=")
>                   "\n"))))))
>   (when (<= emacs-processes 1)
>     (message "init-emacs-session loading")
>     (require 'init-emacs-session)))

Why do you need to use an external command ('ps')?  What's wrong with
using list-system-processes and process-attributes instead?



reply via email to

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