10
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Emacsのスタート画面をイケメンにする

Last updated at Posted at 2018-09-21

100分の1秒でもemacsの起動を早くしようと試行錯誤している一方、起動のたびに真黒なScratch画面と向きあっていると気分も暗くなってくる。せめて初期画面くらいは、ホットするようなものにしたい…ということで、dashbord.elを導入してみた。

Alt Text

dashbord.elを入れる

M-x package install dashbord.el

設定は以下の通り。
私の場合、MacOSとLinuxの両方で設定ファイルを共用しているのでTileの設定は二つ書いてます。

(use-package dashboard
  :bind (("<f10>" . open-dashboard)
  	 :map dashboard-mode-map
  	 ("c" . browse-calendar)
	 ("w" . browse-tenki)
  	 ("m" . browse-gmail)
  	 ("t" . browse-tweetdeck)
  	 ("s" . browse-slack)
  	 ("h" . browse-homepage)
  	 ("l" . line-app-open)
   	 ("<f10>" . quit-dashboard))
  :hook (after-init . dashboard-setup-startup-hook)
  :config
  ;; Set the title
  (when (eq system-type 'darwin)
    (setq dashboard-banner-logo-title
	  (concat "GNU Emacs " emacs-version " kernel "
		  (car (split-string (shell-command-to-string "uname -r")))  " x86_64 Mac OS X "
		  (car(split-string (shell-command-to-string "sw_vers -productVersion") "-")))))
  (when (eq system-type 'gnu/linux)
    (setq dashboard-banner-logo-title
	  (concat "GNU Emacs " emacs-version " kernel "
		  (car (split-string (shell-command-to-string "uname -r")))  " x86_64 Debian GNU/Linux "
		  (car (split-string (shell-command-to-string "cat /etc/debian_version") "_")))))
  ;; Set the banner
  (setq dashboard-startup-banner "~/Dropbox/emacs.d/emacs.png")

  ;; Use icons
  (setq dashboard-set-heading-icons t)
  (setq dashboard-set-file-icons t)

  ;; Set the footer
  (setq dashboard-footer "Always be joyful. Never stop praying. Be thankful in all circumstances!")
  (setq dashboard-footer-icon
	(all-the-icons-octicon "dashboard" :height 1.1 :v-adjust -0.05 :face 'font-lock-keyword-face))
  (when (eq system-type 'darwin)
    (setq dashboard-items '((recents  . 10))))
  (when (eq system-type 'gnu/linux)
    (setq dashboard-items '((recents  . 8))))

  ;; Insert custom item
  (defun dashboard-insert-custom (list-size)
    (insert (if (display-graphic-p)
		(all-the-icons-faicon "google" :height 1.2 :v-adjust -0.05 :face 'error) " "))
    (insert "   Calendar: (c)    Weather: (w)    Mail: (m)    Twitter: (t)    LINE: (l)    Slack: (s)    GH: (h)"))
  (add-to-list 'dashboard-item-generators  '(custom . dashboard-insert-custom))
  (add-to-list 'dashboard-items '(custom) t)

  (defun open-dashboard ()
    "Open the *dashboard* buffer and jump to the first widget."
    (interactive)
    (delete-other-windows)
    ;; Refresh dashboard buffer
    (if (get-buffer dashboard-buffer-name)
	(kill-buffer dashboard-buffer-name))
    (dashboard-insert-startupify-lists)
    (switch-to-buffer dashboard-buffer-name)
    ;; Jump to the first section
    (goto-char (point-min))
    (dashboard-goto-recent-files))

  (defun quit-dashboard ()
    "Quit dashboard window."
    (interactive)
    (quit-window t)
    (when (and dashboard-recover-layout-p
	       (bound-and-true-p winner-mode))
      (winner-undo)
      (setq dashboard-recover-layout-p nil)))

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


  • Recent listは、Tab(Shift+Tab)キーを押すことで選択できる。
  • F10 でDashboardのOpen/quitをtoggleします。
    Quitすると一つ前のBufferに切り替わり、Open時にはdel-other-windowsののちDashboard画面をRefreshします。
  • Dashboard画面からお気に入りのWEBページをワンキーで開けます。(hydraを使う)
  • Bannerのemacs.pngは自作です。必要な方はどうぞお使いください。

Alt Text

PS:
2019.09.11 HydraでQuick Menu機能をつけました。
2019.08.30 icon対応とし、クイックメニュー機能を追加しました。

10
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?