summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-03-22 18:12:17 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-03-22 18:12:17 -0700
commitac74bd759b1e63c622572e604733d8e5ca5944b4 (patch)
treee2015fc0ce54185a5537678891101e696cf801f2
parent0c96e8c3c28efc12db19ef6186ec6a025ab964cb (diff)
downloaddotfiles-ac74bd759b1e63c622572e604733d8e5ca5944b4.tar.gz
spw/maybe-scale-basic-faces: don't try to do anything to text frames
-rw-r--r--.emacs.d/init.el57
1 files changed, 30 insertions, 27 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 97a04e21..f3347e0c 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -113,33 +113,36 @@
from those set by `custom-set-faces' for frames on wide monitors,
except where doing so would itself prevent fitting two 80-column
windows side-by-side in the frame."
- (let ((wide-monitor-p
- (> (cadddr (assoc 'geometry (frame-monitor-attributes frame))) 1635)))
- (when (or wide-monitor-p
- ;; Check whether a previous call made any changes we might need
- ;; to undo if FRAME has moved to a smaller display.
- (not (eq scroll-bar-mode
- (frame-parameter frame 'vertical-scroll-bars)))
- (= (face-attribute 'default :height frame) 120)
- (= (face-attribute 'variable-pitch :height frame) 151))
- (let* (;; Above 1635 you can scale up and still fit two 80-col windows.
- ;; Below 1315 you can't fit the two windows even w/o scaling up.
- (medium-p (> 1635 (frame-pixel-width frame) 1315))
- (scale-up-p (and wide-monitor-p (not medium-p))))
- (modify-frame-parameters
- frame
- `(;; Can fit two 80-col windows only if we disable scroll bars.
- (vertical-scroll-bars . ,(and (not (and wide-monitor-p medium-p))
- scroll-bar-mode))))
- ;; Check Emacs found the relevant font on this window system, else our
- ;; height values might be invalid.
- (when (find-font (font-spec :foundry "SRC" :family "Hack") frame)
- (set-face-attribute 'default frame :height (if scale-up-p 120 105)))
- (when (find-font (font-spec :foundry "bitstream"
- :family "Bitstream Charter")
- frame)
- (set-face-attribute 'variable-pitch frame
- :height (if scale-up-p 151 120)))))))
+ (when (display-graphic-p frame)
+ (let ((wide-monitor-p (> (cadddr (assoc 'geometry
+ (frame-monitor-attributes frame)))
+ 1635)))
+ (when (or wide-monitor-p
+ ;; Check whether a previous call made any changes we might need
+ ;; to undo if FRAME has moved to a smaller display.
+ (not (eq scroll-bar-mode
+ (frame-parameter frame 'vertical-scroll-bars)))
+ (= (face-attribute 'default :height frame) 120)
+ (= (face-attribute 'variable-pitch :height frame) 151))
+ (let* (;; Above 1635 you can scale up and still fit two 80-col windows.
+ ;; Below 1315 you can't fit the two windows even w/o scaling up.
+ (medium-p (> 1635 (frame-pixel-width frame) 1315))
+ (scale-up-p (and wide-monitor-p (not medium-p))))
+ (modify-frame-parameters
+ frame
+ `(;; Can fit two 80-col windows only if we disable scroll bars.
+ (vertical-scroll-bars . ,(and (not (and wide-monitor-p medium-p))
+ scroll-bar-mode))))
+ ;; Check Emacs found the relevant font on this window system, else
+ ;; our height values might be invalid.
+ (when (find-font (font-spec :foundry "SRC" :family "Hack") frame)
+ (set-face-attribute 'default frame
+ :height (if scale-up-p 120 105)))
+ (when (find-font (font-spec :foundry "bitstream"
+ :family "Bitstream Charter")
+ frame)
+ (set-face-attribute 'variable-pitch frame
+ :height (if scale-up-p 151 120))))))))
(add-to-list 'window-size-change-functions #'spw/maybe-scale-basic-faces)
;;; `frame--current-backround-mode' assumes that TERM=screen-256color means a