From 49a12b3a00a06031d3965a6120d344674f36e440 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sun, 13 Mar 2022 12:02:36 +0800 Subject: Improve emacs init - Running server whenever there is no server running - Require 'init-local --- .emacs.d/.gitignore | 2 ++ .emacs.d/init.el | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to '.emacs.d') diff --git a/.emacs.d/.gitignore b/.emacs.d/.gitignore index 5349c45..c65df60 100644 --- a/.emacs.d/.gitignore +++ b/.emacs.d/.gitignore @@ -12,3 +12,5 @@ org-roam.db .org-id-locations pyim .last-package-update-day + +lisp/init-local.el \ No newline at end of file diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 21e5d01..66a37cc 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -13,6 +13,10 @@ (defconst *is-a-mac* (eq system-type 'darwin)) (defconst *is-a-linux* (eq system-type 'gnu/linux)) +(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) +(unless (file-exists-p custom-file) + (write-region "" nil custom-file)) + (require 'init-package) (require 'init-utils) (require 'init-evil) @@ -29,7 +33,13 @@ (require 'init-misc) (require 'init-appearance) -(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) -(unless (file-exists-p custom-file) - (write-region "" nil custom-file)) +(add-hook 'after-init-hook + (lambda () + (require 'server) + (unless (server-running-p) (server-start)))) + (load custom-file) + +(require 'init-local nil t) + +(provide 'init) -- cgit v1.2.3