Force emacs-lisp mode.
[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-lgpl
55 "[[cont-comment]] [[Library-name]] is free software; you can redistribute it and/or modify
56 [[cont-comment]] it under the terms of the GNU Library General Public License as
57 [[cont-comment]] published by the Free Software Foundation; either version 2 of the
58 [[cont-comment]] License, or (at your option) any later version.
59 [[cont-comment]]
60 [[cont-comment]] [[Library-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 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
66 [[cont-comment]] License along with [[library-name]]; if not, write to the Free Software
67 [[cont-comment]] Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.")
68
69 (defun skel-basename ()
70 (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
71
72 (setq skel-alist
73 (append
74 '((emacs-mode . (skelrc-decode-major-mode))
75 (year . (substring (current-time-string) 20 24))
76 (header . "[[licence]][[revisions]][[preamble]]")
77 (basename . (skel-basename))
78 (licence . "[[licence-banner]]\n[[cont-comment]]\n[[component]][[licence-text]][[block-end]]\n\n")
79 (licence-banner . (skelrc-banner "Licensing notice" t))
80 (component . (skelrc-component))
81 (licence-text . "[[gpl]]")
82 (Program-name . (or (skelrc-assq 'Program skel-alist)
83 (skelrc-assq 'program skel-alist)
84 "This program"))
85 (program-name . (or (skelrc-assq 'program skel-alist)
86 "this program"))
87 (Library-name . (or (skelrc-assq 'Library skel-alist)
88 (skelrc-assq 'library skel-alist)
89 (skelrc-assq 'Program skel-alist)
90 (skelrc-assq 'program skel-alist)
91 "This library"))
92 (library-name . (or (skelrc-assq 'library skel-alist)
93 (skelrc-assq 'program skel-alist)
94 "this library"))
95 (gpl . skelrc-gpl)
96 (lgpl . skelrc-lgpl)
97 (revisions . "[[revision-banner]]\n[[cont-comment]]\n[[cont-comment]] $Log$[[block-end]]\n\n")
98 (revision-banner . (skelrc-banner "Revision history" t))
99 (preamble . "")
100 (trailer . "[[tag-line]][[postamble]]\n")
101 (postamble . "")
102 (tag-line . (skelrc-banner "That's all, folks"))
103 (block-start . (skel-lookup 'new-comment))
104 (block-banner-knob . "")
105 (block-banner-end . "")
106 (block-end . ""))
107 skel-alist))