From bc75732b9d37b77945a977ee9f7892cf6efc79c3 Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Thu, 9 Apr 2026 10:53:27 +1000 Subject: Refactor Emacs config into modules --- lisp/ss-ui.el | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 lisp/ss-ui.el (limited to 'lisp/ss-ui.el') diff --git a/lisp/ss-ui.el b/lisp/ss-ui.el new file mode 100644 index 0000000..79f2a0d --- /dev/null +++ b/lisp/ss-ui.el @@ -0,0 +1,135 @@ +;;; ss-ui.el --- Interface configuration -*- lexical-binding: t; -*- + +;;; Commentary: + +;; Theme, frame, completion, and interface setup. + +;;; Code: + +(require 'ss-core) + +(defun ss-ui--configure-frames () + "Apply GUI and terminal frame behavior." + (when (display-graphic-p) + (set-frame-size (selected-frame) 140 42) + (menu-bar-mode -1) + (tool-bar-mode -1) + (scroll-bar-mode -1) + (tooltip-mode -1) + (set-face-attribute + 'default nil + :family "JetBrains Mono" :height 140 :weight 'medium) + (set-face-attribute + 'fixed-pitch nil + :family "JetBrains Mono" :weight 'medium) + (set-face-attribute + 'fixed-pitch-serif nil + :family "JetBrains Mono" :weight 'medium)) + + (unless (display-graphic-p) + ;; Terminal menu bar removal stays on startup hook to avoid tty regressions. + (add-hook 'emacs-startup-hook (lambda () (menu-bar-mode -1))))) + +(defun ss-ui--setup-modeline () + "Configure the modeline." + (use-package time + :ensure nil + :config + (setq display-time-24hr-format t + display-time-day-and-date t + display-time-default-load-average nil + calendar-latitude -37.7667 + calendar-longitude 145.0 + calendar-location-name "Melbourne, VIC") + (display-time-mode 1)) + + ;; Keep the theme's faces, but make the right edge alignment dynamic. + (setq-default mode-line-format + (list + " " + "%e" + mode-line-front-space + mode-line-mule-info + mode-line-client + mode-line-modified + mode-line-remote + mode-line-frame-identification + mode-line-buffer-identification + " " + mode-line-position + '(vc-mode vc-mode) + " " + mode-line-modes + '(:eval (propertize + " " + 'display + `((space :align-to + (- right + ,(+ 2 (string-width + (format-mode-line mode-line-misc-info)))))))) + mode-line-misc-info + " " + mode-line-end-spaces))) + +(defun ss-ui--setup-completion () + "Configure minibuffer and in-buffer completion." + (use-package vertico + :ensure t + :pin melpa + :init + (vertico-mode 1)) + + (use-package orderless + :ensure t + :pin melpa + :custom + (completion-styles '(orderless basic)) + (completion-category-defaults nil) + (completion-category-overrides '((file (styles basic partial-completion))))) + + (use-package marginalia + :ensure t + :pin melpa + :after vertico + :init + (marginalia-mode 1)) + + (use-package corfu + :ensure t + :pin gnu + :init + (global-corfu-mode 1))) + +(defun ss-ui-setup () + "Initialize interface and completion behavior." + (setq inhibit-startup-message t + inhibit-startup-screen t + ring-bell-function 'ignore) + + (ss-ui--configure-frames) + + (use-package modus-themes + :ensure nil + :no-require t + :config + (load-theme 'modus-vivendi t)) + + (use-package dired + :ensure nil + :custom + (dired-use-ls-dired nil)) + + (line-number-mode 1) + (column-number-mode 1) + (show-paren-mode 1) + + (setq-default indicate-empty-lines nil) + (setq-default indicate-buffer-boundaries nil) + (setq-default fringe-indicator-alist nil) + + (ss-ui--setup-modeline) + (ss-ui--setup-completion)) + +(provide 'ss-ui) + +;;; ss-ui.el ends here -- cgit v1.2.3