0

I'd like to set in my dot-emacs a function to detect if an Emacs instance is already running, possibly exiting Emacs informing user.

To do this I should query the OS for running processes. However

(list-processes)

does not return OS processes, but only those started by Emacs. How can I achieve the intended objective?

  • 1
    I think this needs to happen at the OS level. Are you sure you're not interested in running the Emacs daemon and connecting to it? – Dan Jan 28 '18 at 1:25
  • @Dan: I to not explicitly need (server-start). However using it with (server-running-p) could be a workaround. – antonio Jan 28 '18 at 1:35
  • (server-running-p) is the way to go. There are ways to get process ids. That is operating system dependent. E.g., under Linux one could inspect /proc. – Tobias Jan 28 '18 at 9:52
  • 1
    list-system-processes would also be an option – npostavs Jan 28 '18 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.