bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19335: 24.4.51; ido.el: Include bookmark-files as virtual buffers


From: Rasmus
Subject: bug#19335: 24.4.51; ido.el: Include bookmark-files as virtual buffers
Date: Thu, 12 Mar 2015 15:45:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> -    (dolist (head recentf-list)
>> +    (dolist (head (append recentf-list
>
>> +                          (and (boundp 'bookmark-alist)
>> +                               bookmark-alist
>> +                               (mapcar
>> +                                (lambda (bookmark)
>> +                                  (cdr-safe (assoc 'filename bookmark)))
>> +                                bookmark-alist))))
>
> Looks OK, tho you should probably filter out nil elements in case
> a bookmark entry doesn't have a `filename' (and OTOH I think `cdr-safe'
> can be replaced by `cdr' because `assoc' can only return a cons or nil).

You are right.  I'd come to same conclusion earlier, but I hadn't updated
the patch.

The formatting is still not the prettiest, but I don't know how to make it
better...

The attached patch should merge against master.

Thanks,
Rasmus

-- 
It was you, Jezebel, it was you
>From d949b576623dc88e8b2a641a93b81d5d435bd071 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Thu, 12 Mar 2015 15:42:13 +0100
Subject: [PATCH] ido.el: Include bookmark-files as virtual buffers

* ido.el (ido-add-virtual-buffers-to-list): Include bookmarked files.

The docstring of ido-add-virtual-buffers-to-list suggests that
bookmarked files should include, but this does not in fact seem to
happen.
---
 lisp/ChangeLog |  5 +++++
 lisp/ido.el    | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 35689c1..1d4c8cf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-12  Rasmus Pank Roulund  <emacs@pank.eu>
+
+       * ido.el (ido-add-virtual-buffers-to-list): Include bookmark-alist
+       files.
+
 2015-03-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * international/quail.el (quail-input-method):
diff --git a/lisp/ido.el b/lisp/ido.el
index 1f4e3fa..0291765 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3480,8 +3480,16 @@ This is to make them appear as if they were \"virtual 
buffers\"."
   ;; 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 recentf-list)
+  (let ((bookmarks (and (boundp 'bookmark-alist)
+                        bookmark-alist))
+        name)
+    (dolist
+        (head (append
+               recentf-list
+               (and bookmarks
+                    (delq nil (mapcar (lambda (bookmark)
+                                        (cdr (assoc 'filename bookmark)))
+                                      bookmarks)))))
       (setq name (file-name-nondirectory head))
       ;; In case HEAD is a directory with trailing /.  See bug#14552.
       (when (equal name "")
-- 
2.3.2


reply via email to

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