From 393604e5bf4ce15df7342fdc094900fd1be2b39f Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 8 Feb 2021 23:36:26 +0800 Subject: Constantly growing A lot of improvements. --- dashboard.el | 59 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 17 deletions(-) (limited to 'dashboard.el') diff --git a/dashboard.el b/dashboard.el index 0a4402e..c608b34 100644 --- a/dashboard.el +++ b/dashboard.el @@ -4,6 +4,27 @@ (defvar dashboard-buffer-name "durand" "The name of the buffer for the dashboard.") +;;;###autoload +(defvar dashboard-cat-text + (list + " " + " /\\ " + " / \\ " + " / =\\= " + " / - \\=----- " + " / |.| / " + " \\\\ - - / " + " \\\\ |.| | " + " / \\\\ - / " + " / \\\\ / " + " ||==========| ========\\=| " + " ||==========| -- | " + " | || /==== | " + " == | / \\ \\ " + " | | \\ \\ " + " ==== ==== ") + "A clumsy text representation of a cute cat.") + ;;;###autoload (defun dashboard () "Create the dashboard buffer." @@ -11,25 +32,28 @@ (let ((dashboard-exists-p (get-buffer dashboard-buffer-name)) (dashboard (get-buffer-create dashboard-buffer-name))) (cond - (dashboard-exists-p - (switch-to-buffer dashboard)) + (dashboard-exists-p (switch-to-buffer dashboard)) (t (with-current-buffer dashboard - (let ((image (create-image "~/.doom.d/banners/default.png"))) - (insert - (make-string 3 10) - (center-string-in-width - (propertize " " 'display image 'rear-nonsticky '(display)) - (round (- (window-body-width) - (* (car (image-size image)) 0.7)))))) + (cond + ((display-graphic-p) + (let ((image (create-image "~/.doom.d/banners/default.png"))) + (insert + (make-string 3 10) + (center-string-in-width + (propertize " " 'display image 'rear-nonsticky '(display)) + (round (- (window-body-width) + (* (car (image-size image)) 0.7))))))) + ((mapc (function + (lambda (str) + (insert + (center-string-in-width str (- (window-body-width) 13)) + "\n"))) + dashboard-cat-text))) (newline 5) - (insert - (center-string-in-width - "Dashboard" - (window-body-width))) + (insert (center-string-in-width "Dashboard" (window-body-width))) (read-only-mode 1) - (set 'mode-line-format - '("%e" (:eval (modeline-format-dashboard)))) + (set 'mode-line-format '("%e" (:eval (modeline-format-dashboard)))) (view-mode 1)))) dashboard)) @@ -42,8 +66,9 @@ "Don't kill the dashboard buffer." (cond ((eq (current-buffer) (get-buffer dashboard-buffer-name)) - (message "Don't kill the dashboard buffer.") - nil) + ;; The function message returns the message, so applying not will + ;; produce nil as needed. + (not (message "Don't kill the dashboard buffer."))) (t))) (add-hook 'kill-buffer-query-functions 'dont-kill-dashboard-fn) -- cgit v1.2.3-18-g5258