Add support for extensions in helm-spacemacs
This commit is contained in:
parent
e3f2bfd639
commit
f75c2b5aa5
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue