Implement splash screen

https://xenodium.com/emacs-a-welcoming-experiment/
This commit is contained in:
Gabriel Simmer 2022-10-25 13:38:40 +01:00
parent 21e43b4f4f
commit 3660fc6d0a
2 changed files with 36 additions and 0 deletions

36
.emacs.d/early-init.el Normal file
View file

@ -0,0 +1,36 @@
(setq package-enable-at-startup nil)
(defun ar/show-welcome-buffer ()
"Show *Welcome* buffer."
(with-current-buffer (get-buffer-create "*Welcome*")
(setq truncate-lines t)
(let* ((buffer-read-only)
(image-path "~/.emacs.d/emacs.png")
(image (create-image image-path))
(size (image-size image))
(height (cdr size))
(width (car size))
(top-margin (floor (/ (- (window-height) height) 2)))
(left-margin (floor (/ (- (window-width) width) 2)))
(title "Welcome to Emacs!"))
(erase-buffer)
(setq mode-line-format nil)
(goto-char (point-min))
(insert (make-string top-margin ?\n ))
(insert (make-string left-margin ?\ ))
(insert-image image)
(insert "\n\n\n")
(insert (make-string (floor (/ (- (window-width) (string-width title)) 2)) ?\ ))
(insert title))
(setq cursor-type nil)
(read-only-mode +1)
(switch-to-buffer (current-buffer))
(local-set-key (kbd "q") 'kill-this-buffer)))
(setq initial-scratch-message nil)
(setq inhibit-startup-screen t)
(when (< (length command-line-args) 2)
(add-hook 'emacs-startup-hook (lambda ()
(when (display-graphic-p)
(ar/show-welcome-buffer)))))

BIN
.emacs.d/emacs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB