Reformat the LGPL notice a little.
[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
54(setq skelrc-lgpl
441c920b 55"[[cont-comment]] [[Library-name]] is free software; you can redistribute it and/or modify
7fb0878b 56[[cont-comment]] it under the terms of the GNU Library General Public License as
441c920b 57[[cont-comment]] published by the Free Software Foundation; either version 2 of the
7fb0878b 58[[cont-comment]] License, or (at your option) any later version.
59[[cont-comment]]
441c920b 60[[cont-comment]] [[Library-name]] is distributed in the hope that it will be useful,
7fb0878b 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 Library General Public License for more details.
64[[cont-comment]]
65[[cont-comment]] You should have received a copy of the GNU Library General Public
46f73ec5 66[[cont-comment]] License along with [[library-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.")
7fb0878b 69
70(defun skel-basename ()
71 (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
72
73(setq skel-alist
74 (append
75 '((emacs-mode . (skelrc-decode-major-mode))
76 (year . (substring (current-time-string) 20 24))
77 (header . "[[licence]][[revisions]][[preamble]]")
78 (basename . (skel-basename))
441c920b 79 (licence . "[[licence-banner]]\n[[cont-comment]]\n[[component]][[licence-text]][[block-end]]\n\n")
7fb0878b 80 (licence-banner . (skelrc-banner "Licensing notice" t))
441c920b 81 (component . (skelrc-component))
7fb0878b 82 (licence-text . "[[gpl]]")
441c920b 83 (Program-name . (or (skelrc-assq 'Program skel-alist)
84 (skelrc-assq 'program skel-alist)
85 "This program"))
86 (program-name . (or (skelrc-assq 'program skel-alist)
87 "this program"))
88 (Library-name . (or (skelrc-assq 'Library skel-alist)
89 (skelrc-assq 'library skel-alist)
90 (skelrc-assq 'Program skel-alist)
91 (skelrc-assq 'program skel-alist)
92 "This library"))
93 (library-name . (or (skelrc-assq 'library skel-alist)
94 (skelrc-assq 'program skel-alist)
95 "this library"))
7fb0878b 96 (gpl . skelrc-gpl)
97 (lgpl . skelrc-lgpl)
98 (revisions . "[[revision-banner]]\n[[cont-comment]]\n[[cont-comment]] $Log$[[block-end]]\n\n")
99 (revision-banner . (skelrc-banner "Revision history" t))
100 (preamble . "")
101 (trailer . "[[tag-line]][[postamble]]\n")
102 (postamble . "")
103 (tag-line . (skelrc-banner "That's all, folks"))
104 (block-start . (skel-lookup 'new-comment))
105 (block-banner-knob . "")
106 (block-banner-end . "")
107 (block-end . ""))
108 skel-alist))