Add another GPL banner to accomodate wide program names.
[skel] / skelrc
CommitLineData
7fb0878b 1;;; -*-emacs-lisp-*-
2
3(defun skelrc-banner (title &optional block)
4 (let* ((start (skel-lookup 'block-start))
5 (end (skel-lookup (if block 'block-banner-knob 'block-banner-end)))
6 (barlen (- 77 (length (concat start end " ----- " title)))))
7 (concat start "----- " title " " (make-string barlen ?-) end)))
8
9(defvar skelrc-forced-major-mode 0)
10
11(defun skelrc-force-mode (new-mode &optional priority)
12 (or priority (setq priority 1))
13 (if (> priority skelrc-forced-major-mode)
14 (progn
15 (or (eq new-mode major-mode)
16 (let ((old-skel-alist skel-alist))
17 (funcall new-mode)
18 (make-variable-buffer-local 'skel-alist)
19 (setq skel-alist old-skel-alist)))
20 (make-variable-buffer-local 'skelrc-forced-major-mode)
21 (setq skelrc-forced-major-mode priority))))
22
23(defun skelrc-decode-major-mode ()
24 (let* ((name (symbol-name major-mode))
25 (endind (string-match "-mode$" name)))
26 (if endind (substring name 0 endind)
27 (name))))
28
441c920b 29(defun skelrc-assq (key list)
30 (let ((val (assq key list)))
31 (and val (cdr val))))
32
33(defun skelrc-component ()
34 (if (assq 'full-title skel-alist)
7fb0878b 35"[[cont-comment]] This file is part of [[full-title]].
441c920b 36[[cont-comment]]\n"
37 ""))
38
39(setq skelrc-gpl
40"[[cont-comment]] [[Program-name]] is free software; you can redistribute it and/or modify
7fb0878b 41[[cont-comment]] it under the terms of the GNU General Public License as published by
42[[cont-comment]] the Free Software Foundation; either version 2 of the License, or
43[[cont-comment]] (at your option) any later version.
44[[cont-comment]]
441c920b 45[[cont-comment]] [[Program-name]] is distributed in the hope that it will be useful,
7fb0878b 46[[cont-comment]] but WITHOUT ANY WARRANTY; without even the implied warranty of
47[[cont-comment]] MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48[[cont-comment]] GNU General Public License for more details.
49[[cont-comment]]
50[[cont-comment]] You should have received a copy of the GNU General Public License
441c920b 51[[cont-comment]] along with [[program-name]]; if not, write to the Free Software Foundation,
7fb0878b 52[[cont-comment]] Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.")
53
e7043698 54(setq skelrc-wide-gpl ;Version for wide program names
55"[[cont-comment]] [[Program-name]] is free software; you can redistribute it and/or modify
56[[cont-comment]] it under the terms of the GNU General Public License as published by
57[[cont-comment]] the Free Software Foundation; either version 2 of the License, or
58[[cont-comment]] (at your option) any later version.
59[[cont-comment]]
60[[cont-comment]] [[Program-name]] is distributed in the hope that it will be useful,
61[[cont-comment]] but WITHOUT ANY WARRANTY; without even the implied warranty of
62[[cont-comment]] MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63[[cont-comment]] GNU General Public License for more details.
64[[cont-comment]]
65[[cont-comment]] You should have received a copy of the GNU General Public License
66[[cont-comment]] along with [[program-name]]; if not, write to the Free
67[[cont-comment]] Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
68[[cont-comment]] MA 02111-1307, USA.")
69
7fb0878b 70(setq skelrc-lgpl
441c920b 71"[[cont-comment]] [[Library-name]] is free software; you can redistribute it and/or modify
7fb0878b 72[[cont-comment]] it under the terms of the GNU Library General Public License as
441c920b 73[[cont-comment]] published by the Free Software Foundation; either version 2 of the
7fb0878b 74[[cont-comment]] License, or (at your option) any later version.
75[[cont-comment]]
441c920b 76[[cont-comment]] [[Library-name]] is distributed in the hope that it will be useful,
7fb0878b 77[[cont-comment]] but WITHOUT ANY WARRANTY; without even the implied warranty of
78[[cont-comment]] MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79[[cont-comment]] GNU Library General Public License for more details.
80[[cont-comment]]
81[[cont-comment]] You should have received a copy of the GNU Library General Public
46f73ec5 82[[cont-comment]] License along with [[library-name]]; if not, write to the Free
83[[cont-comment]] Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
84[[cont-comment]] MA 02111-1307, USA.")
7fb0878b 85
86(defun skel-basename ()
87 (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
88
89(setq skel-alist
90 (append
91 '((emacs-mode . (skelrc-decode-major-mode))
92 (year . (substring (current-time-string) 20 24))
93 (header . "[[licence]][[revisions]][[preamble]]")
94 (basename . (skel-basename))
441c920b 95 (licence . "[[licence-banner]]\n[[cont-comment]]\n[[component]][[licence-text]][[block-end]]\n\n")
7fb0878b 96 (licence-banner . (skelrc-banner "Licensing notice" t))
441c920b 97 (component . (skelrc-component))
7fb0878b 98 (licence-text . "[[gpl]]")
441c920b 99 (Program-name . (or (skelrc-assq 'Program skel-alist)
100 (skelrc-assq 'program skel-alist)
101 "This program"))
102 (program-name . (or (skelrc-assq 'program skel-alist)
103 "this program"))
104 (Library-name . (or (skelrc-assq 'Library skel-alist)
105 (skelrc-assq 'library skel-alist)
106 (skelrc-assq 'Program skel-alist)
107 (skelrc-assq 'program skel-alist)
108 "This library"))
109 (library-name . (or (skelrc-assq 'library skel-alist)
110 (skelrc-assq 'program skel-alist)
111 "this library"))
7fb0878b 112 (gpl . skelrc-gpl)
e7043698 113 (wide-gpl . skelrc-wide-gpl)
7fb0878b 114 (lgpl . skelrc-lgpl)
115 (revisions . "[[revision-banner]]\n[[cont-comment]]\n[[cont-comment]] $Log$[[block-end]]\n\n")
116 (revision-banner . (skelrc-banner "Revision history" t))
117 (preamble . "")
28330371 118 (trailer . "[[tag-line]]\n[[postamble]]")
7fb0878b 119 (postamble . "")
120 (tag-line . (skelrc-banner "That's all, folks"))
121 (block-start . (skel-lookup 'new-comment))
122 (block-banner-knob . "")
123 (block-banner-end . "")
124 (block-end . ""))
125 skel-alist))