projects
/
elisp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ba6c86
)
Added an option to save the selected file in file-name-history.
author
Francois Fleuret
<francois@fleuret.org>
Sun, 5 Dec 2010 18:56:16 +0000
(10:56 -0800)
committer
Francois Fleuret
<francois@fleuret.org>
Sun, 5 Dec 2010 18:56:16 +0000
(10:56 -0800)
selector.el
patch
|
blob
|
history
diff --git
a/selector.el
b/selector.el
index
17a5b23
..
197a8af
100644
(file)
--- a/
selector.el
+++ b/
selector.el
@@
-63,6
+63,11
@@
Otherwise use the mode-line."
:type 'bool
:group 'selector)
:type 'bool
:group 'selector)
+(defcustom selector/add-to-file-name-history t
+ "If non-nil, file selected with selector/quick-pick-recent will be added to the mini-buffer filename history."
+ :type 'bool
+ :group 'selector)
+
(defcustom selector/mode-hook nil
"Hook called at the end of the selector mode initialization."
:type 'hook
(defcustom selector/mode-hook nil
"Hook called at the end of the selector mode initialization."
:type 'hook
@@
-344,18
+349,23
@@
There seems to be header-line refreshing problems with emacs21."
)
(defun selector/find-file (filename)
)
(defun selector/find-file (filename)
+ (if selector/add-to-file-name-history
+ (add-to-list 'file-name-history filename t))
+ (find-file filename))
+
+(defun selector/pick-file (filename)
"Callback function for `selector/quick-pick-recent'. When
called with a universal argument, allows the user to edit the
filename."
(interactive)
(if current-prefix-arg
"Callback function for `selector/quick-pick-recent'. When
called with a universal argument, allows the user to edit the
filename."
(interactive)
(if current-prefix-arg
- (find-file (read-file-name
- "Find file: "
- (file-name-directory filename)
- nil
- nil
- (file-name-nondirectory filename)))
- (find-file filename)))
+ (
selector/
find-file (read-file-name
+
"Find file: "
+
(file-name-directory filename)
+
nil
+
nil
+
(file-name-nondirectory filename)))
+ (
selector/
find-file filename)))
(defun selector/quick-pick-recent ()
"Open a file picked in `recentf-list' with the dynamic
(defun selector/quick-pick-recent ()
"Open a file picked in `recentf-list' with the dynamic
@@
-373,7
+383,7
@@
prefix argument, allows to edit the filename after selection."
(cons (selector/filename-to-string s) s))
recentf-list)
(cons (selector/filename-to-string s) s))
recentf-list)
- 'selector/
find
-file
+ 'selector/
pick
-file
"*selector find-file*"
))
"*selector find-file*"
))