Clean up and generalize imalison:use-package*
This commit is contained in:
parent
549ff89522
commit
6e5f74c5bb
@ -250,22 +250,22 @@ Works in the same way as os.path.join in python
|
|||||||
(put 'imalison:use-package 'lisp-indent-function 1)
|
(put 'imalison:use-package 'lisp-indent-function 1)
|
||||||
|
|
||||||
(defmacro imalison:use-package* (package target-directory &rest forms)
|
(defmacro imalison:use-package* (package target-directory &rest forms)
|
||||||
(let* ((target-exists (file-exists-p target-directory))
|
(let* ((actual-target (if (file-exists-p target-directory)
|
||||||
|
target-directory
|
||||||
|
(let ((in-projects (imalison:join-paths imalison:projects-directory
|
||||||
|
target-directory)))
|
||||||
|
(when (file-exists-p in-projects)
|
||||||
|
in-projects))))
|
||||||
(additional-forms
|
(additional-forms
|
||||||
(when target-exists
|
(when actual-target
|
||||||
(list
|
(list
|
||||||
:load-path target-directory
|
:load-path actual-target
|
||||||
:ensure nil))))
|
:ensure nil))))
|
||||||
`(use-package ,package
|
`(use-package ,package
|
||||||
,@additional-forms ,@forms)))
|
,@additional-forms ,@forms)))
|
||||||
|
|
||||||
(defmacro imalison:use-package (package &rest forms)
|
(defmacro imalison:use-package (package &rest forms)
|
||||||
(let ((target-directory
|
`(imalison:use-package* ,package ,(symbol-name package) ,@forms))
|
||||||
(concat (file-name-as-directory (if (boundp 'imalison:projects-directory)
|
|
||||||
imalison:projects-directory
|
|
||||||
"~/Projects"))
|
|
||||||
(symbol-name package))))
|
|
||||||
`(imalison:use-package* ,package ,target-directory ,@forms)))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Required Packages
|
** Required Packages
|
||||||
The packages in this section provide no functionality on their own,
|
The packages in this section provide no functionality on their own,
|
||||||
@ -283,7 +283,7 @@ but provide support for writing custom elisp.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** gh
|
*** gh
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package gh
|
(imalison:use-package* gh "gh.el"
|
||||||
:demand t)
|
:demand t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** shut-up
|
*** shut-up
|
||||||
|
Loading…
Reference in New Issue
Block a user