dotfiles/.emacs.d/early-init.el

37 lines
1.3 KiB
EmacsLisp

(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)))))