From 08ff413999987035619732502fe7aaaf3a1e2392 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 27 Sep 2014 21:12:07 -0400 Subject: Move recentf find-file functions --- lisp/init-buffile.el | 25 ++++++++++++++++++++++++- lisp/init-ido.el | 21 --------------------- 2 files changed, 24 insertions(+), 22 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) diff --git a/lisp/init-ido.el b/lisp/init-ido.el index 87a314e..da40bd3 100644 --- a/lisp/init-ido.el +++ b/lisp/init-ido.el @@ -36,27 +36,6 @@ (ido-ubiquitous-mode 1) (ido-at-point-mode) -;; 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) (key-chord-define-global ",b" 'ido-switch-buffer) (provide 'init-ido) -- cgit v1.2.3