summaryrefslogtreecommitdiff
path: root/lisp/ido.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2006-02-26 00:48:27 +0000
committerKim F. Storm <storm@cua.dk>2006-02-26 00:48:27 +0000
commit782ea71aba3761983d71bf8ab9bb77c974abab56 (patch)
tree9f5493048c7d7aab3797fface57e300d643f2434 /lisp/ido.el
parenta0eacbcd43999936b41e25edf4e573a6fb610aa0 (diff)
downloademacs-782ea71aba3761983d71bf8ab9bb77c974abab56.tar.gz
(ido-save-history, ido-load-history): Simplify. Don't
use find-file-noselect to avoid interference from other modes.
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el54
1 files changed, 24 insertions, 30 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 77479de04d8..cae5446abcd 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1181,25 +1181,19 @@ it doesn't interfere with other minibuffer usage.")
(defun ido-save-history ()
"Save ido history and cache information between sessions."
(interactive)
- (if (and ido-last-directory-list ido-save-directory-list-file)
- (save-excursion
- (save-window-excursion
- (if (find-buffer-visiting ido-save-directory-list-file)
- (kill-buffer (find-buffer-visiting ido-save-directory-list-file)))
- (if (file-exists-p ido-save-directory-list-file)
- (delete-file ido-save-directory-list-file))
- (set-buffer (let ((enable-local-variables nil))
- (find-file-noselect ido-save-directory-list-file t)))
- (goto-char (point-min))
- (delete-region (point-min) (point-max))
- (ido-pp 'ido-last-directory-list)
- (ido-pp 'ido-work-directory-list)
- (ido-pp 'ido-work-file-list)
- (ido-pp 'ido-dir-file-cache "\n\n ")
- (insert "\n")
- (let ((version-control 'never))
+ (when (and ido-last-directory-list ido-save-directory-list-file)
+ (let ((buf (get-buffer-create " *ido session*"))
+ (version-control 'never))
+ (unwind-protect
+ (with-current-buffer buf
+ (erase-buffer)
+ (ido-pp 'ido-last-directory-list)
+ (ido-pp 'ido-work-directory-list)
+ (ido-pp 'ido-work-file-list)
+ (ido-pp 'ido-dir-file-cache "\n\n ")
+ (insert "\n")
(write-file ido-save-directory-list-file nil))
- (kill-buffer (current-buffer))))))
+ (kill-buffer buf)))))
(defun ido-load-history (&optional arg)
"Load ido history and cache information from previous session.
@@ -1209,18 +1203,18 @@ With prefix argument, reload history unconditionally."
(let ((file (expand-file-name ido-save-directory-list-file))
buf)
(when (file-readable-p file)
- (save-excursion
- (save-window-excursion
- (setq buf (set-buffer (let ((enable-local-variables nil))
- (find-file-noselect file))))
- (goto-char (point-min))
- (condition-case nil
- (setq ido-last-directory-list (read (current-buffer))
- ido-work-directory-list (read (current-buffer))
- ido-work-file-list (read (current-buffer))
- ido-dir-file-cache (read (current-buffer)))
- (error nil))))
- (kill-buffer buf))))
+ (setq buf (get-buffer-create " *ido session*"))
+ (unwind-protect
+ (with-current-buffer buf
+ (erase-buffer)
+ (insert-file-contents file)
+ (condition-case nil
+ (setq ido-last-directory-list (read (current-buffer))
+ ido-work-directory-list (read (current-buffer))
+ ido-work-file-list (read (current-buffer))
+ ido-dir-file-cache (read (current-buffer)))
+ (error nil)))
+ (kill-buffer buf)))))
(ido-wash-history))
(defun ido-wash-history ()