diff options
| author | Kim F. Storm | 2006-02-26 00:48:27 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-02-26 00:48:27 +0000 |
| commit | 782ea71aba3761983d71bf8ab9bb77c974abab56 (patch) | |
| tree | 9f5493048c7d7aab3797fface57e300d643f2434 | |
| parent | a0eacbcd43999936b41e25edf4e573a6fb610aa0 (diff) | |
| download | emacs-782ea71aba3761983d71bf8ab9bb77c974abab56.tar.gz emacs-782ea71aba3761983d71bf8ab9bb77c974abab56.zip | |
(ido-save-history, ido-load-history): Simplify. Don't
use find-file-noselect to avoid interference from other modes.
| -rw-r--r-- | lisp/ido.el | 54 |
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.") | |||
| 1181 | (defun ido-save-history () | 1181 | (defun ido-save-history () |
| 1182 | "Save ido history and cache information between sessions." | 1182 | "Save ido history and cache information between sessions." |
| 1183 | (interactive) | 1183 | (interactive) |
| 1184 | (if (and ido-last-directory-list ido-save-directory-list-file) | 1184 | (when (and ido-last-directory-list ido-save-directory-list-file) |
| 1185 | (save-excursion | 1185 | (let ((buf (get-buffer-create " *ido session*")) |
| 1186 | (save-window-excursion | 1186 | (version-control 'never)) |
| 1187 | (if (find-buffer-visiting ido-save-directory-list-file) | 1187 | (unwind-protect |
| 1188 | (kill-buffer (find-buffer-visiting ido-save-directory-list-file))) | 1188 | (with-current-buffer buf |
| 1189 | (if (file-exists-p ido-save-directory-list-file) | 1189 | (erase-buffer) |
| 1190 | (delete-file ido-save-directory-list-file)) | 1190 | (ido-pp 'ido-last-directory-list) |
| 1191 | (set-buffer (let ((enable-local-variables nil)) | 1191 | (ido-pp 'ido-work-directory-list) |
| 1192 | (find-file-noselect ido-save-directory-list-file t))) | 1192 | (ido-pp 'ido-work-file-list) |
| 1193 | (goto-char (point-min)) | 1193 | (ido-pp 'ido-dir-file-cache "\n\n ") |
| 1194 | (delete-region (point-min) (point-max)) | 1194 | (insert "\n") |
| 1195 | (ido-pp 'ido-last-directory-list) | ||
| 1196 | (ido-pp 'ido-work-directory-list) | ||
| 1197 | (ido-pp 'ido-work-file-list) | ||
| 1198 | (ido-pp 'ido-dir-file-cache "\n\n ") | ||
| 1199 | (insert "\n") | ||
| 1200 | (let ((version-control 'never)) | ||
| 1201 | (write-file ido-save-directory-list-file nil)) | 1195 | (write-file ido-save-directory-list-file nil)) |
| 1202 | (kill-buffer (current-buffer)))))) | 1196 | (kill-buffer buf))))) |
| 1203 | 1197 | ||
| 1204 | (defun ido-load-history (&optional arg) | 1198 | (defun ido-load-history (&optional arg) |
| 1205 | "Load ido history and cache information from previous session. | 1199 | "Load ido history and cache information from previous session. |
| @@ -1209,18 +1203,18 @@ With prefix argument, reload history unconditionally." | |||
| 1209 | (let ((file (expand-file-name ido-save-directory-list-file)) | 1203 | (let ((file (expand-file-name ido-save-directory-list-file)) |
| 1210 | buf) | 1204 | buf) |
| 1211 | (when (file-readable-p file) | 1205 | (when (file-readable-p file) |
| 1212 | (save-excursion | 1206 | (setq buf (get-buffer-create " *ido session*")) |
| 1213 | (save-window-excursion | 1207 | (unwind-protect |
| 1214 | (setq buf (set-buffer (let ((enable-local-variables nil)) | 1208 | (with-current-buffer buf |
| 1215 | (find-file-noselect file)))) | 1209 | (erase-buffer) |
| 1216 | (goto-char (point-min)) | 1210 | (insert-file-contents file) |
| 1217 | (condition-case nil | 1211 | (condition-case nil |
| 1218 | (setq ido-last-directory-list (read (current-buffer)) | 1212 | (setq ido-last-directory-list (read (current-buffer)) |
| 1219 | ido-work-directory-list (read (current-buffer)) | 1213 | ido-work-directory-list (read (current-buffer)) |
| 1220 | ido-work-file-list (read (current-buffer)) | 1214 | ido-work-file-list (read (current-buffer)) |
| 1221 | ido-dir-file-cache (read (current-buffer))) | 1215 | ido-dir-file-cache (read (current-buffer))) |
| 1222 | (error nil)))) | 1216 | (error nil))) |
| 1223 | (kill-buffer buf)))) | 1217 | (kill-buffer buf))))) |
| 1224 | (ido-wash-history)) | 1218 | (ido-wash-history)) |
| 1225 | 1219 | ||
| 1226 | (defun ido-wash-history () | 1220 | (defun ido-wash-history () |