Expunge revision histories in files.
[skel] / skelrc
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
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)
35 "[[cont-comment]] This file is part of [[full-title]].
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
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]]
45 [[cont-comment]] [[Program-name]] is distributed in the hope that it will be useful,
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
51 [[cont-comment]] along with [[program-name]]; if not, write to the Free Software Foundation,
52 [[cont-comment]] Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.")
53
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
70 (setq skelrc-lgpl
71 "[[cont-comment]] [[Library-name]] is free software; you can redistribute it and/or modify
72 [[cont-comment]] it under the terms of the GNU Library General Public License as
73 [[cont-comment]] published by the Free Software Foundation; either version 2 of the
74 [[cont-comment]] License, or (at your option) any later version.
75 [[cont-comment]]
76 [[cont-comment]] [[Library-name]] is distributed in the hope that it will be useful,
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
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.")
85
86 (setq skelrc-bsd
87 "[[cont-comment]] Copyright (c) [[year]] [[author]]
88 [[cont-comment]] All rights reserved.
89 [[cont-comment]]
90 [[cont-comment]] Redistribution and use in source and binary forms, with or without
91 [[cont-comment]] modification, are permitted provided that the following conditions are
92 [[cont-comment]] met:
93 [[cont-comment]]
94 [[cont-comment]] 1. Redistributions of source code must retain the above copyright
95 [[cont-comment]] notice, this list of conditions and the following disclaimer.
96 [[cont-comment]]
97 [[cont-comment]] 2, Redistributions in binary form must reproduce the above copyright
98 [[cont-comment]] notice, this list of conditions and the following disclaimer in the
99 [[cont-comment]] documentation and/or other materials provided with the distribution.
100 [[cont-comment]]
101 [[cont-comment]] 3. The name of the authors may not be used to endorse or promote
102 [[cont-comment]] products derived from this software without specific prior written
103 [[cont-comment]] permission.
104 [[cont-comment]]
105 [[cont-comment]] THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
106 [[cont-comment]] WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
107 [[cont-comment]] MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
108 [[cont-comment]] NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
109 [[cont-comment]] INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
110 [[cont-comment]] (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
111 [[cont-comment]] SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
112 [[cont-comment]] HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
113 [[cont-comment]] STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
114 [[cont-comment]] ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
115 [[cont-comment]] POSSIBILITY OF SUCH DAMAGE.
116 [[cont-comment]]
117 [[cont-comment]] Instead of accepting the above terms, you may redistribute and/or modify
118 [[cont-comment]] this software under the terms of either the GNU General Public License,
119 [[cont-comment]] or the GNU Library General Public License, published by the Free
120 [[cont-comment]] Software Foundation; either version 2 of the License, or (at your
121 [[cont-comment]] option) any later version.")
122
123 (defun skel-basename ()
124 (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
125
126 (setq skel-alist
127 (append
128 '((emacs-mode . (skelrc-decode-major-mode))
129 (year . (substring (current-time-string) 20 24))
130 (header . "[[licence]][[revisions]][[preamble]]")
131 (basename . (skel-basename))
132 (licence . "[[licence-banner]]\n[[cont-comment]]\n[[component]][[licence-text]][[block-end]]\n\n")
133 (licence-banner . (skelrc-banner "Licensing notice" t))
134 (component . (skelrc-component))
135 (licence-text . "[[gpl]]")
136 (Program-name . (or (skelrc-assq 'Program skel-alist)
137 (skelrc-assq 'program skel-alist)
138 "This program"))
139 (program-name . (or (skelrc-assq 'program skel-alist)
140 "this program"))
141 (Library-name . (or (skelrc-assq 'Library skel-alist)
142 (skelrc-assq 'library skel-alist)
143 (skelrc-assq 'Program skel-alist)
144 (skelrc-assq 'program skel-alist)
145 "This library"))
146 (library-name . (or (skelrc-assq 'library skel-alist)
147 (skelrc-assq 'program skel-alist)
148 "this library"))
149 (gpl . skelrc-gpl)
150 (wide-gpl . skelrc-wide-gpl)
151 (lgpl . skelrc-lgpl)
152 (bsd . skelrc-bsd)
153 (revisions . "[[revision-banner]]\n[[cont-comment]]\n[[cont-comment]] $Log$[[block-end]]\n\n")
154 (revision-banner . (skelrc-banner "Revision history" t))
155 (preamble . "")
156 (trailer . "[[tag-line]]\n[[postamble]]")
157 (postamble . "")
158 (tag-line . (skelrc-banner "That's all, folks"))
159 (block-start . (skel-lookup 'new-comment))
160 (block-banner-knob . "")
161 (block-banner-end . "")
162 (block-end . ""))
163 skel-alist))