From: "numbchild@gmail.com" <numbchild@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: emacs-help <help-gnu-emacs@gnu.org>
Subject: [SOLVED] Re: How to detect two emacs process in Elisp code?
Date: Sat, 18 Jul 2020 22:01:21 +0800 [thread overview]
Message-ID: <CAL1eYuK7xxwfnUfgdmYw7kBbrio6J41LfJQ=nkby3YDMFVaSHQ@mail.gmail.com> (raw)
In-Reply-To: <CAM-tV--n+qPH0OPpCS-ACNsy9w-kx_rcOP1x55X-UxpgXWTdHw@mail.gmail.com>
Really thanks, Noam. You're awesome! This solved my problem.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Sat, Jul 18, 2020 at 8:25 PM Noam Postavsky <npostavs@gmail.com> wrote:
> On Sat, 18 Jul 2020 at 01:56, numbchild@gmail.com <numbchild@gmail.com>
> wrote:
>
> > (shell-command-to-string "ps -C emacs -o pid=")
> > "\n"))))))
> > (when (<= emacs-processes 1)
> > (message "init-emacs-session loading")
> > (require 'init-emacs-session)))
> > #+end_src
> >
> > The upper code has a problem, the command "ps -C emacs -o pid=" can't
> detect
> > emacs program name like "emacs-28.2.3" which is in /usr/local/bin and
> > compiled from source code.
>
> If your init does (server-start), then you can just check for
> (server-running-p). Otherwise, something like
>
> (seq-count
> (lambda (proc) (and (equal (alist-get 'user proc) user-login-name)
> (string-match "\\<emacs\\>" (alist-get 'comm proc))))
> (mapcar #'process-attributes (list-system-processes)))
>
next prev parent reply other threads:[~2020-07-18 14:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-18 5:55 How to detect two emacs process in Elisp code? numbchild
2020-07-18 12:25 ` Noam Postavsky
2020-07-18 14:01 ` numbchild [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-07-17 14:54 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
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='CAL1eYuK7xxwfnUfgdmYw7kBbrio6J41LfJQ=nkby3YDMFVaSHQ@mail.gmail.com' \
--to=numbchild@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=npostavs@gmail.com \
/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.