summaryrefslogtreecommitdiff
path: root/helm-apt.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2015-07-09 06:02:50 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2015-07-09 06:02:50 +0200
commit72c8d68096105250d5a0642c2a6259bb4a8c8e49 (patch)
treea41b37c5c890b790535f862f3aa96be2387998b3 /helm-apt.el
parenta1feb07f8a7491474cc213771bdc931fdd4b6f42 (diff)
Use helm-source to build apt source and allow customizing actions.
(helm-apt-actions): New user var.
Diffstat (limited to 'helm-apt.el')
-rw-r--r--helm-apt.el36
1 files changed, 20 insertions, 16 deletions
diff --git a/helm-apt.el b/helm-apt.el
index b667c5b3..f99d0f8a 100644
--- a/helm-apt.el
+++ b/helm-apt.el
@@ -40,6 +40,16 @@ If nil default `helm-apt-cache-show-1' will be used."
:type 'function
:group 'helm-apt)
+(defcustom helm-apt-actions
+ '(("Show package description" . helm-apt-cache-show)
+ ("Install package" . helm-apt-install)
+ ("Reinstall package" . helm-apt-reinstall)
+ ("Remove package" . helm-apt-uninstall)
+ ("Purge package" . helm-apt-purge))
+ "Actions for helm apt."
+ :group 'helm-apt
+ :type '(alist :key-type string :value-type function))
+
(defface helm-apt-installed
'((t (:foreground "green")))
"Face used for apt installed candidates."
@@ -63,22 +73,16 @@ If nil default `helm-apt-cache-show-1' will be used."
(defvar helm-source-apt
- `((name . "APT")
- (init . helm-apt-init)
- (candidates-in-buffer)
- (candidate-transformer . helm-apt-candidate-transformer)
- (display-to-real . helm-apt-display-to-real)
- (update . helm-apt-refresh)
- (keymap . ,helm-apt-map)
- (mode-line . helm-apt-mode-line)
- (action
- ("Show package description" . helm-apt-cache-show)
- ("Install package" . helm-apt-install)
- ("Reinstall package" . helm-apt-reinstall)
- ("Remove package" . helm-apt-uninstall)
- ("Purge package" . helm-apt-purge))
- (persistent-action . helm-apt-persistent-action)
- (persistent-help . "Show package description")))
+ (helm-build-in-buffer-source "APT"
+ :init #'helm-apt-init
+ :candidate-transformer #'helm-apt-candidate-transformer
+ :display-to-real #'helm-apt-display-to-real
+ :update #'helm-apt-refresh
+ :keymap helm-apt-map
+ :mode-line helm-apt-mode-line
+ :action 'helm-apt-actions
+ :persistent-action #'helm-apt-persistent-action
+ :persistent-help "Show package description"))
;;; Internals vars
(defvar helm-apt-search-command "apt-cache search '%s'")