diff options
Diffstat (limited to 'dashboard.el')
-rw-r--r-- | dashboard.el | 117 |
1 files changed, 83 insertions, 34 deletions
diff --git a/dashboard.el b/dashboard.el index 56bb616..663cf7a 100644 --- a/dashboard.el +++ b/dashboard.el @@ -28,25 +28,54 @@ (defvar dashboard-buffer-name "durand" "The name of the buffer for the dashboard.") +;; TODO: Change this ASCII art. + ;;;###autoload (defvar dashboard-cat-text (list - " " - " /\\ " - " / \\ " - " / =\\= " - " / - \\=----- " - " / |.| / " - " \\\\ - - / " - " \\\\ |.| | " - " / \\\\ - / " - " / \\\\ / " - " ||==========| ========\\=| " - " ||==========| -- | " - " | || /==== | " - " == | / \\ \\ " - " | | \\ \\ " - " ==== ==== ") +" IIIII " +" IIIIIII " +"I=======|| IIIII " +"I =============I=====I=====I====== " +"I IIIIIII - I I I I " +"I IIIII -I-========I=====I I " +"I -- I I I I " +"I \\\\\\I I I I " +"I == I I I " +"I / \\I I I " +"I / III I I " +"I \\\\==I I I " +"I \\ I I I " +"I ===I I I " +"I / \\I I I " +"I / III I I " +"I \\\\==I I I " +"I III I I I " +"I III II I I " +"I I IIII I I " +"I IIIIIII I I " +"I ===I I I " +"I // I I I " +"I =====I I I " +"I // I I I " +"\\\\ \\\\ \\\\ \\\\ \\\\" + ;; " " + ;; " /\\ " + ;; " / \\ " + ;; " / =\\= " + ;; " / - \\=----- " + ;; " / |.| / " + ;; " \\\\ - - / " + ;; " \\\\ |.| | " + ;; " / \\\\ - / " + ;; " / \\\\ / " + ;; " ||==========| ========\\=| " + ;; " ||==========| -- | " + ;; " | || /==== | " + ;; " == | / \\ \\ " + ;; " | | \\ \\ " + ;; " ==== ==== " + ) "A clumsy text representation of a cute cat.") ;;;###autoload @@ -62,15 +91,16 @@ If FORCE is non-nil, re-gerenate the dashboard buffer." (switch-to-buffer dashboard)) (t (with-current-buffer dashboard - (setq buffer-undo-list t) (erase-buffer) (cond ((display-graphic-p) (let ((image (create-image (expand-file-name - "cat.png" - user-emacs-directory)))) + "बोधिचित्तं.png" + user-emacs-directory) + nil nil + :scale 0.5))) (insert (make-string 3 10) (dashboard-center-string @@ -78,15 +108,31 @@ If FORCE is non-nil, re-gerenate the dashboard buffer." " " 'display image 'rear-nonsticky '(display)))))) - ((mapc (function - (lambda (str) - (insert - (dashboard-center-string str) - "\n"))) - dashboard-cat-text))) + ((let ((width + (with-temp-buffer + (insert (mapconcat #'identity + dashboard-cat-text + (string 10))) + (car (buffer-text-pixel-size))))) + (mapc + (lambda (text) + (insert + (make-string + (floor + (- (window-width nil t) + (string-pixel-width (string 32)) + width) + 2) + 32) + text + 10)) + dashboard-cat-text)))) (newline 5) (insert - (dashboard-center-string "Dashboard")) + (dashboard-center-string + (propertize + "ॐ मणिपद्मे हूम्" + 'face (list :height 600)))) (set-buffer-modified-p nil) (read-only-mode 1) (set @@ -104,7 +150,10 @@ If FORCE is non-nil, re-gerenate the dashboard buffer." (define-derived-mode dashboard-mode nil "Dashboard" "Major mode for the dashboard buffer. The main purpose is to provide a dedicated keymap to access -common functionalities more conveniently.") +common functionalities more conveniently." + (font-lock-mode -1) + (setq buffer-undo-list t) + (setq-local cursor-type nil)) (let ((m dashboard-mode-map)) (define-key m (vector ?l) #'blist) @@ -164,13 +213,13 @@ calls `%s' otherwise." ;;;###autoload (defun dont-kill-dashboard-fn () "Don't kill the dashboard buffer." - (cond - ((eq (current-buffer) (get-buffer dashboard-buffer-name)) - ;; The function message returns the message, so applying not will - ;; produce nil as needed. - ;; "Please don't kill the dashboard buffer" - (not (message "न निहन्याद्घाटीफलकनिधानकम्"))) - (t))) + ;; The function message returns the message, so applying not will + ;; produce nil as needed. + ;; "Please don't kill the dashboard buffer" + (not + (cond + ((eq (current-buffer) (get-buffer dashboard-buffer-name)) + (message "न निहन्याद्घाटीफलकनिधानकम्"))))) (add-hook 'kill-buffer-query-functions 'dont-kill-dashboard-fn) |