summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--emacs/.emacs.d/main.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el
index 2f7bf53..2e8a393 100644
--- a/emacs/.emacs.d/main.el
+++ b/emacs/.emacs.d/main.el
@@ -224,9 +224,9 @@
       (ap/set-fonts "PT Mono" 14 "Noto Sans" 14 nil))
      ((and (eq window-system 'x)
            (eq system-type 'gnu/linux/windows))
-      (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil))))
+      (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))))
 
-  (ap/set-fonts-according-to-system))
+(add-hook 'first-frame-hook #'ap/set-fonts-according-to-system)
 ;; #+END_SRC
 
 ;; Reduce font decoration.  I’m trying to see whether this helps me focus
@@ -1566,16 +1566,20 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer."
       (add-to-list 'load-suffixes ".el.gpg")
       (load-gpg (expand-file-name (system-name) user-emacs-directory)))))
 
-(defun first-frame-hook (frame)
+(defvar first-frame-hook nil
+  "Hook for running code after first-frame is opened.")
+
+(defun first-frame-hook-handler (frame)
   "Hook run only after first frame is created."
-  (remove-hook 'after-make-frame-functions #'first-frame-hook)
-  (run-at-time nil nil #'load-private-data)
-  (run-at-time nil nil #'ap/set-fonts-according-to-system))
+  (remove-hook 'after-make-frame-functions #'first-frame-hook-handler)
+  (run-at-time nil nil (lambda () (run-hooks 'first-frame-hook))))
 
 (if (or (daemonp)
         (not (eq 1 (length (frame-list)))))
-    (add-hook 'after-make-frame-functions #'first-frame-hook)
-  (add-hook 'after-init-hook #'load-private-data))
+    (add-hook 'after-make-frame-functions #'first-frame-hook-handler)
+  (run-at-time nil nil (lambda () (run-hooks 'first-frame-hook))))
+
+(add-hook 'first-frame-hook #'load-private-data)
 ;; #+END_SRC
 
 ;; ** Minibuffer