.emacs.d/elisp/init-dashboard.el

92 lines
3.3 KiB
EmacsLisp

;;; init-dashboard.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-dashboard.el
;; Description: Initialize Dashboard
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 17:21:46 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Mon Dec 23 18:19:44 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d dashboard
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes dashboard
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; DashboardPac
(use-package dashboard
:demand
:diminish (dashboard-mode page-break-lines-mode)
:bind ("C-z d" . open-dashboard)
:custom
(dashboard-banner-logo-title "Close the world. Open the nExt.")
(dashboard-startup-banner
(expand-file-name "images/KEC_Dark_BK_Small.png" user-emacs-directory))
(dashboard-items '((recents . 7)
(bookmarks . 7)
(agenda . 5)))
(dashboard-set-heading-icons t)
(dashboard-set-navigator t)
(initial-buffer-choice (lambda () (get-buffer dashboard-buffer-name)))
(dashboard-navigator-buttons
(if (featurep 'all-the-icons)
`(((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust -0.05)
"M-EMACS" "Browse M-EMACS Homepage"
(lambda (&rest _) (browse-url "https://github.com/MatthewZMD/.emacs.d")))
(,(all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1)
"Configuration" "" (lambda (&rest _) (edit-configs)))))
`((("" "M-EMACS" "Browse M-EMACS Homepage"
(lambda (&rest _) (browse-url "https://github.com/MatthewZMD/.emacs.d")))
("" "Configuration" "" (lambda (&rest _) (edit-configs)))))))
:custom-face
(dashboard-banner-logo-title ((t (:family "Love LetterTW" :height 123))))
:config
(dashboard-modify-heading-icons '((recents . "file-text")
(bookmarks . "book")))
(dashboard-setup-startup-hook)
;; Open Dashboard function
(defun open-dashboard ()
"Open the *dashboard* buffer and jump to the first widget."
(interactive)
(if (get-buffer dashboard-buffer-name)
(kill-buffer dashboard-buffer-name))
(dashboard-insert-startupify-lists)
(switch-to-buffer dashboard-buffer-name)
(goto-char (point-min))
(delete-other-windows)))
;; -DashboardPac
;; PBLPac
(use-package page-break-lines
:diminish
:init (global-page-break-lines-mode))
;; -PBLPac
(provide 'init-dashboard)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-dashboard.el ends here