diff options
| author | Juanma Barranquero | 2010-04-06 04:26:37 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2010-04-06 04:26:37 +0200 |
| commit | 9caf8a8f7f3a3ef2c37a603b3818c25dbacf9605 (patch) | |
| tree | 987405b26b33855c1f1fa6f314f198a1dbf2c127 | |
| parent | 5a97d2da2c494cad346ee18dea5e207420c5a845 (diff) | |
| download | emacs-9caf8a8f7f3a3ef2c37a603b3818c25dbacf9605.tar.gz emacs-9caf8a8f7f3a3ef2c37a603b3818c25dbacf9605.zip | |
Enable recentf-mode if using virtual buffers.
* ido.el (recentf-list): Declare for byte-compiler.
(ido-virtual-buffers): Move up to silence byte-compiler. Add docstring.
(ido-make-buffer-list): Simplify.
(ido-add-virtual-buffers-to-list): Simplify. Enable recentf-mode.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/ido.el | 37 |
2 files changed, 26 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a9d95d9dd3d..d875b01e858 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-04-06 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | Enable recentf-mode if using virtual buffers. | ||
| 4 | * ido.el (recentf-list): Declare for byte-compiler. | ||
| 5 | (ido-virtual-buffers): Move up to silence byte-compiler. Add docstring. | ||
| 6 | (ido-make-buffer-list): Simplify. | ||
| 7 | (ido-add-virtual-buffers-to-list): Simplify. Enable recentf-mode. | ||
| 8 | |||
| 1 | 2010-04-05 Juri Linkov <juri@jurta.org> | 9 | 2010-04-05 Juri Linkov <juri@jurta.org> |
| 2 | 10 | ||
| 3 | Scrolling commands which scroll a line instead of full screen. | 11 | Scrolling commands which scroll a line instead of full screen. |
diff --git a/lisp/ido.el b/lisp/ido.el index fdfd27ca7d3..4200475bfce 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -323,6 +323,7 @@ | |||
| 323 | ;;; Code: | 323 | ;;; Code: |
| 324 | 324 | ||
| 325 | (defvar cua-inhibit-cua-keys) | 325 | (defvar cua-inhibit-cua-keys) |
| 326 | (defvar recentf-list) | ||
| 326 | 327 | ||
| 327 | ;;; User Variables | 328 | ;;; User Variables |
| 328 | ;; | 329 | ;; |
| @@ -1041,6 +1042,11 @@ so that it doesn't interfere with other minibuffer usage.") | |||
| 1041 | "Non-nil means to explicitly cursor on entry to minibuffer. | 1042 | "Non-nil means to explicitly cursor on entry to minibuffer. |
| 1042 | Value is an integer which is number of chars to right of prompt.") | 1043 | Value is an integer which is number of chars to right of prompt.") |
| 1043 | 1044 | ||
| 1045 | (defvar ido-virtual-buffers nil | ||
| 1046 | "List of virtual buffers, that is, past visited files. | ||
| 1047 | This is a copy of `recentf-list', pared down and with faces applied. | ||
| 1048 | Only used if `ido-use-virtual-buffers' is non-nil.") | ||
| 1049 | |||
| 1044 | ;;; Variables with dynamic bindings. | 1050 | ;;; Variables with dynamic bindings. |
| 1045 | ;;; Declared here to keep the byte compiler quiet. | 1051 | ;;; Declared here to keep the byte compiler quiet. |
| 1046 | 1052 | ||
| @@ -3366,37 +3372,30 @@ for first matching file." | |||
| 3366 | (if ido-temp-list | 3372 | (if ido-temp-list |
| 3367 | (nconc ido-temp-list ido-current-buffers) | 3373 | (nconc ido-temp-list ido-current-buffers) |
| 3368 | (setq ido-temp-list ido-current-buffers)) | 3374 | (setq ido-temp-list ido-current-buffers)) |
| 3369 | (if (and default (buffer-live-p (get-buffer default))) | 3375 | (when (and default (buffer-live-p (get-buffer default))) |
| 3370 | (progn | 3376 | (setq ido-temp-list |
| 3371 | (setq ido-temp-list | 3377 | (cons default (delete default ido-temp-list)))) |
| 3372 | (delete default ido-temp-list)) | ||
| 3373 | (setq ido-temp-list | ||
| 3374 | (cons default ido-temp-list)))) | ||
| 3375 | (if ido-use-virtual-buffers | 3378 | (if ido-use-virtual-buffers |
| 3376 | (ido-add-virtual-buffers-to-list)) | 3379 | (ido-add-virtual-buffers-to-list)) |
| 3377 | (run-hooks 'ido-make-buffer-list-hook) | 3380 | (run-hooks 'ido-make-buffer-list-hook) |
| 3378 | ido-temp-list)) | 3381 | ido-temp-list)) |
| 3379 | 3382 | ||
| 3380 | (defvar ido-virtual-buffers nil) | ||
| 3381 | |||
| 3382 | (defun ido-add-virtual-buffers-to-list () | 3383 | (defun ido-add-virtual-buffers-to-list () |
| 3383 | "Add recently visited files, and bookmark files, to the buffer list. | 3384 | "Add recently visited files, and bookmark files, to the buffer list. |
| 3384 | This is to make them appear as if they were \"virtual buffers\"." | 3385 | This is to make them appear as if they were \"virtual buffers\"." |
| 3385 | ;; If no buffers matched, and virtual buffers are being used, then | 3386 | ;; If no buffers matched, and virtual buffers are being used, then |
| 3386 | ;; consult the list of past visited files, to see if we can find | 3387 | ;; consult the list of past visited files, to see if we can find |
| 3387 | ;; the file which the user might thought was still open. | 3388 | ;; the file which the user might thought was still open. |
| 3389 | (unless recentf-mode (recentf-mode 1)) | ||
| 3388 | (setq ido-virtual-buffers nil) | 3390 | (setq ido-virtual-buffers nil) |
| 3389 | (let ((head recentf-list) name) | 3391 | (let (name) |
| 3390 | (while head | 3392 | (dolist (head recentf-list) |
| 3391 | (if (and (setq name (file-name-nondirectory (car head))) | 3393 | (and (setq name (file-name-nondirectory head)) |
| 3392 | (null (get-file-buffer (car head))) | 3394 | (null (get-file-buffer head)) |
| 3393 | (not (assoc name ido-virtual-buffers)) | 3395 | (not (assoc name ido-virtual-buffers)) |
| 3394 | (not (ido-ignore-item-p name ido-ignore-buffers)) | 3396 | (not (ido-ignore-item-p name ido-ignore-buffers)) |
| 3395 | ;;(file-exists-p (car head)) | 3397 | ;;(file-exists-p head) |
| 3396 | ) | 3398 | (push (cons name head) ido-virtual-buffers)))) |
| 3397 | (setq ido-virtual-buffers | ||
| 3398 | (cons (cons name (car head)) ido-virtual-buffers))) | ||
| 3399 | (setq head (cdr head)))) | ||
| 3400 | (when ido-virtual-buffers | 3399 | (when ido-virtual-buffers |
| 3401 | (if ido-use-faces | 3400 | (if ido-use-faces |
| 3402 | (dolist (comp ido-virtual-buffers) | 3401 | (dolist (comp ido-virtual-buffers) |