EmacsのDashboardバッファーを再生する

起動画面にDashboardを設定しているEmacserは多いと思いますが、うっかりKill-bufferしてしまうと再表示できません。Dashboardバッファーを殺さないような設定もできますが、私は再表示コマンドを設定しています。こうすることで、Recent Listの表示もRefreshさせることができるので便利だと思います。

以下の設定では、[HOME]キーで前に開いていたバッファーとDashboardバッファーとをToggle表示させています。また、よくつかう作業を dashboard画面からワンキーで選択できるようにしています。

Emacs27になってから emacs-init-timeが小数点以下まで表示されるようになってちょっとわずらわしいので小数点以下３桁までの表示にカスタマイズしています。

### Screenshoot
![ALT](https://live.staticflickr.com/65535/51479421757_b0286c900a_b.jpg)

### お気に入り外部リンクを Hydraでポップさせた画面
![ALT](https://live.staticflickr.com/65535/51480426528_8ffa0d79c3_b.jpg)

### dashboardの Emacs設定
``` emacs-lisp
(leaf dashboard
  :ensure t
  :config
  (with-eval-after-load 'dashboard
	(bind-key "<home>" 'dashboard-refresh-buffer)
	(bind-key "b" 'chromium-bible dashboard-mode-map)
	(bind-key "c" 'chromium-calendar dashboard-mode-map)
	(bind-key "g" 'chromium-google-search dashboard-mode-map)
	(bind-key "m" 'chromium-gmail dashboard-mode-map)
	(bind-key "h" 'chromium-homepage dashboard-mode-map)
	(bind-key "w" 'chromium-weather dashboard-mode-map)
	(bind-key "s" 'open-sylpheed dashboard-mode-map)
	(bind-key "@" 'howm-list-all dashboard-mode-map)
	(bind-key "," 'org-capture dashboard-mode-map)
	(bind-key "." 'hydra-browse/body dashboard-mode-map)
	(bind-key "<home>" 'quit-window dashboard-mode-map))
  (dashboard-setup-startup-hook)
  (setq dashboard-page-separator "\n\f\n")
  ;; Set the title
  (setq dashboard-banner-logo-title
		(concat "GNU Emacs " emacs-version " kernel "
				(car (split-string (shell-command-to-string "uname -r")))  " Debian "
				(car (split-string (shell-command-to-string "cat /etc/debian_version"))) " 86_64 GNU/Linux"))
  ;; Set the banner
  (setq dashboard-startup-banner (expand-file-name "emacs.png" user-emacs-directory))
  (setq dashboard-set-heading-icons t)
  (setq dashboard-set-file-icons t)
  (setq show-week-agenda-p t)
  (setq dashboard-items '((recents  . 5)
  						  (agenda . 5)))
  ;; Set the footer
  (setq dashboard-footer-icon
		(all-the-icons-octicon "dashboard" :height 1.1 :v-adjust -0.05 :face 'font-lock-keyword-face))
  ;; Insert custom item
  (add-to-list 'dashboard-item-generators  '(custom . dashboard-insert-custom))
  (add-to-list 'dashboard-items '(custom) t)

  :init
  (leaf page-break-lines :ensure t)
  (global-page-break-lines-mode)

  (defun dashboard-goto-recent-files ()
	"Go to recent files."
	(interactive)
	(funcall (local-key-binding "r")))

  (defun dashboard-insert-custom (list-size)
	"Insert custom and set LIST-SIZE."
	(interactive)
	(insert (if (display-graphic-p)
				(all-the-icons-faicon "leaf" :height 1.2 :v-adjust -0.05 :face 'dashboard-heading) " "))
	(insert "   GH: (h)    Calendar: (c)    Weather: (w)   oogle: (g)    Mail: (m.s)    Howm: (@)    Task: (,)   🙌 (.)"))

  (defun open-sylpheed ()
	"Open keepassxc withe auto passwd input."
	(interactive)
	(compile "sylpheed")
	(delete-other-windows))

  ;; Hack emacs-init-time
  (defun ad:emacs-init-time ()
	"Return a string giving the duration of the Emacs initialization."
	(interactive)
	(let ((str
		   (format "%.3f seconds"
				   (float-time
					(time-subtract after-init-time before-init-time)))))
	  (if (called-interactively-p 'interactive)
		  (message "%s" str)
		str)))
  (advice-add 'emacs-init-time :override #'ad:emacs-init-time))

```