diff options
| author | Magdalena Szweda <roughlynamed@disroot.org> | 2026-09-18 20:01:57 +0200 |
|---|---|---|
| committer | Magdalena Szweda <hi@roughlynamed.net> | 2026-09-21 19:05:12 +0200 |
| commit | 376841ef8ee82afcfcdbfe95d196931c0b5c931e (patch) | |
| tree | 7174f178136a03a8443fc6bcb214d4c0e44c12be /+splash.el | |
| parent | 8ee08f6c356d6aaf5ea9f9e644c126a683ca948f (diff) | |
so so much stuff
Diffstat (limited to '+splash.el')
| -rw-r--r-- | +splash.el | 58 |
1 files changed, 58 insertions, 0 deletions
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 |
