diff options
author | JSDurand <mmemmew@gmail.com> | 2021-03-15 16:22:14 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-03-15 16:22:14 +0800 |
commit | a13525e33734c217910175e53a55602757e85d51 (patch) | |
tree | 2be4c0aa36e2b53679bc5b5ee892e52933593415 /dashboard.el | |
parent | 88db66d1ad52ddd351928bb0a4fc7324217d844f (diff) |
Add an option to override the dashboard buffer.
Sometimes the dashboard is renderred weirdly, so I want to have a
convenient way to reset the dashboard buffer.
Diffstat (limited to 'dashboard.el')
-rw-r--r-- | dashboard.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/dashboard.el b/dashboard.el index eab022e..624210b 100644 --- a/dashboard.el +++ b/dashboard.el @@ -26,15 +26,19 @@ "A clumsy text representation of a cute cat.") ;;;###autoload -(defun dashboard () - "Create the dashboard buffer." +(defun dashboard (&optional force) + "Create the dashboard buffer. +If FORCE is non-nil, re-gerenate the dashboard buffer." (interactive) (let ((dashboard-exists-p (get-buffer dashboard-buffer-name)) - (dashboard (get-buffer-create dashboard-buffer-name))) + (dashboard (get-buffer-create dashboard-buffer-name)) + (inhibit-read-only t)) (cond - (dashboard-exists-p (switch-to-buffer dashboard)) + ((and (not force) dashboard-exists-p) + (switch-to-buffer dashboard)) (t (with-current-buffer dashboard + (erase-buffer) (cond ((display-graphic-p) (let ((image (create-image (expand-file-name "cat.png" user-emacs-directory)))) |