From a13525e33734c217910175e53a55602757e85d51 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 15 Mar 2021 16:22:14 +0800 Subject: 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. --- dashboard.el | 12 ++++++++---- 1 file 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)))) -- cgit v1.2.3-18-g5258