Skip to content

Commit

Permalink
brew: Remove unused variables and replace 'push by 'add-to-list
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambrevar committed Apr 12, 2018
1 parent 23d0146 commit 3e3a23b
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions helm-system-packages-brew.el
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ If nil, then use `helm-system-packages-column-width'."
(let (names descriptions)
(setq descriptions
(with-temp-buffer
(let ((format-string (format "%%-%dn %%d" helm-system-packages-column-width)))
(call-process "brew" nil '(t nil) nil "desc" "-s" "" )
(buffer-string))))
(call-process "brew" nil '(t nil) nil "desc" "-s" "")
(buffer-string)))
(setq names
(replace-regexp-in-string ":.*" "" descriptions))
(setq descriptions
Expand Down Expand Up @@ -101,7 +100,6 @@ Otherwise display in `helm-system-packages-buffer'."
desc-list
pkg-desc-alist
str
pkg
(i 0))
(dolist (pkg (helm-marked-candidates))
(setq pkg-desc-alist (aref descriptions i))
Expand All @@ -118,17 +116,20 @@ Otherwise display in `helm-system-packages-buffer'."
(alist-get 'options pkg-desc-alist) "\n")
"\n\n"
"* Caveats: " (alist-get 'caveats pkg-desc-alist) "\n"))
(add-to-list 'desc-list `(uninstalled (,pkg . ,str)))
(push `(uninstalled (,pkg . ,str)) 'desc-list)
(setq i (1+ i)))
(helm-system-packages-show-information desc-list)))

(defun helm-system-packages-brew-browse-url (_candidate)
(let* ((descriptions (json-read-from-string (with-temp-buffer
(apply 'call-process "brew" nil t nil "info" "--json=v1" (helm-marked-candidates))
(buffer-string)))))
(helm-system-packages-browse-url (mapcar (lambda (pkg)
(alist-get 'homepage pkg))
descriptions))))
(let ((descriptions
(json-read-from-string
(with-temp-buffer
(apply 'call-process "brew" nil t nil "info" "--json=v1" (helm-marked-candidates))
(buffer-string)))))
(helm-system-packages-browse-url
(mapcar (lambda (pkg)
(alist-get 'homepage pkg))
descriptions))))

(defun helm-system-packages-brew-link-app (_candidate)
(helm-system-packages-brew-run "brew" "link"))
Expand Down

0 comments on commit 3e3a23b

Please sign in to comment.