init.el file, I have a hook to setup my workspace when I open a particular type file. Specifically, when I open an R file (i.e.,
*.R) and ESS-mode starts, a couple of other windows open with
R in them. My Elisp code looks like this:
;; R setup (require 'ess-site) (add-hook 'ess-mode-hook (lambda() (set-window-buffer (selected-window) (file-name-nondirectory (car (last command-line-args)))) (split-window-horizontally) (other-window 1) (vterm) (split-window-vertically) (R) (other-window 1) ))
When I open a file, say
emacs myfile.R, this works as expected. I run into a problem, however, if I open a file once Emacs is already up and running. For example, I run
emacs myfile.R and then do
C-x C-f myfile2.R then this causes more windows to open.
Q: Is there a way to only run this startup function when there isn't an existing emacs session?