From f75c2b5aa5ecb0ae759b7a2a7e4797b780e754a4 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Thu, 21 May 2015 00:46:06 -0400 Subject: [PATCH] Add support for extensions in helm-spacemacs --- .../helm-spacemacs/helm-spacemacs.el | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/spacemacs/extensions/helm-spacemacs/helm-spacemacs.el b/spacemacs/extensions/helm-spacemacs/helm-spacemacs.el index bcbfe3c44..c7a7f9267 100644 --- a/spacemacs/extensions/helm-spacemacs/helm-spacemacs.el +++ b/spacemacs/extensions/helm-spacemacs/helm-spacemacs.el @@ -36,6 +36,12 @@ (defvar helm-spacemacs-all-packages '() "Hash table of all packages in all layers.") +(defvar helm-spacemacs-all-pre-extensions '() + "Hash table of all pre-extensions in all layers.") + +(defvar helm-spacemacs-all-post-extensions '() + "Hash table of all post-extensions in all layers.") + ;;;###autoload (define-minor-mode helm-spacemacs-mode "Layers discovery with helm interface." @@ -53,7 +59,11 @@ (configuration-layer//load-layer-files layer '("funcs.el" "config.el")))) (setq helm-spacemacs-all-packages (configuration-layer/get-packages - helm-spacemacs-all-layers))))) + helm-spacemacs-all-layers)) + (setq helm-spacemacs-all-pre-extensions + (configuration-layer/get-extensions helm-spacemacs-all-layers t)) + (setq helm-spacemacs-all-post-extensions + (configuration-layer/get-extensions helm-spacemacs-all-layers))))) ;;;###autoload (defun helm-spacemacs () @@ -86,8 +96,14 @@ "Return the sorted candidates for package source." (let (result) (ht-aeach (dolist (layer value) - (push (format "(%s) %s" layer key) result)) + (push (format "(%s) package: %s" layer key) result)) helm-spacemacs-all-packages) + (ht-aeach (dolist (layer value) + (push (format "(%s) pre-extension: %s" layer key) result)) + helm-spacemacs-all-pre-extensions) + (ht-aeach (dolist (layer value) + (push (format "(%s) post-extension: %s" layer key) result)) + helm-spacemacs-all-post-extensions) (sort result 'string<))) (defun helm-spacemacs//toggle-source () @@ -154,13 +170,16 @@ (defun helm-spacemacs//package-action-goto-init-func (candidate) "Open the file `packages.el' and go to the init function." (save-match-data - (string-match "^(\\(.+\\))\s\\(.+\\)$" candidate) + (string-match "^(\\(.+\\))\s\\(.+\\):\s\\(.+\\)$" candidate) (let* ((layer (match-string 1 candidate)) - (package (match-string 2 candidate)) + (type (match-string 2 candidate)) + (package (match-string 3 candidate)) (path (file-name-as-directory (concat (ht-get configuration-layer-paths (intern layer)) layer))) - (filename (concat path "packages.el"))) + (filename (cond ((string-equal "package" type) + (concat path "packages.el")) + (t (concat path "extensions.el"))))) (find-file filename) (goto-char (point-min)) (re-search-forward (format "init-%s" package))