Skip to content

Instantly share code, notes, and snippets.

@tam17aki
Last active August 29, 2015 14:03
Show Gist options
  • Save tam17aki/beb3a32a9e0122b92fbc to your computer and use it in GitHub Desktop.
Save tam17aki/beb3a32a9e0122b92fbc to your computer and use it in GitHub Desktop.
(defun recentf-ido-find-files-and-dirs (arg)
"Find a recent file and a directory using Ido."
(interactive "P")
(let* ((show-full-path-p (cond (arg t) (t nil)))
(file-assoc-list ;表示する候補名とフルパス
(mapcar (lambda (x)
(cond ((equal (substring x (- (length x) 1) (length x)) "/") ;末尾がスラッシュ
(cons (file-name-directory x) x))
(t
(cond (show-full-path-p
(cons x x))
(t
(cons (file-name-nondirectory x) x))))))
recentf-list))
(filename-list
(remove-duplicates (mapcar #'car file-assoc-list)
:test #'string=))
(filename (ido-completing-read "Choose recent file or directory: "
filename-list nil t)))
(when filename
(find-file (cdr (assoc filename file-assoc-list))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment