You can't usefully have two simultaneous Emacs session that use the same file to store the session state. Each time a session saves its state, it would overwrite the other session's state.
Many people run a single Emacs session. To open a file in the existing Emacs session, use
emacsclient (see also the Emacs wiki). Emacsclient has several options to control its behavior, including whether to open a new window (
-c) or run inside the current terminal (
-t) or let you switch to the existing window (default). Emacsclient can start Emacs if needed (
I normally start Emacs when I log in, and I use Desktop to save my session. In order to be able to occasionally run a separate instance of Emacs, I arrange to only use Desktop if Emacs is invoked in a special way, and I invoke Emacs in this special way in my operating system's session startup. Specifically, I run this when I log in:
EMACS_SESSION_DIR=~/.emacs.d/session emacs --daemon
emacs --daemon (so it doesn't open any Emacs window) and loads my normal session which is stored in the directory
~/.emacs.d/session. Here's the code from my Emacs init file to only use Desktop if
EMACS_SESSION_DIR is set.
(let ((env (getenv "EMACS_SESSION_DIR")))
(unless (or (null env) (equal env ""))
(setq desktop-dirname (expand-file-name env)
desktop-path (list desktop-dirname))))
;; `desktop' will look for `desktop-basefilename' in the current directory,
;; then in the home directory. But I don't ordinarily want that.
(around dont-search-state-file-in-current-directory activate)
"Don't let Desktop look for the state file in the current directory."
(let ((default-directory desktop-dirname))
;; Enable desktop if a session directory has been defined.
(setq desktop-enable (and desktop-dirname t))
(Some of this code was writen a long time ago and may no longer be necessary in modern Emacs versions.)