From 376841ef8ee82afcfcdbfe95d196931c0b5c931e Mon Sep 17 00:00:00 2001 From: Magdalena Szweda Date: Fri, 18 Sep 2026 20:01:57 +0200 Subject: so so much stuff --- +splash.el | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 +splash.el (limited to '+splash.el') diff --git a/+splash.el b/+splash.el new file mode 100644 index 0000000..e76098e --- /dev/null +++ b/+splash.el @@ -0,0 +1,58 @@ +;;; $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 -- cgit v1.2.3