Skip to content

Commit 4239d7d

Browse files
jrhorn424eschulte
authored andcommitted
Added function and key binding to use ido for recent files
1 parent 3d782a8 commit 4239d7d

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

starter-kit-bindings.org

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ Key Bindings.
4343

4444
** File finding
4545
#+begin_src emacs-lisp
46-
(global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
47-
(global-set-key (kbd "C-x C-p") 'find-file-at-point)
48-
(global-set-key (kbd "C-c y") 'bury-buffer)
49-
(global-set-key (kbd "C-c r") 'revert-buffer)
50-
(global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
51-
(global-set-key (kbd "C-x C-b") 'ibuffer)
46+
(global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
47+
(global-set-key (kbd "C-x C-p") 'find-file-at-point)
48+
(global-set-key (kbd "C-c y") 'bury-buffer)
49+
(global-set-key (kbd "C-c r") 'revert-buffer)
50+
(global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
51+
(global-set-key (kbd "C-x C-b") 'ibuffer)
52+
(global-set-key (kbd "C-x f") 'recentf-ido-find-file)
5253
#+end_src
5354

5455
** Window switching. (C-x o goes to the next window)

starter-kit-defuns.org

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,25 @@ a lambda doesn't already exist in the list.
5151
"Enable things that are convenient across all coding buffers."
5252
(run-hooks 'starter-kit-coding-hook))
5353
#+end_src
54+
55+
#+srcname: starter-kit-recentf-ido-find-file
56+
#+begin_src emacs-lisp
57+
(defun recentf-ido-find-file ()
58+
"Find a recent file using Ido."
59+
(interactive)
60+
(let* ((file-assoc-list
61+
(mapcar (lambda (x)
62+
(cons (file-name-nondirectory x)
63+
x))
64+
recentf-list))
65+
(filename-list
66+
(remove-duplicates (mapcar #'car file-assoc-list)
67+
:test #'string=))
68+
(filename (ido-completing-read "Choose recent file: "
69+
filename-list
70+
nil
71+
t)))
72+
(when filename
73+
(find-file (cdr (assoc filename
74+
file-assoc-list))))))
75+
#+end_src

0 commit comments

Comments
 (0)