all repos — nixfiles @ 7e169a20e1da2f949b4a08a54df1b0cfc078c5bd

System and user configuration, managed by nix and home-manager

Emacs: don't warn on startup with server running
Alan Pearce alan@alanpearce.eu
Thu, 13 Apr 2023 13:46:06 +0200
commit

7e169a20e1da2f949b4a08a54df1b0cfc078c5bd

parent

50b2162aefcf6c63aa07b467e48e8973d5ed254e

1 files changed, 5 insertions(+), 1 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -17,7 +17,11 @@ (defun restore-file-name-handler-alist ()   (setq file-name-handler-alist default-file-name-handler-alist))
 (add-hook 'emacs-startup-hook #'restore-file-name-handler-alist)
 
-(add-hook 'after-init-hook #'server-start)
+(defun maybe-start-server ()
+  (require 'server)
+  (unless (server-running-p)
+    (server-start)))
+(add-hook 'after-init-hook #'maybe-start-server)
 
 (eval-when-compile (require 'fringe-helper))