Skip to content

Commit

Permalink
(ede-proj-target-elisp): Add pre-load-packages slot.
Browse files Browse the repository at this point in the history
(ede-emacs-preload-compiler): New.
(ede-proj-makefile-insert-preload-items): New.
(ede-proj-target-elisp::ede-proj-makefile-insert-variables):
Create ELISPPRELOAD variable.
  • Loading branch information
zappo committed Oct 1, 2009
1 parent 8eb0251 commit 2fe5385
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions ede/ede-proj-elisp.el
Expand Up @@ -4,7 +4,7 @@

;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Keywords: project, make
;; RCS: $Id: ede-proj-elisp.el,v 1.38 2009/08/08 21:43:19 zappo Exp $
;; RCS: $Id: ede-proj-elisp.el,v 1.39 2009/10/01 00:30:30 zappo Exp $

;; This software is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -35,7 +35,9 @@
(keybindings :initform nil)
(phony :initform t)
(sourcetype :initform (ede-source-emacs))
(availablecompilers :initform (ede-emacs-compiler ede-xemacs-compiler))
(availablecompilers :initform (ede-emacs-compiler
ede-xemacs-compiler
ede-emacs-preload-compiler))
(aux-packages :initarg :aux-packages
:initform nil
:type list
Expand All @@ -44,7 +46,15 @@
There should only be one toplevel package per auxiliary tool needed.
These packages location is found, and added to the compile time
load path."
))
)
(pre-load-packages :initarg :pre-load-packages
:initform nil
:type list
:custom (repeat string)
:documentation "Additional packages to pre-load.
Each package name will be loaded with `require'.
Each package's directory should also appear in :aux-packages via a package name.")
)
"This target consists of a group of lisp files.
A lisp target may be one general program with many separate lisp files in it.")

Expand Down Expand Up @@ -75,6 +85,23 @@ A lisp target may be one general program with many separate lisp files in it.")
)
"Compile Emacs Lisp programs.")

(defvar ede-emacs-preload-compiler
(clone
ede-emacs-compiler "ede-emacs-preload-compiler"
:commands
'("@echo \"(add-to-list 'load-path nil)\" > $@-compile-script"
"for loadpath in . ${LOADPATH}; do \\"
" echo \"(add-to-list 'load-path \\\"$$loadpath\\\")\" >> $@-compile-script; \\"
"done;"
"for preload in ${ELISPPRELOAD}; do \\"
" echo \"(load \\\"$$preload\\\")\" >> $@-compile-script; \\"
"done;"
"@echo \"(setq debug-on-error t)\" >> $@-compile-script"
"\"$(EMACS)\" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^"
))
"Compile Emacs Lisp programs with preload libraries.")


(defvar ede-xemacs-compiler
(clone ede-emacs-compiler "ede-xemacs-compiler"
:name "xemacs"
Expand Down Expand Up @@ -186,13 +213,30 @@ is found, such as a `-version' variable, or the standard header."
(setq items (cdr items)))))
))

(defun ede-proj-makefile-insert-preload-items (items)
"Insert a sequence of ITEMS into the Makefile ELISPPRELOAD variable."
(when items
(ede-pmake-insert-variable-shared "ELISPPRELOAD"
(let ((begin (save-excursion (re-search-backward "\\s-*="))))
(while items
(when (not (save-excursion
(re-search-backward
(concat "\\s-" (regexp-quote (car items)) "[ \n\t\\]")
begin t)))
(insert " " (car items)))
(setq items (cdr items)))))
))

(defmethod ede-proj-makefile-insert-variables :AFTER ((this ede-proj-target-elisp))
"Insert variables needed by target THIS."
(let ((newitems (if (oref this aux-packages)
(ede-proj-elisp-packages-to-loadpath
(oref this aux-packages))))
(newpreload (oref this pre-load-packages))
)
(ede-proj-makefile-insert-loadpath-items newitems)))
(ede-proj-makefile-insert-loadpath-items newitems)
(when newpreload
(ede-proj-makefile-insert-preload-items newpreload))))

(defun ede-proj-elisp-add-path (path)
"Add path PATH into the file if it isn't already there."
Expand Down

0 comments on commit 2fe5385

Please sign in to comment.