;;; -*-emacs-lisp-*- (defun skelrc-banner (title &optional block) (let* ((start (skel-lookup 'block-start)) (end (skel-lookup (if block 'block-banner-knob 'block-banner-end))) (barlen (- 77 (length (concat start end " ----- " title))))) (concat start "----- " title " " (make-string barlen ?-) end))) (defvar skelrc-forced-major-mode 0) (defun skelrc-force-mode (new-mode &optional priority) (or priority (setq priority 1)) (if (> priority skelrc-forced-major-mode) (progn (or (eq new-mode major-mode) (let ((old-skel-alist skel-alist)) (funcall new-mode) (make-variable-buffer-local 'skel-alist) (setq skel-alist old-skel-alist))) (make-variable-buffer-local 'skelrc-forced-major-mode) (setq skelrc-forced-major-mode priority)))) (defun skelrc-decode-major-mode () (let* ((name (symbol-name major-mode)) (endind (string-match "-mode$" name))) (if endind (substring name 0 endind) (name)))) (setq skelrc-gpl "[[cont-comment]] This file is part of [[full-title]]. [[cont-comment]] [[cont-comment]] [[program]] is free software; you can redistribute it and/or modify [[cont-comment]] it under the terms of the GNU General Public License as published by [[cont-comment]] the Free Software Foundation; either version 2 of the License, or [[cont-comment]] (at your option) any later version. [[cont-comment]] [[cont-comment]] [[program]] is distributed in the hope that it will be useful, [[cont-comment]] but WITHOUT ANY WARRANTY; without even the implied warranty of [[cont-comment]] MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [[cont-comment]] GNU General Public License for more details. [[cont-comment]] [[cont-comment]] You should have received a copy of the GNU General Public License [[cont-comment]] along with [[program]]; if not, write to the Free Software Foundation, [[cont-comment]] Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.") (setq skelrc-lgpl "[[cont-comment]] This file is part of [[full-title]]. [[cont-comment]] [[cont-comment]] [[program]] is free software; you can redistribute it and/or modify [[cont-comment]] it under the terms of the GNU Library General Public License as [[cont-comment]] published by the Free Software Foundation; either version 2 of the [[cont-comment]] License, or (at your option) any later version. [[cont-comment]] [[cont-comment]] [[program]] is distributed in the hope that it will be useful, [[cont-comment]] but WITHOUT ANY WARRANTY; without even the implied warranty of [[cont-comment]] MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [[cont-comment]] GNU Library General Public License for more details. [[cont-comment]] [[cont-comment]] You should have received a copy of the GNU Library General Public [[cont-comment]] License along with [[program]]; if not, write to the Free Software [[cont-comment]] Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.") (defun skel-basename () (file-name-sans-extension (file-name-nondirectory buffer-file-name))) (setq skel-alist (append '((emacs-mode . (skelrc-decode-major-mode)) (year . (substring (current-time-string) 20 24)) (header . "[[licence]][[revisions]][[preamble]]") (basename . (skel-basename)) (licence . "[[licence-banner]]\n[[cont-comment]]\n[[licence-text]][[block-end]]\n\n") (licence-banner . (skelrc-banner "Licensing notice" t)) (licence-text . "[[gpl]]") (gpl . skelrc-gpl) (lgpl . skelrc-lgpl) (revisions . "[[revision-banner]]\n[[cont-comment]]\n[[cont-comment]] $Log$[[block-end]]\n\n") (revision-banner . (skelrc-banner "Revision history" t)) (preamble . "") (trailer . "[[tag-line]][[postamble]]\n") (postamble . "") (tag-line . (skelrc-banner "That's all, folks")) (block-start . (skel-lookup 'new-comment)) (block-banner-knob . "") (block-banner-end . "") (block-end . "")) skel-alist))