I want to build a helm-source
from a large hash-table
, is there a smarter/faster way to to this, than the way described below?
(setq tab #s(hash-table
size 16
test equal
data ("asdf" "asdf"
"zxcv" "zxcv"
"qwert" "qwert")))
(setq l '(("asdf" . "asdf")
("zxcv" . "zxcv")
("qwert" . "qwert")))
;;; works as expected
(helm :sources (helm-build-sync-source "test"
:candidates l
:fuzzy-match t
:action (lambda (candidate) (insert candidate)))
:buffer "*helm test*")
;;; does not work
(helm :sources (helm-build-sync-source "test"
:candidates tab
:fuzzy-match t
:action (lambda (candidate) (insert candidate)))
:buffer "*helm test*")
I can build a function that transforms the hash-table
:
(defun hash-to-alist (hash)
(let (res)
(maphash (lambda (key value)
(push `(,key . ,value) res))
hash)
res))
(helm :sources (helm-build-sync-source "test"
:candidates (hash-to-alist tab)
:fuzzy-match t
:action (lambda (candidate) (insert candidate)))
:buffer "*helm test*")