diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-01-29 13:16:59 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-01-29 13:16:59 +0000 |
| commit | 0eee4defb09d895b1059eac98f64225f841007ac (patch) | |
| tree | f5253a4f8ac57862c09a5e95d9c16f6f24032a7b | |
| parent | 9d42200df46bafa2d79b7b315956198fd4c53e80 (diff) | |
emacs: Do a better job at disabling unwanted modes
| -rw-r--r-- | emacs/early-init.el | 5 | ||||
| -rw-r--r-- | emacs/functions.el | 5 | ||||
| -rw-r--r-- | emacs/init.el | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/emacs/early-init.el b/emacs/early-init.el index 4080f10..a83816f 100644 --- a/emacs/early-init.el +++ b/emacs/early-init.el @@ -21,11 +21,6 @@ directories." (top . 0.3) (width . 160)) gc-cons-threshold (* 50 1024 1024)) -(menu-bar-mode -1) -;; Those functions may not exist if the GUI is not compiled in. -(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) -(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) - ;; Further Early Customization diff --git a/emacs/functions.el b/emacs/functions.el index b322af6..37686b3 100644 --- a/emacs/functions.el +++ b/emacs/functions.el @@ -62,6 +62,11 @@ returns nil." (interactive) (modify-frame-parameters frame '((left . 0.5) (top . 0.5)))) +(defun my/disable-frame-modes () + "Disable select frame modes where appropriate." + (dolist (mode '(menu-bar-mode scroll-bar-mode tool-bar-mode)) + (when (and (fboundp mode) (symbol-value mode)) (funcall mode -1)))) + (defun my/focus-frame (&optional frame) "Focus FRAME." (interactive) diff --git a/emacs/init.el b/emacs/init.el index 30140ce..bdab985 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -43,9 +43,6 @@ (add-hook 'after-init-hook #'my/display-startup-time) (add-hook 'before-save-hook #'delete-trailing-whitespace) -(my/with-add-hook 'server-switch-hook - (menu-bar-mode -1) - (scroll-bar-mode -1)) (auto-save-mode -1) (auto-save-visited-mode 1) @@ -124,6 +121,9 @@ (dolist (fn '(delete-window split-window-horizontally split-window-vertically)) (advice-add fn :after #'(lambda (&rest _args) (balance-windows)))) +(if (daemonp) (add-hook 'before-make-frame-hook #'my/disable-frame-modes) + (my/disable-frame-modes)) + ;; Bazel |
