summaryrefslogtreecommitdiff
path: root/.emacs.d/early-init.el
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-09-14 22:23:08 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-09-14 22:23:08 -0700
commit9f2e80d06eb21fbc149f19f94627143dec2b1f28 (patch)
tree834cd7e5ab9c532b97b1d89e4c4bde0b1dc89b4f /.emacs.d/early-init.el
parent4d055db843298deffefab9e6079e33cea284acbc (diff)
downloaddotfiles-9f2e80d06eb21fbc149f19f94627143dec2b1f28.tar.gz
early-init.el: some tidying up
Diffstat (limited to '.emacs.d/early-init.el')
-rw-r--r--.emacs.d/early-init.el35
1 files changed, 17 insertions, 18 deletions
diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el
index e4d6cf4b..6836c35a 100644
--- a/.emacs.d/early-init.el
+++ b/.emacs.d/early-init.el
@@ -5,16 +5,14 @@
;; Released under the terms of the GNU GPL as published by the FSF; either
;; version 3, or (at your option) any later version.
-;;; See docstring for `after-make-frame-functions' for why these are here.
+;;; Per docstring for `after-make-frame-functions', these additions to that
+;;; list of functions are made in this file in order that they can affect the
+;;; initial frame.
(defun spw/set-fontset-fonts (frame)
"Set some fonts for specific charsets.
-
-This has to happen after there's at least one graphical frame, or
-the fonts won't be found and so won't be set. We use
-`after-focus-change-function' for this. We could call this
-function unconditionally if (not (daemonp)), but it's simpler to
-always go via `after-focus-change-function'."
+This has to happen after there's at least one graphical frame, or the fonts
+won't be found."
(when (display-graphic-p frame)
(setq after-make-frame-functions
(delq #'spw/set-fontset-fonts after-make-frame-functions))
@@ -40,9 +38,9 @@ always go via `after-focus-change-function'."
;; decide whether to open a new frame or a new tab frame-locally, so we used
;; to temporarily set DISPLAY to (frame-parameter (selected-frame) 'display)
;; and then call wmctrl(1) to get the name of the window manager for that
-;; frame, and stored it in a frame parameter. But that only works for X11,
-;; not Wayland. So for now we just set a boolean `spw/tiling-wm-p' frame
-;; parameter to which functions like `spw/save-buffer-for-later' can respond.
+;; frame, and stored it in a frame parameter. But that works only for X11,
+;; not Wayland. So for now we just set a boolean `spw/tiling-wm-p' to which
+;; functions like `spw/save-buffer-for-later' can respond.
(defun spw/detect-tiling-wm (frame)
(unless (or spw/tiling-wm-p
(not (setq spw/tiling-wm-p
@@ -52,9 +50,10 @@ always go via `after-focus-change-function'."
desktop-restore-forces-onscreen nil)
;; Disable `mouse-autoselect-window' during `display-buffer', to avoid
;; surprise focus changes -- some code that calls `display-buffer' does
- ;; not expect `mouse-autoselect-window' to be on. E.g. `magit-status'
- ;; can leave focus in the wrong window without this.
- (advice-add 'display-buffer :around #'spw/disable-mouse-autoselect-window))
+ ;; not expect `mouse-autoselect-window' to be on. E.g. `magit-status' can
+ ;; leave focus in the wrong window without this.
+ (advice-add 'display-buffer
+ :around #'spw/disable-mouse-autoselect-window))
;; If X or Sway, we know we have a usable primary selection, so we used to
;; turn off additionally copying to the clipboard. However, we do want to
;; be able to yank from the clipboard. See also NEWS.24.
@@ -65,15 +64,15 @@ always go via `after-focus-change-function'."
(defun spw/use-tabs-not-frames (&optional frame)
"Whether to pop up new tabs instead of new frames.
-Should be t when do not have a good way to handle having lots of
-open frames, as I do have under i3/swaywm with its tabbed
-layout (which I use by default)."
+Should be t when do not have a good way to handle having lots of open
+frames, as I do have under i3/swaywm with its tabbed layout, which is my
+default layout."
(not (and spw/tiling-wm-p
(memq (framep (or frame (selected-frame))) '(x pgtk)))))
-;; If we're going to be using multiple frames, make `frame-title-format' not
-;; depend on whether there are multiple frames right now.
(defun spw/set-frame-title-format (frame)
+ "If we're going to be using multiple frames, make `frame-title-format' not
+depend on whether there are multiple frames right now."
(unless (spw/use-tabs-not-frames frame)
(setq after-make-frame-functions
(delq #'spw/set-frame-title-format after-make-frame-functions))