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 | |
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.
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 18 | ||||
-rw-r--r-- | spacemacs-funcs.el | 48 |
3 files changed, 54 insertions, 18 deletions
@@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Fri May 19 20:19:02 UTC 2017 +# Thu May 25 22:59:33 UTC 2017 pkgbase = emacs-spacemacs-funcs pkgdesc = Useful functions from the Spacemacs project pkgver = 0.200.9 - pkgrel = 1 + pkgrel = 2 url = https://github.com/syl20bnr/spacemacs install = emacs-spacemacs-funcs.install arch = any @@ -11,7 +11,7 @@ pkgbase = emacs-spacemacs-funcs depends = emacs source = spacemacs-funcs.el source = emacs-spacemacs-funcs-0.200.9.tar.gz::https://github.com/syl20bnr/spacemacs/archive/v0.200.9.tar.gz - sha256sums = 6e9f59ad05e6c1a96d3efc268a39999e95956480c4f42a122a305633e0b60837 + sha256sums = eb0382f22b73e3be609ac585dd24ef3a5ecb317067d13f7f06d85ec7887779a2 sha256sums = 81e8fc56421e00405cba2d78f8b5e14b1d9e8e23803dcf43eb8e89b72273ea1b pkgname = emacs-spacemacs-funcs @@ -5,7 +5,7 @@ _pkgmaintainer=syl20bnr _pkgdestdirname=spacemacs-funcs _versionprefix=v pkgver=0.200.9 -pkgrel=1 +pkgrel=2 pkgdesc="Useful functions from the Spacemacs project" pkgname=emacs-${_pkgdestdirname} arch=(any) @@ -14,7 +14,7 @@ license=('GPL3') depends=('emacs') source=("spacemacs-funcs.el" "$pkgname-$pkgver.tar.gz::https://github.com/${_pkgmaintainer}/${_pkgsrcname}/archive/${_versionprefix}${pkgver}.tar.gz") -sha256sums=('6e9f59ad05e6c1a96d3efc268a39999e95956480c4f42a122a305633e0b60837' +sha256sums=('eb0382f22b73e3be609ac585dd24ef3a5ecb317067d13f7f06d85ec7887779a2' '81e8fc56421e00405cba2d78f8b5e14b1d9e8e23803dcf43eb8e89b72273ea1b') install=${pkgname}.install @@ -24,20 +24,18 @@ build() { cd "${srcdir}/${_pkgsrcname}-${pkgver}" shopt -s globstar shopt -s extglob - emacs -q --no-splash -batch -L . -f batch-byte-compile core/**/*funcs*.el - emacs -q --no-splash -batch -L . -f batch-byte-compile layers/**/*funcs*.el + emacs -q --no-splash -batch -L . -f batch-byte-compile {core,layers}/**/*funcs*.el } package() { - mkdir -p "${pkgdir}/usr/share/emacs/site-lisp/${_pkgdestdirname}/" + export dest="${pkgdir}/usr/share/emacs/site-lisp/${_pkgdestdirname}/" - cp spacemacs-funcs.el{c,} "${pkgdir}/usr/share/emacs/site-lisp/${_pkgdestdirname}/" + mkdir -p $dest + + install -m644 spacemacs-funcs.el{c,} $dest cd "${srcdir}/${_pkgsrcname}-${pkgver}" shopt -s globstar shopt -s extglob - cp --parents core/**/*funcs*.el{c,} "${pkgdir}/usr/share/emacs/site-lisp/${_pkgdestdirname}/" - cp --parents layers/**/*funcs*.el{c,} "${pkgdir}/usr/share/emacs/site-lisp/${_pkgdestdirname}/" - - find "${pkgdir}/usr/share/emacs/site-lisp/${_pkgdestdirname}/" -type f -exec chmod 644 -- {} + + find {core,layers}/ -name *funcs.el* -exec bash -c 'file=${1#./}; install -m644 "$file" "$dest${file//\//_}"' _ '{}' \; } 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) |