I am using workgroups and I have the following code in my init.el
:
(defun my-start-emacs (_)
(interactive)
(message "HI")
(sleep-for 1)
(if (daemonp)
(progn
(if (not (boundp 'server-wg))
(progn
(wg-create-workgroup "server")
(setq server-wg (wg-current-workgroup)))
(progn
(setq current-wg (condition-case nil
(wg-current-workgroup)
(error nil)))
(if (not current-wg)
(wg-switch-to-workgroup server-wg)
(if (not (eq current-wg server-wg))
(wg-switch-to-workgroup server-wg))))))))
(add-to-list 'after-make-frame-functions #'my-start-emacs)
The my-start-emacs
function creates the "server" workgroup if it does not exist, and loads it if it does. Using it manually via M-x my-start-emacs
works perfectly, however for some reason even though it is called when I start the emacsclient -t
(attach to server after emacs --daemon
), nothing happens (i.e. the server workgroup is created, but is not changed to)... Why?