]> git.eshelyaron.com Git - emacs.git/commitdiff
iswitchb.el (iswitchb-completions): Add bookmark files to the
authorJohn Wiegley <jwiegley@gmail.com>
Wed, 3 Feb 2010 20:47:25 +0000 (15:47 -0500)
committerJohn Wiegley <jwiegley@gmail.com>
Wed, 3 Feb 2010 20:47:25 +0000 (15:47 -0500)
list of files considered for "virtual buffer" completions.

lisp/ChangeLog
lisp/iswitchb.el

index 3e133665570abc4206bc053989119a271d98046f..36df1bd0b72d663839e4763196cf4055f7acff5a 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-03  John Wiegley  <jwiegley@gmail.com>
+
+       * iswitchb.el (iswitchb-completions): Add bookmark files to the
+       list of files considered for "virtual buffer" completions.
+
 2010-02-03  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/ange-ftp.el (ange-ftp-insert-directory): Parse directory
index ea4b00dc90dbca07634e99062fef13162de793d6..ee06db6f78f3777de1f792ae7f8eb3e81f85aedf 100644 (file)
@@ -1274,7 +1274,7 @@ Modified from `icomplete-completions'."
     ;; consult the list of past visited files, to see if we can find
     ;; the file which the user might thought was still open.
     (when (and iswitchb-use-virtual-buffers (null comps)
-              recentf-list)
+              (or recentf-list bookmark-alist))
       (setq iswitchb-virtual-buffers nil)
       (let ((head recentf-list) name)
        (while head
@@ -1289,15 +1289,30 @@ Modified from `icomplete-completions'."
              (setq iswitchb-virtual-buffers
                    (cons (cons name (car head))
                          iswitchb-virtual-buffers)))
-         (setq head (cdr head)))
-       (setq iswitchb-virtual-buffers (nreverse iswitchb-virtual-buffers)
-             comps (mapcar 'car iswitchb-virtual-buffers))
+         (setq head (cdr head))))
+      (let ((head bookmark-alist) name path)
+       (while head
+         (if (and (setq path (cdr (assq 'filename (cdar head))))
+                  (setq name (file-name-nondirectory path))
+                  (string-match (if iswitchb-regexp
+                                    iswitchb-text
+                                  (regexp-quote iswitchb-text)) name)
+                  (null (get-file-buffer path))
+                  (not (assoc name iswitchb-virtual-buffers))
+                  (not (iswitchb-ignore-buffername-p name))
+                  (file-exists-p path))
+             (setq iswitchb-virtual-buffers
+                   (cons (cons name path)
+                         iswitchb-virtual-buffers)))
+         (setq head (cdr head))))
+      (setq iswitchb-virtual-buffers (nreverse iswitchb-virtual-buffers)
+           comps (mapcar 'car iswitchb-virtual-buffers))
        (let ((comp comps))
          (while comp
            (put-text-property 0 (length (car comp))
                               'face 'iswitchb-virtual-matches
                               (car comp))
-           (setq comp (cdr comp))))))
+           (setq comp (cdr comp)))))
 
     (cond ((null comps) (format " %sNo match%s"
                                open-bracket-determined