                            (remove-unrestorable-file-buffers tail)
                          tail))))))
 
-    (defun frameset--restore-frame-advice (old-func &rest args)
+    (defun frameset--restore-frame-advice (fn &rest args)
       (let ((window-state (cadr args)))
-        (apply old-func
+        (apply fn
                (car args)
                (remove-unrestorable-file-buffers window-state)
                (cddr args))))


(set-locale-environment "UTF-8")

;; Stop asking me if a theme is safe. The entirety of Emacs is built around
;; evaling arbitrary code...
(defun load-theme-advice (old-load-theme &rest args)
  "Don't ask for confirmation when loading a theme."
  (apply old-load-theme (car args) t (cddr args)))
(advice-add 'load-theme :around 'load-theme-advice)

;; Only initialize packages when needed
(cond ((< emacs-major-version 27)


;; Let the themes deal with these things
(dolist (param '(background-mode tty-color-mode screen-gamma
                 alpha font foreground-color background-color
                 mouse-color cursor-color border-color
                 scroll-bar-foreground scroll-bar-background))
  (add-to-list 'frameset-filter-alist `(,param . :never)))

(when (display-graphic-p)
