~taingram/emacs-welcome

3bb84b7db5a378a50cc13c4e83eb46c7c2fa7045 — Thomas Ingram 2 years ago 8264ea3 master
Add max recent files and a 'see more' button to welcome.el
1 files changed, 13 insertions(+), 3 deletions(-)

M welcome.el
M welcome.el => welcome.el +13 -3
@@ 46,8 46,11 @@
(defun welcome-insert-recent-files ()
  "Insert list of recently viewed files."
  (insert (propertize "Recently Opened Files" 'face 'bold) "\n")
  (let ((home (getenv "HOME")))
    (dolist (file recentf-list)
  (let ((home (getenv "HOME"))
	(file nil))
    (dotimes (i (min welcome-max-recent-files
		     (length recentf-list)))
      (setq file (nth i recentf-list))
      (insert-text-button
       (if (string-prefix-p home file)
	   (concat "~" (string-remove-prefix home file))


@@ 55,7 58,14 @@
       'action `(lambda (_button) (find-file ,file))
       'follow-link t
       'help-echo `(concat "Click to open " ,file))
      (insert "\n"))))
      (insert "\n")))
  (when (< welcome-max-recent-files (length recentf-list))
	  (insert-text-button
	   "See more..."
	   'action `(lambda (_button) (recentf-open-files))
	   'follow-link t
	   'help-echo "Show all recently opened files")
	  (insert "\n\n")))

(defun welcome-screen ()
  "Display welcome screen."