load frame-geometry only in gui mode

This commit is contained in:
2025-07-03 12:16:25 +02:00
parent 0325922dd3
commit 904dd985ea

View File

@@ -377,8 +377,6 @@ startup phase.")
(defvar my-frame-title-format "%b Emacs" (defvar my-frame-title-format "%b Emacs"
"Template for displaying the title bar of visible and iconified frame.") "Template for displaying the title bar of visible and iconified frame.")
;; `display-graphic-p' not working during early-init
(setq frame-title-format my-frame-title-format) (setq frame-title-format my-frame-title-format)
(setq icon-title-format my-frame-title-format) (setq icon-title-format my-frame-title-format)
@@ -437,6 +435,7 @@ startup phase.")
(add-to-list 'initial-frame-alist '(background-color . "#1e1e1e")) (add-to-list 'initial-frame-alist '(background-color . "#1e1e1e"))
(add-to-list 'initial-frame-alist '(foreground-color . "#b2b2b2")) (add-to-list 'initial-frame-alist '(foreground-color . "#b2b2b2"))
(when (display-graphic-p)
;; Custom functions/hooks for persisting/loading frame geometry upon save/load ;; Custom functions/hooks for persisting/loading frame geometry upon save/load
(defvar my-frame-geometry-file (concat user-cache-directory "frame-geometry.el")) (defvar my-frame-geometry-file (concat user-cache-directory "frame-geometry.el"))
(defun my-frame-geometry-save () (defun my-frame-geometry-save ()
@@ -452,7 +451,7 @@ startup phase.")
;; Turn off backup for this file ;; Turn off backup for this file
(make-local-variable 'make-backup-files) (make-local-variable 'make-backup-files)
(setq make-backup-files nil) (setq make-backup-files nil)
(when (featurep 'scroll-bar) ;; for terminal scroll-bar ist not loaded (when (featurep 'scroll-bar) ;; for terminal scroll-bar is not loaded
(scroll-bar-mode -1)) (scroll-bar-mode -1))
(insert (insert
";;; " (file-name-nondirectory frameg-file) " --- Frame configuration -*- no-byte-compile: t; lexical-binding: t; -*-" ";;; " (file-name-nondirectory frameg-file) " --- Frame configuration -*- no-byte-compile: t; lexical-binding: t; -*-"
@@ -472,7 +471,7 @@ startup phase.")
;; (load-file frameg-file) ;; (load-file frameg-file)
(load (expand-file-name frameg-file) nil (not my-debug) t)))) (load (expand-file-name frameg-file) nil (not my-debug) t))))
(my-frame-geometry-load) (my-frame-geometry-load)
(add-hook 'kill-emacs-hook 'my-frame-geometry-save) (add-hook 'kill-emacs-hook 'my-frame-geometry-save))
;;; Security ;;; Security