diff options
author | Alex Whitt | 2017-05-25 19:00:29 -0400 |
---|---|---|
committer | Alex Whitt | 2017-05-25 19:00:29 -0400 |
commit | baa4928d5a0a045931cfba76a5a40590269229be (patch) | |
tree | 60ab5085c5a458a8e18cb3d781f028c20f216db6 /spacemacs-funcs.el | |
parent | f6b2f4a71f39bf3cb1e07d3eabfb67ecac8ff386 (diff) | |
download | aur-baa4928d5a0a045931cfba76a5a40590269229be.tar.gz |
Adding feature to selectively load functions based on their layers. Still WIP as I'm super green with elisp.
Diffstat (limited to 'spacemacs-funcs.el')
-rw-r--r-- | spacemacs-funcs.el | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/spacemacs-funcs.el b/spacemacs-funcs.el index 3537feb5a3f0..dd067f7fe5a0 100644 --- a/spacemacs-funcs.el +++ b/spacemacs-funcs.el @@ -1,13 +1,51 @@ ;;; spacemacs-funcs --- Reusable functions from Spacemacs +;; Copyright (C) 2017 Alex Whitt + +;; Author: Alex Whitt <alex.joseph.whitt@gmail.com +;; Version: 0.2 + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;; -;; This file simply ncludes all *funcs.el files in the Spacemacs project. -;; This is a rough operation and makes little effort to sanitize what is imported. -;; That may happen someday but for now I just wanted to be able to grab -;; some of the utility functions that community has assembled. +;; Loads the funcs.el files from Spacemacs in a somewhat customizable way. +;; Simply add the names of the Spacemacs layers you want to pull utility +;; functions from in spacemacs-funcs-enabled-layers. ;;; Code: -(mapc 'load (file-expand-wildcards "**/*funcs*.elc")) +(mapc 'load (file-expand-wildcards "/usr/share/emacs/site-lisp/spacemacs-funcs/core*funcs.elc")) + +(setq debug-on-error nil) + +(defgroup spacemacs-funcs nil + "Spacemacs utility functions" + :group 'spacemacs-funcs + :prefix "spacemacs-funcs-") + +(defcustom spacemacs-funcs-enabled-layers nil + "A list of Spacemacs layers from which to import utility functions." + :type '(repeat string) + :group 'spacemacs-funcs) + +(defun spacemacs-funcs-load-layers () + "Load layers specified in spacemacs-funcs-enabled-layers." + (dolist (file-string (file-expand-wildcards "/usr/share/emacs/site-lisp/spacemacs-funcs/layers*" t)) + (if (and (string-match "layers_.*_\\([[:alnum:]-]+\\)_funcs.elc" file-string) + (member (match-string 1) spacemacs-funcs-enabled-layers)) + (message "match: %s %s %s" file-string (match-string 1 file-string) spacemacs-funcs-enabled-layers) + (sit-for 1) + )));(load file-string)))) + (provide 'spacemacs-funcs) |