Mercurial > emacs
changeset 69156:e14bc51fc1eb
(ido-save-history, ido-load-history): Simplify. Don't
use find-file-noselect to avoid interference from other modes.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sun, 26 Feb 2006 00:48:27 +0000 |
parents | a8425fb1877d |
children | 76d55cdb7481 8a1ee48a8386 |
files | lisp/ido.el |
diffstat | 1 files changed, 24 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ido.el Sun Feb 26 00:48:11 2006 +0000 +++ b/lisp/ido.el Sun Feb 26 00:48:27 2006 +0000 @@ -1181,25 +1181,19 @@ (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 @@ (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 ()