diff options
author | Thierry Volpiatto <thievol@posteo.net> | 2020-09-04 20:41:15 +0200 |
---|---|---|
committer | Thierry Volpiatto <thievol@posteo.net> | 2020-09-04 20:41:15 +0200 |
commit | 6c24f1972806a31263de87e117464a8a1a81f2fe (patch) | |
tree | f3d2626415394739bbaf3bb83d33422a1fd762b3 /helm-mode.el | |
parent | 9753e053fc0cd4d72b215b8ef5ec61eb206e59ea (diff) |
Improve previous commit which is not handling current-buffer
Use `internal-complete-buffer-except' as default collection,
assuming `switch-to-buffer' doesn't need the current buffer and
`kill-buffer' add it on top of completion list. This may be
wrong in other functions, but lets use this as there is no better
solutions to abstract this for now.
Diffstat (limited to 'helm-mode.el')
-rw-r--r-- | helm-mode.el | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/helm-mode.el b/helm-mode.el index 5981e8d5..92a3570b 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -1048,20 +1048,16 @@ This handler uses dynamic matching which allows honouring `completion-styles'." init hist default inherit-input-method name buffer standard))) -(defun helm-mode--buffer-list () - "Remove internal buffers from `buffer-list'." - (delq nil (mapcar (lambda (b) - (let ((name (buffer-name b))) - (and (not (eql (aref name 0) ? )) - name))) - (buffer-list)))) - (defun helm--generic-read-buffer (prompt &optional default require-match predicate) "The `read-buffer-function' for `helm-mode'. -Affects `switch-to-buffer' and related." - (let ((collection (helm-mode--buffer-list))) - (helm--completing-read-default - prompt collection predicate require-match nil nil default))) +Affects `switch-to-buffer' `kill-buffer' and related." + ;; Use `internal-complete-buffer-except' as default collection, + ;; assuming `switch-to-buffer' doesn't need the current buffer and + ;; `kill-buffer' add it on top of completion list. This may be + ;; wrong in other functions, but lets use this as there is no better + ;; solutions to abstract this for now. + (helm--completing-read-default + prompt (internal-complete-buffer-except) predicate require-match nil nil default)) (cl-defun helm--completing-read-default (prompt collection &optional |