emacs-helm / helm-system-packages

A Helm interface to the package manager of your operating system
GNU General Public License v3.0
106 stars 11 forks source link

dpkg filters seem broken #21

Closed thierryvolpiatto closed 6 years ago

thierryvolpiatto commented 6 years ago

Installed packages are no more colorized. Commands M-I have no effect, hitting M-N end up with an empty buffer and next calls to helm-system-packages remain with an empty buffer until emacs is restarted.

Ambrevar commented 6 years ago

I've pushed f024974a7d41cbc3841376cb531dd34ad792c5be which should fix this. Let me know if it works (I can't test as I don't have access to dpkg).

thierryvolpiatto commented 6 years ago

Pierre Neidhardt notifications@github.com writes:

I've pushed f024974 which should fix this. Let me know if it works (I can't test as I don't have access to dpkg).

Colors are now working if I don't use filters (M-I/N etc..) as soon as I hit one of those filters command, I have color in some places but not all and sometimes an empty buffer (hard to tell how to reproduce for now).

Also many warnings at compile time:

In helm-system-packages-brew-transformer: helm-system-packages-brew.el:42:69:Warning: reference to free variable ‘helm-system-packages--display-lists’

In helm-system-packages-brew-refresh: helm-system-packages-brew.el:82:9:Warning: assignment to free variable ‘helm-system-packages--source-name’ helm-system-packages-brew.el:87:11:Warning: assignment to free variable ‘helm-system-packages--names’ helm-system-packages-brew.el:88:11:Warning: assignment to free variable ‘helm-system-packages--descriptions’ helm-system-packages-brew.el:89:9:Warning: assignment to free variable ‘helm-system-packages--display-lists’ helm-system-packages-brew.el:140:1:Warning: Unused lexical variable ‘eshell-buffer-name’

In end of data: helm-system-packages-brew.el:201:1:Warning: the following functions are not known to be defined: (setf quote), eshell-interactive-process, eshell-send-input

In toplevel form: helm-system-packages-guix.el:179:1:Warning: Unused lexical variable ‘eshell-buffer-name’

In end of data: helm-system-packages-guix.el:324:1:Warning: the following functions are not known to be defined: eshell-interactive-process, eshell-send-input

In helm-system-packages-files: helm-system-packages.el:453:15:Warning: ‘helm-system-packages-run’ is an obsolete function (as of 1.9.0); use ‘helm-system-packages-call’ instead.

-- Thierry

Ambrevar commented 6 years ago

I know about those warnings, but they are unrelated: they only blame brew but I don't have a macOS to fix them. The other warnings are benign.

I can't reproduce the issue with M-I on GuixSD. It must be dpkg-specific. Nothing obvious comes up from a glance at the code. Could you try investigating a bit more? The state of dpkg is somewhat lagging behind, sadly.

thierryvolpiatto commented 6 years ago

Pierre Neidhardt notifications@github.com writes:

I know about those warnings, but they are unrelated: they only blame brew but I don't have a macOS to fix them. The other warnings are benign.

I can't reproduce the issue with M-I on GuixSD. It must be dpkg-specific.

Ok, it seems to work now, perhaps I did something wrong when reinstalling.

Could you try investigating a bit more?

I looked at the code, seems you can improve the readability of your code using something like this (at least for cond if you want to keep using dolist):

(defun helm-system-packages-dpkg-transformer (packages)
  (cl-loop for p in packages
           for face = (cadr (assoc (helm-system-packages-extract-name p)
                                   (plist-get
                                    (helm-system-packages--cache-get)
                                    :display)))
           for disp = (cond ((or
                              (and helm-system-packages-dpkg--show-explicit-p
                                   (eq 'helm-system-packages-explicit face))
                              (and helm-system-packages-dpkg--show-dependencies-p
                                   (eq 'helm-system-packages-dependencies face))
                              (and helm-system-packages-dpkg--show-residuals-p
                                   (eq 'helm-system-packages-residuals face)))
                             (propertize p 'face face))
                            (helm-system-packages-dpkg--show-uninstalled-p p))
           when disp collect disp))

Thanks.

-- Thierry

Ambrevar commented 6 years ago

Good.

The code isn't great at the moment mostly because it lacks structure. All the code involving the cache would need a significant overhaul.

I had postponed the use of structures because I wanted to finish guix support first. (Because it is different from other package managers and I wanted to make sure I would not sacrifice generality with structures.) Now I need to set up some virtual machines. Besides I'm not sure how to test brew support.