Skip to content

Commit

Permalink
Get rid of ido for listing buffers (#2311)
Browse files Browse the repository at this point in the history
* helm-buffers.el (helm-buffers-get-visible-buffers): New.
(helm-buffer-list-1):                                 New.
(helm-buffer-list): Use them.
  • Loading branch information
thierryvolpiatto committed May 30, 2020
1 parent 0ee299e commit f7fa3a9
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions helm-buffers.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
(require 'helm-help)
(require 'helm-occur)

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


(defvar ido-use-virtual-buffers)
(defvar ido-ignore-buffers)
(defun helm-buffers-get-visible-buffers ()
"Returns buffers visibles on current frame."
(let (result)
(walk-windows
(lambda (x)
(push (buffer-name (window-buffer x)) result))
nil 'visible)
result))

(defun helm-buffer-list-1 (&optional visibles)
(delq nil
(mapcar (lambda (b)
(let ((bn (buffer-name b)))
(unless (member bn visibles)
bn)))
(buffer-list))))

(defun helm-buffer-list ()
"Return the current list of buffers.
Currently visible buffers are put at the end of the list.
See `ido-make-buffer-list' for more infos."
(require 'ido)
(let ((ido-process-ignore-lists t)
ido-ignored-list
ido-ignore-buffers
ido-use-virtual-buffers)
(ido-make-buffer-list nil)))
Currently visible buffers are put at the end of the list."
(let* ((visibles (helm-buffers-get-visible-buffers))
(others (helm-buffer-list-1 visibles)))
(nconc others visibles)))

(defun helm-buffer-size (buffer)
"Return size of BUFFER."
Expand Down

0 comments on commit f7fa3a9

Please sign in to comment.