Function: ido-add-virtual-buffers-to-list

ido-add-virtual-buffers-to-list is a byte-compiled function defined in ido.el.gz.

Signature

(ido-add-virtual-buffers-to-list)

Documentation

Add recently visited files, and bookmark files, to the buffer list.

This is to make them appear as if they were "virtual buffers".

Source Code

;; Defined in /usr/src/emacs/lisp/ido.el.gz
(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 (name)
    (dolist (head (append
                   recentf-list
                   (and (fboundp 'bookmark-get-filename)
                        (delq nil (mapcar #'bookmark-get-filename
                                          (bound-and-true-p bookmark-alist))))))
      (setq name (file-name-nondirectory head))
      ;; In case HEAD is a directory with trailing /.  See bug#14552.
      (when (equal name "")
	(setq name (file-name-nondirectory (directory-file-name head))))
      (when (equal name "")
	(setq name head))
      (and (not (equal name ""))
           (null (let (file-name-handler-alist) (get-file-buffer head)))
           (not (assoc name ido-virtual-buffers))
           (not (member name ido-temp-list))
           (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)
	  (put-text-property 0 (length (car comp))
			     'face 'ido-virtual
			     (car comp))))
    (setq ido-temp-list
	  (nconc ido-temp-list
		 (nreverse (mapcar #'car ido-virtual-buffers))))))