replace splash screen with list of recentf

2018-05-16 16:57:15

The splash screen is useful in the beginning, but now I want something more useful: I want to have list of recently opened files presented when starting emacs if there is no predefined file to open. Even better, if it can be the helm-recentf window (I use helm package)

There's also a package on MELPA for this now: dashboard: https://github.com/rakanalh/emacs-dashboard. The package allows you to have a splash screen as in the image below:

Here's the use-package snippet from my config to set it up with a custom banner image and line of text, as well as a list of recent files and bookmarks:

(use-package dashboard

:ensure t

:diminish dashboard-mode

:config

(setq dashboard-banner-logo-title "your custom text")

(setq dashboard-startup-banner "/path/to/image")

(setq dashboard-items '((recents . 10)

(bookmarks . 10)))

(dashboard-setup-startup-hook))

Manomagically :D, after posting the question I got the wor

  • There's also a package on MELPA for this now: dashboard: https://github.com/rakanalh/emacs-dashboard. The package allows you to have a splash screen as in the image below:

    Here's the use-package snippet from my config to set it up with a custom banner image and line of text, as well as a list of recent files and bookmarks:

    (use-package dashboard

    :ensure t

    :diminish dashboard-mode

    :config

    (setq dashboard-banner-logo-title "your custom text")

    (setq dashboard-startup-banner "/path/to/image")

    (setq dashboard-items '((recents . 10)

    (bookmarks . 10)))

    (dashboard-setup-startup-hook))

    2018-05-16 18:01:39
  • Manomagically :D, after posting the question I got the working solution by removing one single quote below in my .emacs

    (setq initial-buffer-choice '(helm-recentf)) ;; Does not work

    To this:

    (setq initial-buffer-choice (helm-recentf)) ;; Works!!!

    ;; I still haven't tried doing with the built-in recentf only

    Update

    It still doesn't work with the solution above actually. I got the file open but emacs switches to scratch buffer right afterward. I have to jump to the buffer of the file I want. So still need more help on this.

    Update 2

    After some wrestling with elisp, I got this one really works now:

    (require 'recentf) ;; Provided for the whole picture

    (require 'helm)

    (require 'helm-config)

    (defun startwithrecentf()

    (buffer-name (find-file (car (helm-recentf))))

    )

    (setq initial-buffer-choice (startwithrecentf))

    Update 3

    The following is more compact. It also roughly handle the case emacs is called with additional arguments, i.e emacs somefile

    (require 'recentf) ;; Pro

    2018-05-16 18:15:08