;;; $DOOMDIR/+splash.el -*- lexical-binding: t; -*- ;;; Code: (defun splash--center (str width) "Return STR centered in WIDTH columns." (let ((pad (max 0 (/ (- width (string-width str)) 2)))) (concat (make-string pad ?\s) str))) (defun splash-screen () "Show the splash screen." (interactive) (let ((buf (get-buffer-create "*splash*"))) (with-current-buffer buf (let ((inhibit-read-only t)) (erase-buffer) (when (one-window-p) (setq mode-line-format nil)) (setq cursor-type nil) (let* ((height (- (window-body-height nil) 1)) (width (window-body-width nil)) (pad-top (- (/ height 2) 1)) (pad-bottom (- height (/ height 2) 3)) (emacs-str (format "GNU Emacs version %d.%d" emacs-major-version emacs-minor-version))) (insert (make-string pad-top ?\n)) (insert (splash--center "www.gnu.org" width) "\n") (insert (splash--center emacs-str width) "\n") (insert (splash--center "A free/libre editor" width) "\n") (insert (make-string pad-bottom ?\n)) (insert (splash--center "GNU Emacs comes with ABSOLUTELY NO WARRANTY" width) "\n") (insert (splash--center "Copyright (C) 2026 Free Software Foundation, Inc." width) "\n")) (goto-char (point-min)) (read-only-mode 1) (use-local-map (make-sparse-keymap)))))) (defun splash-screen-kill () "Kill the splash buffer." (interactive) (when (get-buffer "*splash*") (kill-buffer "*splash*"))) (if (daemonp) (add-hook 'server-after-make-frame-hook (lambda () (run-with-timer 0.15 nil #'splash-screen))) (when (and (not (member "-no-splash" command-line-args)) (not (member "--file" command-line-args)) (not (member "--insert" command-line-args)) (not (member "--find-file" command-line-args))) (add-hook 'window-setup-hook #'splash-screen) (setq inhibit-startup-screen t inhibit-startup-message t inhibit-startup-echo-area-message t))) (provide 'splash-screen) ;;; splash.el ends here