[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master aedea1a 289/348: counsel.el (counsel-package): Add func to
From: |
Oleh Krehel |
Subject: |
[elpa] master aedea1a 289/348: counsel.el (counsel-package): Add func to manage packages. |
Date: |
Sat, 8 Apr 2017 11:04:16 -0400 (EDT) |
branch: master
commit aedea1a44fdf2505f8c8c81127bd911486795219
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>
counsel.el (counsel-package): Add func to manage packages.
Allows installing, deleting, describing, and more to come...
counsel.el (counsel--package-sort): Add
counsel.el (counsel--describe-package): Add
---
counsel.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/counsel.el b/counsel.el
index 9f8a287..6f9ffbb 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2193,6 +2193,67 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
:action (lambda (elem)
(goto-char (cdr elem))))))
+;;** `counsel-package'
+(defun counsel-package ()
+ "Install or delete packages.
+
+Packages not currently installed have a \"+\"
+prepended. Selecting one of these will try to install
+it. Currently installed packages have a \"-\" prepended, and
+selecting one of these will delete the package.
+
+Additional Actions:
+
+ \\<ivy-minibuffer-map>\\[ivy-dispatching-done] d: describe package"
+ (interactive)
+ (unless package--initialized
+ (package-initialize t))
+ (unless package-archive-contents
+ (package-refresh-contents))
+ (ivy-read "Packages (install +pkg or delete -pkg): "
+ (mapcar (lambda (pkg)
+ (let* ((pkg (car pkg))
+ (pkg-name (symbol-name pkg)))
+ (if (package-installed-p pkg)
+ (cons
+ (format "-%s" pkg-name)
+ pkg-name)
+ (cons pkg-name pkg-name)
+ (cons
+ (format "+%s" pkg-name)
+ pkg-name))))
+ package-archive-contents)
+ :action (lambda (pkg-cons)
+ (if (equal (car pkg-cons) "+")
+ (package-install (cdr pkg-cons))
+ (package-delete (cdr pkg-cons))))
+ :initial-input "^+"
+ :require-match t
+ :sort t
+ :caller 'counsel-package))
+
+(defun counsel--package-sort (a b)
+ "Sort function for `counsel-package'."
+ (let* ((a (car a))
+ (b (car b))
+ (a-inst (equal (substring a 0 1) "+"))
+ (b-inst (equal (substring b 0 1) "+")))
+ (or (and a-inst (not b-inst))
+ (and (eq a-inst b-inst) (string-lessp a b)))))
+
+(push '(counsel-package . counsel--package-sort)
+ ivy-sort-functions-alist)
+
+(defun counsel--describe-package (pkg-cons)
+ "Call `describe-package'."
+ (message "%s" pkg-cons)
+ (describe-package (intern (cdr pkg-cons))))
+
+(ivy-set-actions 'counsel-package
+ ;; Ideas for more:
+ ;; 1. Jump to package homepage
+ '(("d" counsel--describe-package "describe package")))
+
;;** `counsel-tmm'
(defvar tmm-km-list nil)
(declare-function tmm-get-keymap "tmm")
- [elpa] master 80d3fe3 310/348: Fix compilation warnings, (continued)
- [elpa] master 80d3fe3 310/348: Fix compilation warnings, Oleh Krehel, 2017/04/08
- [elpa] master b0ccc7a 312/348: README.md: Recommend enable-recursive-minibuffers, Oleh Krehel, 2017/04/08
- [elpa] master 1ac1cc1 316/348: ivy.el (ivy-completing-read): Don't require-match for null, Oleh Krehel, 2017/04/08
- [elpa] master 7ca301b 334/348: swiper.el (swiper-goto-start-of-match) New defcustom, Oleh Krehel, 2017/04/08
- [elpa] master fc2e198 335/348: swiper.el (swiper--action): Set evil search direction to forward, Oleh Krehel, 2017/04/08
- [elpa] master 718a06b 345/348: doc/Changelog.org: Fix links, Oleh Krehel, 2017/04/08
- [elpa] master 802c9da 271/348: counsel.el: Add counsel-command-history, Oleh Krehel, 2017/04/08
- [elpa] master ee91a25 283/348: ivy.el (ivy--sort-maybe): Fix byte-compiler warning, Oleh Krehel, 2017/04/08
- [elpa] master dc693c3 280/348: Make ivy--flx-sort more intelligent, Oleh Krehel, 2017/04/08
- [elpa] master 182e35e 298/348: Apply search highlighting for evil when applicable, Oleh Krehel, 2017/04/08
- [elpa] master aedea1a 289/348: counsel.el (counsel-package): Add func to manage packages.,
Oleh Krehel <=
- [elpa] master b9c52be 301/348: counsel.el (counsel-git): Add "x" action, Oleh Krehel, 2017/04/08
- [elpa] master dbeb5b1 303/348: Ensure counsel-M-x preserves last-command, Oleh Krehel, 2017/04/08
- [elpa] master ae3ca26 117/348: counsel.el (counsel-locate-action-extern): Add w32 support, Oleh Krehel, 2017/04/08
- [elpa] master 3e651a3 116/348: Make swiper-all use point positions instead of line positions, Oleh Krehel, 2017/04/08
- [elpa] master ef3f010 128/348: ivy.el (ivy--insert-prompt): Improve the extra "\n" logic, Oleh Krehel, 2017/04/08
- [elpa] master 870112e 176/348: counsel.el (counsel-ag-function): Use sync on remote, Oleh Krehel, 2017/04/08
- [elpa] master 1914ecd 203/348: counsel.el (counsel-recoll-function): Add shell-quote-argument, Oleh Krehel, 2017/04/08
- [elpa] master f0e49d5 213/348: Improve recursive minibuffers with two emacsclients, Oleh Krehel, 2017/04/08
- [elpa] master df9ad89 220/348: counsel.el (counsel-rpm): New command, Oleh Krehel, 2017/04/08
- [elpa] master aea4919 225/348: Shrink ivy back to ivy-height after dispatching actions., Oleh Krehel, 2017/04/08