Commit 607f96c00390

Vincent Demeester <vincent@sbr.pm>
2017-09-12 20:49:40
Add server support 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 6d092b7
Changed files (3)
.emacs.d/emacs.org
@@ -233,7 +233,7 @@
 
 Get rid of nags about requiring setences to end with two spaces.
 
-#+BEGIN_SRC emacs-lisp :tangle init.el9
+#+BEGIN_SRC emacs-lisp :tangle init.el
   (setq sentence-end-double-space nil)
 #+END_SRC
 
@@ -242,6 +242,31 @@
 #+BEGIN_SRC emacs-lisp :tangle init.el
   (setq-default fill-column 80)
 #+END_SRC
+
+** Server
+
+Let's start /the emacs/ server in order to have almost only one shared
+instance of emacs running "long-time". I'm usually starting it using
+i3 (in the background).
+
+I had an error about /unsafe directory/ for =/tmp/emacs100=, that's
+why there is an advice here to ignore the error (see [[http://stackoverflow.com/a/17069276/89249][stackoverflow]]).
+
+#+BEGIN_SRC emacs-lisp :tangle init.el
+  (defadvice server-ensure-safe-dir (around
+                                     my-around-server-ensure-safe-dir
+                                     activate)
+    "Ignores any errors raised from server-ensure-safe-dir"
+    (ignore-errors ad-do-it))
+  (unless (string= (user-login-name) "root")
+    (require 'server)
+    (when (or (not server-process)
+              (not (eq (process-status server-process)
+                       'listen)))
+      (unless (server-running-p server-name)
+     (server-start))))
+#+END_SRC
+
 * Load configurations
 
 It is now time to load other configuration.
.emacs.d/init.el
@@ -45,8 +45,6 @@
 
 (use-package diminish
   :ensure t)
-(use-package delight
-  :ensure t)
 
 (use-package auto-compile
   :ensure t
@@ -88,22 +86,23 @@
   (add-to-list 'exec-path-from-shell-variables "PYTHONPATH")
   (exec-path-from-shell-initialize))
 
+(setq sentence-end-double-space nil)
+
 (setq-default fill-column 80)
 
+(defadvice server-ensure-safe-dir (around
+                                   my-around-server-ensure-safe-dir
+                                   activate)
+  "Ignores any errors raised from server-ensure-safe-dir"
+  (ignore-errors ad-do-it))
+(unless (string= (user-login-name) "root")
+  (require 'server)
+  (when (or (not server-process)
+            (not (eq (process-status server-process)
+                     'listen)))
+    (unless (server-running-p server-name)
+   (server-start))))
+
 ;; (require 'evil-config)
 (use-package visual-config)
 (use-package org-config)
-(custom-set-variables
- ;; custom-set-variables was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- '(package-selected-packages
-   (quote
-    (delight diminish solaire-mode htmlize exec-path-from-shell doom-themes dashboard auto-compile))))
-(custom-set-faces
- ;; custom-set-faces was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- )
.emacs.d/init.elc
Binary file