Xref: utzoo gnu.emacs.help:620 comp.emacs:9765 Path: utzoo!utgpu!watserv1!watmath!uunet!shelby!apple!usc!cs.utexas.edu!tut.cis.ohio-state.edu!BIGBIRD.BU.EDU!jbw From: jbw@BIGBIRD.BU.EDU (Joe Wells) Newsgroups: gnu.emacs.help,comp.emacs Subject: Process ID of Emacs Message-ID: <9012200058.AA10086@bigbird.bu.edu> Date: 20 Dec 90 00:58:29 GMT Sender: daemon@tut.cis.ohio-state.edu Followup-To: gnu.emacs.help Organization: Gatewayed from the GNU Project mailing list help-gnu-emacs@prep.ai.mit.edu Lines: 23 Is there a function or variable that returns the Un*x process id of the running emacs? No, but something like this will do what you want on most systems: (save-excursion (set-buffer (get-buffer-create "*Emacs PID*")) (erase-buffer) (call-process "/bin/sh" nil t nil "-c" "ps -l$$") (goto-char (point-min)) (let (case-fold-search) (re-search-forward "[ \t]+PID") (let ((col (current-column))) (forward-line 1) (move-to-column col)) (read (current-buffer)))) -- Enjoy, Joe Wells