Set server file every 60 seconds

This commit is contained in:
Ivan Malison 2017-10-05 15:24:55 -07:00
parent 7be1b38a58
commit 7ffa5a67d0
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -1404,17 +1404,25 @@ Paradox is a package.el extension. I have no use for it now that I use straight.
(use-package server
:config
(progn
(defun imalison:get-server-file ()
(imalison:join-paths user-emacs-directory "server" "server"))
(defun imalison:main-emacs-server-name ()
(file-name-nondirectory
(file-truename (imalison:get-server-filepath))))
(defun imalison:make-main-emacs-server ()
(interactive)
(when (not (equal server-name "server"))
(when (not (equal server-name (imalison:main-emacs-server-name)))
(let ((server-file (imalison:get-server-file)))
(shell-command-to-string
(format "cd ~/.emacs.d/server/ && rm -f server && ln -s %s server" server-name))))
(format "cd '%s' && rm -f server && ln -s %s server"
(imalison:join-paths user-emacs-directory "server")
server-name)))))
(defun imalison:get-server-filepath ()
(let ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)))
(expand-file-name server-name server-dir)))
(setq server-use-tcp t)
(unless (server-running-p) (server-start))
(imalison:make-main-emacs-server)))
(run-with-timer 0 60 'imalison:make-main-emacs-server)))
#+END_SRC
** list-environment
#+BEGIN_SRC emacs-lisp