Skip to content

Commit f7fa3a9

Browse files
author
Thierry Volpiatto
committed
Get rid of ido for listing buffers (#2311)
* helm-buffers.el (helm-buffers-get-visible-buffers): New. (helm-buffer-list-1): New. (helm-buffer-list): Use them.
1 parent 0ee299e commit f7fa3a9

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

helm-buffers.el

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
(require 'helm-help)
2727
(require 'helm-occur)
2828

29-
(declare-function ido-make-buffer-list "ido" (default))
3029
(declare-function ido-add-virtual-buffers-to-list "ido")
3130
(declare-function helm-comp-read "helm-mode")
3231
(declare-function helm-browse-project "helm-files")
@@ -383,18 +382,29 @@ Note that this variable is buffer-local.")
383382
. helm-open-file-externally))))
384383

385384

386-
(defvar ido-use-virtual-buffers)
387-
(defvar ido-ignore-buffers)
385+
(defun helm-buffers-get-visible-buffers ()
386+
"Returns buffers visibles on current frame."
387+
(let (result)
388+
(walk-windows
389+
(lambda (x)
390+
(push (buffer-name (window-buffer x)) result))
391+
nil 'visible)
392+
result))
393+
394+
(defun helm-buffer-list-1 (&optional visibles)
395+
(delq nil
396+
(mapcar (lambda (b)
397+
(let ((bn (buffer-name b)))
398+
(unless (member bn visibles)
399+
bn)))
400+
(buffer-list))))
401+
388402
(defun helm-buffer-list ()
389403
"Return the current list of buffers.
390-
Currently visible buffers are put at the end of the list.
391-
See `ido-make-buffer-list' for more infos."
392-
(require 'ido)
393-
(let ((ido-process-ignore-lists t)
394-
ido-ignored-list
395-
ido-ignore-buffers
396-
ido-use-virtual-buffers)
397-
(ido-make-buffer-list nil)))
404+
Currently visible buffers are put at the end of the list."
405+
(let* ((visibles (helm-buffers-get-visible-buffers))
406+
(others (helm-buffer-list-1 visibles)))
407+
(nconc others visibles)))
398408

399409
(defun helm-buffer-size (buffer)
400410
"Return size of BUFFER."

0 commit comments

Comments
 (0)