From f369cbe512d8e59cef085515768a583500646d28 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:27:10 -0400 Subject: [PATCH] Unset command line options irrelevant to the current OS --- README.md | 2 ++ early-init.el | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7b55856..4c574a4 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ git clone https://github.com/jamescherti/minimal-emacs.d ~/.emacs.d - Disables warnings from the legacy advice API and suppresses warnings about aliased variables. - Avoids unnecessary excessive UI updates. - Disables font compacting to avoid high memory usage. + - Defer tool bar setup + - Unset command line options irrelevant to the current OS 2. **Native Compilation and Byte Compilation:** - Configures native compilation and byte compilation settings diff --git a/early-init.el b/early-init.el index bc054f0..3a61515 100644 --- a/early-init.el +++ b/early-init.el @@ -195,7 +195,15 @@ ;; Shave seconds off startup time by starting the scratch buffer in ;; `fundamental-mode' (setq initial-major-mode 'fundamental-mode - initial-scratch-message nil))) + initial-scratch-message nil) + + (unless minimal-emacs-debug + ;; Unset command line options irrelevant to the current OS. These options + ;; are still processed by `command-line-1` but have no effect. + (unless (eq system-type 'darwin) + (setq command-line-ns-option-alist nil)) + (unless (memq initial-window-system '(x pgtk)) + (setq command-line-x-option-alist nil))))) ;;; Native compilation and Byte compilation @@ -235,14 +243,15 @@ (unless (memq window-system '(mac ns)) (setq menu-bar-mode nil))) -(unless noninteractive - ;; Temporarily override the tool-bar-setup function to prevent it from - ;; running during the initial stages of startup - (advice-add #'tool-bar-setup :override #'ignore) - (define-advice startup--load-user-init-file - (:before (&rest _) minimal-emacs-setup-toolbar) - (advice-remove #'tool-bar-setup #'ignore) - (tool-bar-setup))) +(unless (daemonp) + (unless noninteractive + ;; Temporarily override the tool-bar-setup function to prevent it from + ;; running during the initial stages of startup + (advice-add #'tool-bar-setup :override #'ignore) + (define-advice startup--load-user-init-file + (:before (&rest _) minimal-emacs-setup-toolbar) + (advice-remove #'tool-bar-setup #'ignore) + (tool-bar-setup)))) (when minimal-emacs-disable-tool-bar (push '(tool-bar-lines . 0) default-frame-alist) (setq tool-bar-mode nil))