From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to detect two emacs process in Elisp code?
Date: Thu, 03 Sep 2020 16:13:52 +0300 [thread overview]
Message-ID: <83lfhruhnz.fsf@gnu.org> (raw)
In-Reply-To: <87ft9s283t.fsf@gmail.com> (message from stardiviner on Fri, 17 Jul 2020 22:54:50 +0800)
> 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?
next prev parent reply other threads:[~2020-09-03 13:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 14:54 How to detect two emacs process in Elisp code? stardiviner
2020-09-03 2:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-03 2:45 ` [SOLVED] " numbchild
2020-09-03 2:47 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-03 2:50 ` numbchild
2020-09-03 13:13 ` Eli Zaretskii [this message]
2020-09-03 17:39 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-04 3:57 ` stardiviner
2020-09-04 4:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
-- strict thread matches above, loose matches on Subject: below --
2020-07-18 5:55 numbchild
2020-07-18 12:25 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83lfhruhnz.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.