From 7ffa5a67d05e44e7c3e217fd51cf17963acb1263 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 5 Oct 2017 15:24:55 -0700 Subject: [PATCH] Set server file every 60 seconds --- dotfiles/emacs.d/README.org | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index bf4d6389..67dad36b 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -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