diff options
author | JSDurand <mmemmew@gmail.com> | 2021-01-09 14:22:00 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-01-09 14:22:00 +0800 |
commit | dc206ebe9397d656971ba7fc3a092009ef4e797a (patch) | |
tree | d963873011122fdf0eafeba89afd487115994bc5 /dashboard.el | |
parent | a2f7f2bf9077ba8acfc550575b9e21aa9ffe7bae (diff) |
temporary state
Diffstat (limited to 'dashboard.el')
-rw-r--r-- | dashboard.el | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/dashboard.el b/dashboard.el new file mode 100644 index 0000000..a8f753f --- /dev/null +++ b/dashboard.el @@ -0,0 +1,50 @@ +;;; dashboard.el --- My daashboard -*- lexical-binding: t; -*- + +;;;###autoload +(defvar dashboard-buffer-name "durand" + "The name of the buffer for the dashboard.") + +;;;###autoload +(defun dashboard () + "Create the dashboard buffer." + (interactive) + (let ((dashboard-exists-p (get-buffer dashboard-buffer-name)) + (dashboard (get-buffer-create dashboard-buffer-name))) + (cond + (dashboard-exists-p + (switch-to-buffer dashboard)) + (t + (with-current-buffer dashboard + (let ((image (create-image "~/.doom.d/banners/default.png"))) + (insert + (center-string-in-width + (propertize " " 'display image 'rear-nonsticky '(display)) + (round (- (window-body-width) + (* (car (image-size image)) 0.6)))))) + (newline 5) + (insert + (center-string-in-width + "Dashboard" + (window-body-width))) + (read-only-mode 1) + (set 'mode-line-format + '("%e" (:eval (modeline-format-dashboard))))))) + dashboard)) + +(set 'initial-buffer-choice #'dashboard) + +;;; Modify killing buffers + +;;;###autoload +(defun dont-kill-dashboard-fn () + "Don't kill the dashboard buffer." + (cond + ((eq (current-buffer) (get-buffer dashboard-buffer-name)) + (message "Don't kill the dashboard buffer.") + nil) + (t))) + +(add-hook 'kill-buffer-query-functions 'dont-kill-dashboard-fn) + +(provide 'dashboard) +;;; dashboard.el ends here. |