forked from colonelpanic/dotfiles
Set server file every 60 seconds
This commit is contained in:
parent
7be1b38a58
commit
7ffa5a67d0
@ -1404,17 +1404,25 @@ Paradox is a package.el extension. I have no use for it now that I use straight.
|
|||||||
(use-package server
|
(use-package server
|
||||||
:config
|
:config
|
||||||
(progn
|
(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 ()
|
(defun imalison:make-main-emacs-server ()
|
||||||
(interactive)
|
(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
|
(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 ()
|
(defun imalison:get-server-filepath ()
|
||||||
(let ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)))
|
(let ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)))
|
||||||
(expand-file-name server-name server-dir)))
|
(expand-file-name server-name server-dir)))
|
||||||
(setq server-use-tcp t)
|
(setq server-use-tcp t)
|
||||||
(unless (server-running-p) (server-start))
|
(unless (server-running-p) (server-start))
|
||||||
(imalison:make-main-emacs-server)))
|
(run-with-timer 0 60 'imalison:make-main-emacs-server)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** list-environment
|
** list-environment
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
Loading…
Reference in New Issue
Block a user