helm-system-packages
helm-system-packages copied to clipboard
Show all possible candidates after filtering
By default, helm-system-packages-candidate-limit
is 1000.
Let's consider we have more than 1000 packages in the database.
If we disable the display of, say, uninstalled packages (M-N
by default), it leaves room for more packages of the other categories to be displayed.
Sadly, the list won't be displayed unless a pattern is entered.
This issue makes it impossible to list all packages of specific categories.
The problem essentially lies in that Helm System Packages makes use of buffers and not lists. I'm not sure how to solve that. @thierryvolpiatto?
Pierre Neidhardt [email protected] writes:
By default, helm-system-packages-candidate-limit is 1000. Let's consider we have more than 1000 packages in the database.
If we disable the display of, say, uninstalled packages (M-N by default), it leaves room for more packages of the other categories to be displayed. Sadly, the list won't be displayed unless a pattern is entered.
This issue makes it impossible to list all packages of specific categories.
The problem essentially lies in that Helm System Packages makes use of buffers and not lists. I'm not sure how to solve that. @thierryvolpiatto?
You make normally this limitation with :requires-pattern, but I see you don't use it so I guess it is a problem with your init function and/or its transformer, are you using filtered-candidate-transformer ? are you using helm-force-update ?
-- Thierry
Well, the original helm-gentoo
and helm-apt
had the same issue if I'm not mistaken.
I'm not using filtered-candidate-transformer
nor helm-force-update
.
-
filtered-candidate-transformer
: I don't think that's approprioate. From the doc: "While ‘candidate-transformer’ is run only once, it is run every time the input pattern is changed." -
helm-force-update
: I tried the following:(defun helm-system-packages-toggle-uninstalled () (interactive) (with-helm-alive-p (setq helm-system-packages--show-uninstalled-p (not helm-system-packages--show-uninstalled-p)) (helm-force-update)))
It does not help with the issue, but that was to be expected; see below.
Allow me to sum up:
The list of package names and descriptions is generated once, then cached.
The init
function simply uses those cache variables as a buffer source:
(helm-init-candidates-in-buffer 'global (if helm-system-packages-show-descriptions-p helm-system-packages--descriptions helm-system-packages--names))
The buffer source has the following properties:
(helm-build-in-buffer-source helm-system-packages--source-name
:init 'helm-system-packages-xbps-init
:candidate-transformer 'helm-system-packages-xbps-transformer
:candidate-number-limit helm-system-packages-candidate-limit
:display-to-real 'helm-system-packages-extract-name
...
Then the transformer only filters out the unwanted packages, e.g.
(defun helm-system-packages-xbps-transformer (packages)
(let (res (pkglist (reverse packages)))
(dolist (p pkglist res)
(let ((face (cdr (assoc (helm-system-packages-extract-name p) helm-system-packages--display-lists))))
(cond
((and (not face) helm-system-packages--show-uninstalled-p)
(push p res))
((or
(and helm-system-packages--show-explicit-p (memq 'helm-system-packages-explicit face))
(and helm-system-packages--show-dependencies-p (memq 'helm-system-packages-dependencies face))
; ...
(push (propertize p 'face (car face)) res))))))))
The issue here is that candidate-number-limit
is used before the transformer does its filtering, thus the filtered result length cannot be updated according to the candidate limit.
Pierre Neidhardt [email protected] writes:
Well, the original helm-gentoo and helm-apt had the same issue if I'm not mistaken.
I'm not using filtered-candidate-transformer nor helm-force-update.
- filtered-candidate-transformer: I don't think that's approprioate. From the doc: "While ‘candidate-transformer’ is run only once, it is run every time the input pattern is changed."
Yes, but also it recompute candidates up to limit, have a try (use same function but add _source as second arg).
-- Thierry
Tried your suggestion and it made no difference. Maybe because it's a buffer source?