emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99833: Enable recentf-mode if using


From: Juanma Barranquero
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99833: Enable recentf-mode if using virtual buffers.
Date: Tue, 06 Apr 2010 04:26:37 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99833
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Tue 2010-04-06 04:26:37 +0200
message:
  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.
modified:
  lisp/ChangeLog
  lisp/ido.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-05 23:44:24 +0000
+++ b/lisp/ChangeLog    2010-04-06 02:26:37 +0000
@@ -1,3 +1,11 @@
+2010-04-06  Juanma Barranquero  <address@hidden>
+
+       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.
+
 2010-04-05  Juri Linkov  <address@hidden>
 
        Scrolling commands which scroll a line instead of full screen.

=== modified file 'lisp/ido.el'
--- a/lisp/ido.el       2010-04-04 06:55:19 +0000
+++ b/lisp/ido.el       2010-04-06 02:26:37 +0000
@@ -323,6 +323,7 @@
 ;;; Code:
 
 (defvar cua-inhibit-cua-keys)
+(defvar recentf-list)
 
 ;;; User Variables
 ;;
@@ -1041,6 +1042,11 @@
   "Non-nil means to explicitly cursor on entry to minibuffer.
 Value is an integer which is number of chars to right of prompt.")
 
+(defvar ido-virtual-buffers nil
+  "List of virtual buffers, that is, past visited files.
+This is a copy of `recentf-list', pared down and with faces applied.
+Only used if `ido-use-virtual-buffers' is non-nil.")
+
 ;;; Variables with dynamic bindings.
 ;;; Declared here to keep the byte compiler quiet.
 
@@ -3366,37 +3372,30 @@
     (if ido-temp-list
        (nconc ido-temp-list ido-current-buffers)
       (setq ido-temp-list ido-current-buffers))
-    (if (and default (buffer-live-p (get-buffer default)))
-       (progn
-         (setq ido-temp-list
-               (delete default ido-temp-list))
-         (setq ido-temp-list
-               (cons default ido-temp-list))))
+    (when (and default (buffer-live-p (get-buffer default)))
+      (setq ido-temp-list
+           (cons default (delete default ido-temp-list))))
     (if ido-use-virtual-buffers
        (ido-add-virtual-buffers-to-list))
     (run-hooks 'ido-make-buffer-list-hook)
     ido-temp-list))
 
-(defvar ido-virtual-buffers nil)
-
 (defun ido-add-virtual-buffers-to-list ()
   "Add recently visited files, and bookmark files, to the buffer list.
 This is to make them appear as if they were \"virtual buffers\"."
   ;; If no buffers matched, and virtual buffers are being used, then
   ;; consult the list of past visited files, to see if we can find
   ;; the file which the user might thought was still open.
+  (unless recentf-mode (recentf-mode 1))
   (setq ido-virtual-buffers nil)
-  (let ((head recentf-list) name)
-    (while head
-      (if (and (setq name (file-name-nondirectory (car head)))
-              (null (get-file-buffer (car head)))
-              (not (assoc name ido-virtual-buffers))
-              (not (ido-ignore-item-p name ido-ignore-buffers))
-              ;;(file-exists-p (car head))
-              )
-         (setq ido-virtual-buffers
-               (cons (cons name (car head)) ido-virtual-buffers)))
-      (setq head (cdr head))))
+  (let (name)
+    (dolist (head recentf-list)
+      (and (setq name (file-name-nondirectory head))
+           (null (get-file-buffer head))
+           (not (assoc name ido-virtual-buffers))
+           (not (ido-ignore-item-p name ido-ignore-buffers))
+           ;;(file-exists-p head)
+           (push (cons name head) ido-virtual-buffers))))
   (when ido-virtual-buffers
     (if ido-use-faces
        (dolist (comp ido-virtual-buffers)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]