emacs: defer daemon startup initialization

This commit is contained in:
2026-05-05 03:06:41 -07:00
parent a59c316d85
commit 1817c73609
2 changed files with 27 additions and 5 deletions

View File

@@ -1389,8 +1389,10 @@ The file server file for this emacs instance no longer exists.")
(defun imalison:get-this-server-filepath ()
(let ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)))
(expand-file-name server-name server-dir)))
(when (equal nil (server-running-p)) (server-start)
(imalison:make-main-emacs-server))))
(unless (daemonp)
(when (equal nil (server-running-p))
(server-start)
(imalison:make-main-emacs-server)))))
#+END_SRC
** list-environment
#+BEGIN_SRC emacs-lisp
@@ -4110,6 +4112,9 @@ Ensure all themes that I use are installed:
:commands doom-modeline-mode
:custom
(doom-modeline-height 40))
(defvar imalison:enable-doom-modeline-on-startup nil
"Non-nil means enable `doom-modeline-mode' during startup.")
#+end_src
** page-break-lines
#+BEGIN_SRC emacs-lisp
@@ -4260,11 +4265,24 @@ load-theme hook (See the heading below).
(load-theme imalison:dark-theme t))
(apply 'imalison:appearance args)
(message "running appearance")
(doom-modeline-mode +1)
(when (and imalison:enable-doom-modeline-on-startup
(fboundp 'doom-modeline-mode))
(doom-modeline-mode +1))
(setq imalison:default-font-size-pt (face-attribute 'default :height))
(setq imalison:appearance-setup-done t)))
(add-hook 'elpaca-after-init-hook 'imalison:appearance-setup-hook)
(defun imalison:daemon-startup-p ()
(or (daemonp)
(seq-some (lambda (arg)
(or (string= arg "--daemon")
(string= arg "--bg-daemon")
(string-prefix-p "--daemon=" arg)
(string-prefix-p "--bg-daemon=" arg)))
command-line-args)))
(if (imalison:daemon-startup-p)
(add-hook 'server-after-make-frame-hook 'imalison:appearance-setup-hook)
(add-hook 'elpaca-after-init-hook 'imalison:appearance-setup-hook))
#+END_SRC
* Post Init Custom
#+BEGIN_SRC emacs-lisp

View File

@@ -186,5 +186,9 @@
(let ((load-source-file-function nil)) (load autoloads))))
(require 'elpaca)
(setq elpaca-log-functions '(elpaca-log-command-query))
(add-hook 'after-init-hook #'elpaca-process-queues)
(if (daemonp)
(add-hook 'after-init-hook
(lambda ()
(run-with-idle-timer 1 nil #'elpaca-process-queues)))
(add-hook 'after-init-hook #'elpaca-process-queues))
(elpaca `(,@elpaca-order))