I did the following instead (a bit more extensible):

(defcustom jdex-gen-buffer-boilerplate-subsitutes nil
 "*List of subsitutes to place into `jde-gen-buffer-boilerplate' when
`jdex-gen-create-dynamic-buffer-boilerplate' is run"
 :group 'jdex-gen
 :type '(repeat (string :tag "Substitute")))

(defun jdex-gen-create-dynamic-buffer-boilerplate ()
 "For each element in `jdex-gen-buffer-boilerplate-subsitutes',
replace %n in `jde-gen-buffer-boilerplate' where n is 1 through the
number of elements."
 (let ((bp (jde-gen-create-buffer-boilerplate))
       (n (length jdex-gen-buffer-boilerplate-subsitutes))
       (i 0))
   (while (< i n)
     (setq bp (replace-regexp-in-string (concat "%" (int-to-string i))
               (elt jdex-gen-buffer-boilerplate-subsitutes i)
               bp))
     (setq i (1+ i)))
   bp))


The only part that I haven't gotten to work is using jde-project-name in the list of substitutes instead of duplicating the project name as a string literal, i.e. having the following in my prj.el


(jde-set-variables
'(jde-project-name "logui")
'(jdex-gen-buffer-boilerplate-substitutes (quote ("logui")))
)

Anyway, if you think the code is useful, please feal free to add it to jde- gen.el

-- Josh

On Fri, 8 Aug 2003 16:11:24 -0400, Paul Kinnucan <[EMAIL PROTECTED]> wrote:

Joshua Spiewak writes:
> Is there a way to (easily) make the boilerplate (a little) dynamic? The > particular circumstance I am thinking of is that I would like to define a > boilerplate using the LGPL in my .emacs, and have each prj.el for my > projects only define the project name and to have the boilerplate template > insert the project name in the three appropriate places in the license. > Currently, I have to customize the boilerplate for each project, the only > difference being the project name.
> > Thanks!
>
Here's one way to do it:


1. Put the following in your .emacs file.


(defvar my-boilerplate-template () "Defines boilerplate text that has one occurrence of variable text indicated by %s." "Boilerplate for project %s ...")

(defcustom jde-my-boilerplate-variable-text "Default text"
"Defines text that occurs at %s in my-boilerplate-template."
:group 'jde-gen
:type 'string)

(defun gen-my-boilerplate ()
"This function substitutes jde-my-boilerplate-variable-text
where %s occurs in my-boilerplate-template." (format my-boilerplate- template jde-my-boilerplate-variable-text))


2. Open a project that you want to use your boilerplate text.

3. Customize jde-gen-boilerplate-function to be gen-my-boilerplate
and set for current session.

3. Customize jde-my-boilerplate-variable-text to be the variable text for the project and set for current session.

4. Execute save project file for the project.

This saves the settings of jde-variables in the project file,
including jde-gen-boilerplate-function and jde-my-boilerplate-variable- text.


5. Repeat 2-4 for other projects in which you want to use
my-boilerplate-text.

Paul







-- Joshua Spiewak Ivy Ventures, LLC Phone: 781.793.0204 Mobile: 617.308.5674 Fax: 347.710.4095




Reply via email to