summaryrefslogtreecommitdiff
path: root/lisp/init-buffile.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-09-27 21:12:07 -0400
committerKyle Meyer <kyle@kyleam.com>2014-09-27 21:12:07 -0400
commit08ff413999987035619732502fe7aaaf3a1e2392 (patch)
treecf4d42aa9d42eba0345054aa70cc9368a54a0662 /lisp/init-buffile.el
parente07c1534f079259d2c6bca1e8940a9b21c18efcc (diff)
downloademacs.d-08ff413999987035619732502fe7aaaf3a1e2392.tar.gz
Move recentf find-file functions
Diffstat (limited to 'lisp/init-buffile.el')
-rw-r--r--lisp/init-buffile.el25
1 files changed, 24 insertions, 1 deletions
diff --git a/lisp/init-buffile.el b/lisp/init-buffile.el
index e6257ae..687f8b1 100644
--- a/lisp/init-buffile.el
+++ b/lisp/init-buffile.el
@@ -78,12 +78,35 @@ user."
;; Don't show empty filter groups.
ibuffer-show-empty-filter-groups nil)
-;; Recent files
+;;; Recent files
+
(setq recentf-save-file "~/.emacs.d/cache/recentf"
recentf-max-saved-items 200
recentf-max-menu-items 15)
(recentf-mode t)
+;; From prelude
+(defun km/recentf-ido-find-file ()
+ "Find a recent file using ido."
+ (interactive)
+ (-when-let (file (km/read-recent-file))
+ (find-file file)))
+
+(defun km/recentf-ido-find-file-other-window ()
+ "Find a recent file in other window using ido."
+ (interactive)
+ (-when-let (file (km/read-recent-file))
+ (find-file-other-window file)))
+
+(defun km/read-recent-file ()
+ (ido-completing-read "Choose recent file: " recentf-list nil t))
+
+(key-chord-define-global ",r" 'km/recentf-ido-find-file)
+;; This overrides `find-file-read-only-other-window', but
+;; `view-file-other-window', which I map to 'v', has the same
+;; functionality.
+(define-key ctl-x-4-map "r" 'km/recentf-ido-find-file-other-window)
+
;;; Temporary scratch files
(define-prefix-command 'km/scratch-map)