Magically setup emacsclient
May 25, 2019 Updated: August 02, 2019 #techThis is a magical way of automatically setting up emacsclient, by northrupthebandgeek. If you start emacs for the first time, it will start a server. If the server has already been started, it will delegate to emacsclient.
One tiny improvement over the function defined on the reddit post, is that this doesn't guess what is the name of the emacs server file. It instead generates the nam e in the same ways as done by the server package.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; from: https://en.reddit.com/r/emacs/comments/4586eq/quick_emacs_snippet_to_automatically_use/
;;
;; Automagical EmacsClient functionality
;;
;; Basically, if Emacs is already running, this shunts things over to
;; the existing Emacs; otherwise, it readies itself to accept said
;; shunting.
;;
;; This operates by detecting the existence of an Emacs server socket
;; file. If a socket is found, Emacs will
;; spin up emacsclient and immediately exit itself. Otherwise, Emacs
;; will start a new server.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;