aboutsummaryrefslogtreecommitdiff
path: root/splash.el
diff options
context:
space:
mode:
authorMagdalena Szweda <hi@roughlynamed.net>2026-09-22 16:31:35 +0200
committerMagdalena Szweda <hi@roughlynamed.net>2026-09-22 16:32:37 +0200
commit6bb6bd1da70858f83f848234cfee8a881881f93d (patch)
tree0667ab2747de3d9835302a70766bc9e1a13513f6 /splash.el
parent376841ef8ee82afcfcdbfe95d196931c0b5c931e (diff)
emacs: replace the modular config that takes up a bunch of files with 1 clean config.org file.
Diffstat (limited to 'splash.el')
-rw-r--r--splash.el57
1 files changed, 57 insertions, 0 deletions
diff --git a/splash.el b/splash.el
new file mode 100644
index 0000000..e61adbd
--- /dev/null
+++ b/splash.el
@@ -0,0 +1,57 @@
+;;; $DOOMDIR/splash.el -*- lexical-binding: t; -*-
+
+
+(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