I'm supporting some elisp code that creates a temporary filename using a prefix and the user id. When I develop this, that is not enough since I will be running multiple instances concurrently.

So I'm looking for either a function to create a temporary filename which I can control to some extent, or some other component to add to the name.

I thought the second option should be straightforward so I looked at process-id, but that requires a process. (elisp manual: Process Information)

So I looked at get-process but that requires a name, which would also be ambiguous.

How do I get the process id for the running Emacs process?

EDIT: I solved my problem using make-temp-name (yeah, I know I should not use it, but I don't want to change the handling of temporary files at this point).

But for my edification, is there a way to get the process id for the Emacs process?

1 Answer 1


If I do understand correctly you could use (emacs-pid)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.