[Emacs] Update imalison:use-package to do git clones

This commit is contained in:
Ivan Malison 2017-04-17 23:25:44 -07:00
parent a99f0b044b
commit fad0231afe
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -384,21 +384,26 @@ Works in the same way as os.path.join in python
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(put 'imalison:use-package 'lisp-indent-function 'defun) (put 'imalison:use-package 'lisp-indent-function 'defun)
(put 'imalison:use-package* 'lisp-indent-function 'defun) (put 'imalison:use-package* 'lisp-indent-function 'defun)
(put 'imalison:use-package** 'lisp-indent-function 'defun)
(defmacro imalison:use-package* (package target-directory &rest forms) (defmacro imalison:use-package* (package target-github-name &rest forms)
(let* ((actual-target (if (file-exists-p target-directory) (let* ((clone-url
target-directory (format "git@github.com:IvanMalison/%s" target-github-name))
(let ((in-projects (imalison:join-paths imalison:projects-directory (target-directory
target-directory))) (imalison:join-paths imalison:projects-directory target-github-name)))
(when (file-exists-p in-projects) `(imalison:use-package** ,package ,target-directory ,clone-url ,@forms)))
in-projects))))
(additional-forms (defmacro imalison:use-package** (package target-directory target-clone-url &rest forms)
(when actual-target `(progn
(list (or (file-exists-p ,target-directory)
:load-path actual-target (equal (call-process
:ensure nil)))) (executable-find "git")
`(use-package ,package nil nil nil "clone" ,target-clone-url ,target-directory) 0))
,@additional-forms ,@forms))) (use-package ,package
:load-path ,target-directory
:ensure nil
:preface
,@forms)))
(defmacro imalison:use-package (package &rest forms) (defmacro imalison:use-package (package &rest forms)
`(imalison:use-package* ,package ,(symbol-name package) ,@forms)) `(imalison:use-package* ,package ,(symbol-name package) ,@forms))
@ -419,7 +424,7 @@ but provide support for writing custom elisp.
#+END_SRC #+END_SRC
*** gh *** gh
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(imalison:use-package* gh "gh.el" (imalison:use-package** gh "gh.el" "git@github.com:sigma/gh.el.git"
:demand t) :demand t)
#+END_SRC #+END_SRC
*** shut-up *** shut-up