diff options
author | jao <jao@gnu.org> | 2022-03-13 00:03:47 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-03-13 00:03:47 +0000 |
commit | 24a5d48fd1246ec4dbdec1050696b9bac49be049 (patch) | |
tree | 9cd3f962144f70859012999f740c689625abbbef | |
parent | 5d0e66fb6bb48609146d6954ab504ebf6ed88613 (diff) | |
download | elibs-24a5d48fd1246ec4dbdec1050696b9bac49be049.tar.gz elibs-24a5d48fd1246ec4dbdec1050696b9bac49be049.tar.bz2 |
original skeletons out of the closet
-rw-r--r-- | lib/readme.org | 5 | ||||
-rw-r--r-- | lib/skels/all-skels.el | 49 | ||||
-rw-r--r-- | lib/skels/asdf-skel.el | 52 | ||||
-rw-r--r-- | lib/skels/caml-skel.el | 42 | ||||
-rw-r--r-- | lib/skels/common-skel.el | 152 | ||||
-rw-r--r-- | lib/skels/cpp-skel.el | 255 | ||||
-rw-r--r-- | lib/skels/cppunit-skel.el | 91 | ||||
-rw-r--r-- | lib/skels/dot.emacs.el | 11 | ||||
-rw-r--r-- | lib/skels/fsf-copyright | 12 | ||||
-rw-r--r-- | lib/skels/fuel-skel.el | 45 | ||||
-rw-r--r-- | lib/skels/geiser-skel.el | 50 | ||||
-rw-r--r-- | lib/skels/haskell-skel.el | 70 | ||||
-rw-r--r-- | lib/skels/init-skel.el | 39 | ||||
-rw-r--r-- | lib/skels/latex-skel.el | 52 | ||||
-rw-r--r-- | lib/skels/lisa-skel.el | 157 | ||||
-rw-r--r-- | lib/skels/lisp-skel.el | 50 | ||||
-rw-r--r-- | lib/skels/make-skel.el | 53 | ||||
-rw-r--r-- | lib/skels/muse-skel.el | 41 | ||||
-rw-r--r-- | lib/skels/noweb-skel.el | 48 | ||||
-rw-r--r-- | lib/skels/perl-skel.el | 78 | ||||
-rw-r--r-- | lib/skels/pika-skel.el | 88 | ||||
-rw-r--r-- | lib/skels/python-skel.el | 53 | ||||
-rw-r--r-- | lib/skels/readme-skel.el | 44 | ||||
-rw-r--r-- | lib/skels/s48-skel.el | 61 | ||||
-rw-r--r-- | lib/skels/scsh-skel.el | 45 | ||||
-rw-r--r-- | lib/skels/texinfo-skel.el | 131 |
26 files changed, 1771 insertions, 3 deletions
diff --git a/lib/readme.org b/lib/readme.org index 7079b89..ca494f4 100644 --- a/lib/readme.org +++ b/lib/readme.org @@ -1,10 +1,9 @@ #+title: Elisp libraries - [[./eos][eos]] generic utilities for the emacs operating system - - [[./themes][themes]] color themes based on Emacs builtin custom themes - - [[org][org]] utilities for org-mode - [[./doc][doc]] opening documents (pdfs, mostly) - [[./media][media]] utilities for music players and the like - [[./prog][prog]] utilities for compilation and programming modes - [[./net][net]] utilities for networking (w3m, weather &c.) - - [[./bmk][bmk]] an old web bookmark manager + - [[./themes][themes]] color themes based on Emacs builtin custom themes + - [[./skels][skels]] a collection of emacs skeletons diff --git a/lib/skels/all-skels.el b/lib/skels/all-skels.el new file mode 100644 index 0000000..720b08e --- /dev/null +++ b/lib/skels/all-skels.el @@ -0,0 +1,49 @@ +;;; all-skels.el --- Convenience package loading all skels + +;; Copyright (C) 2008 Jose Ortega + +;; Author: Jose Ortega <jao@google.com> +;; Keywords: languages + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Require this file to load all defined skels + +;;; Code: + +(require 'init-skel) + +(require 'cpp-skel) +(require 'cppunit-skel) +(require 'perl-skel) +(require 'readme-skel) +(require 'make-skel) +(require 'caml-skel) +(require 'latex-skel) +(require 'noweb-skel) +(require 'lisp-skel) +(require 's48-skel) +(require 'haskell-skel) +(require 'scsh-skel) +(require 'lisa-skel) +(require 'texinfo-skel) +(require 'python-skel) +(require 'muse-skel) +(require 'asdf-skel) + +(provide 'all-skels) + +;;; all-skels.el ends here diff --git a/lib/skels/asdf-skel.el b/lib/skels/asdf-skel.el new file mode 100644 index 0000000..939eb8d --- /dev/null +++ b/lib/skels/asdf-skel.el @@ -0,0 +1,52 @@ +;;; asdf-skel.el --- Skels for ASDF system definition files + +;; Copyright (C) 2007 Jose Antonio Ortega Ruiz + +;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> +;; Keywords: lisp + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-asdf-file + "ASDF file header" + "Description: " + '(setq sys (jao-basename)) + '(lisp-mode) + ";; -*- lisp -*- " sys " definition" + \n \n + "(defpackage " sys "-system" \n " (:use :common-lisp :asdf))" + \n \n + "(in-package " sys "-system)" + \n \n + "(defsystem " sys + > \n ":description \"" str "\"" + > \n ":version \"0.1\"" + > \n ":author \"" (user-full-name) " <" user-mail-address ">\"" + > \n ":maintainer \"" (user-full-name) " <" user-mail-address ">\"" + > \n ":licence \"GPL\"" + > \n ":depends-on ()" + > \n ":components ((:file \"packages\")))" + \n \n) + +(add-to-list 'auto-insert-alist '("\\.asd\\'" . jao-skel-asdf-file)) + + +(provide 'asdf-skel) +;;; asdf-skel.el ends here diff --git a/lib/skels/caml-skel.el b/lib/skels/caml-skel.el new file mode 100644 index 0000000..65a5db2 --- /dev/null +++ b/lib/skels/caml-skel.el @@ -0,0 +1,42 @@ +;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Caml skeletons + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-caml-file + "OCaml file header" + "Brief description: " + "(* " (file-name-nondirectory (buffer-file-name)) ": " str " *)" + > \n \n + (jao-copyright-line "(* " " *)") + > ?\n + (jao-insert-copyright-file) + "(* $" "Id$ *)" \n \n _) + +(jao-provide-skel "\\.ml[i]?" 'jao-skel-caml-file) + +(provide 'caml-skel) + diff --git a/lib/skels/common-skel.el b/lib/skels/common-skel.el new file mode 100644 index 0000000..977e7ea --- /dev/null +++ b/lib/skels/common-skel.el @@ -0,0 +1,152 @@ +;; common definitions and functions + +;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Aux functions used in other skeletons + +;;; Code: + +(require 'skeleton) +(require 'autoinsert) + +(defvar jao-company-name nil + "Company name used in copyright notice") + +(defvar jao-copyright-file ".copyright" + "Basename of the raw (uncommented) copyright file") + +(defvar jao-skels-default-scm nil + "Default SCM system") + +(defun jao-prefix (pref) (or pref (concat comment-start " "))) +(defun jao-suffix (suff) (or suff (concat " " comment-end))) + +(defun jao-copyright-line (prefix &optional suffix omit-cpy) + "Create a brief copyright notice with given PREFIX and SUFFIX" + (concat (jao-prefix prefix) + (if omit-cpy "" "Copyright ") + "(c) " (format-time-string "%Y") " " + (or jao-company-name (user-full-name)) + (jao-suffix suffix) "\n")) + +(defun jao-date-line (prefix &optional suffix) + "Create a start date line" + (concat (jao-prefix prefix) + "Start date: " (format-time-string "%a %b %d, %Y %H:%M") + (jao-suffix suffix) "\n")) + +(defun jao-author-line (prefix &optional suffix) + "Create an author date line" + (concat (jao-prefix prefix) + "Author: " (user-full-name) " <" user-mail-address "> " + (jao-suffix suffix) "\n")) + +(defun jao-cvs-line (prefix &optional suffix) + "Create a CVS ID line" + (concat (jao-prefix prefix) "$" "Id$" (jao-suffix suffix) "\n")) + +(defun jao-svn-line (prefix &optional suffix) + "Create a SVN ID line" + (concat (jao-prefix prefix) "X-SVN: $" "Id$" (jao-suffix suffix) "\n")) + +(defun jao-arch-line (&optional prefix suffix) + "Create an arch-tag line" + (let ((uuid (shell-command-to-string "uuidgen"))) + (concat (jao-prefix prefix) "arch-tag: " uuid (jao-suffix suffix) "\n"))) + +(defun jao-insert-arch-line () + (interactive) + (insert (jao-arch-line))) + +(defun jao-scm-line (prefix &optional suffix) + "Create an scm line" + (let* ((formats '(("arch" . jao-arch-line) + ("svn" . jao-svn-line) + ("cvs" . jao-cvs-line) + ("none" . (lambda (p f) "")))) + (names (mapcar 'car formats)) + (prompt (concat "SCM (" (mapconcat 'identity names ", ") "): ")) + (sel (or jao-skels-default-scm + (completing-read prompt formats nil 1))) + (fun (cdr (assoc sel formats)))) + (when fun (concat (funcall fun prefix suffix))))) + +(defun jao-c&co-line (&optional prefix suffix) + (concat (jao-scm-line prefix suffix) "\n" + (jao-co-line prefix suffix))) + +(defun jao-co-line (&optional prefix suffix) + (concat (jao-copyright-line prefix suffix) "\n" + (jao-author-line prefix suffix) + (jao-date-line prefix suffix))) + +;; aux functions --------------------------------------------------------- +(defun jao-basename () + "Get buffer file name without dir nor extension" + (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))) + +(defun jao-basedir () + "Base directory" + (file-name-nondirectory + (substring (file-name-directory (buffer-file-name)) 0 -1))) + +(defun jao-dir-level (l) + (let ((elems (split-string + (file-name-sans-extension (buffer-file-name)) "/"))) + (mapconcat 'identity (nthcdr (- (length elems) (+ 1 l)) elems) "/"))) + +(defun jao-extension () + "Find the extension of the currently visited file" + (let ((elems (split-string (file-name-nondirectory (buffer-file-name)) + "\\."))) + (nth (- (length elems) 1) elems))) + +(defun jao-other-file-name (ext1 ext2) + "Find the complimentary file name of header/source file" + (let ((extension (jao-extension)) + (basename (jao-basename))) + (if (string= extension ext1) (concat basename "." ext2) + (concat basename "." ext1)))) + +(defun jao-insert-commented-file (file-name) + (let* ((start (point)) + (end (+ start (cadr (insert-file-contents file-name))))) + (goto-char end) + (comment-region start (point)))) + +(defun jao-insert-copyright-file () + (let ((dir (locate-dominating-file (buffer-file-name) jao-copyright-file))) + (when dir + (let ((file (expand-file-name jao-copyright-file dir))) + (when (file-exists-p file) + (jao-insert-commented-file file)))))) + +(defun jao-provide-skel (regexp skel) + (let ((ex (assoc regexp auto-insert-alist))) + (if ex (setf (cdr ex) skel) + (add-to-list 'auto-insert-alist (cons regexp skel))))) + +(defsubst jao-skel-provide (lst) + (mapc (lambda (x) (apply #'jao-provide-skel x)) lst)) + +(provide 'common-skel) diff --git a/lib/skels/cpp-skel.el b/lib/skels/cpp-skel.el new file mode 100644 index 0000000..806f1df --- /dev/null +++ b/lib/skels/cpp-skel.el @@ -0,0 +1,255 @@ +;;; cpp-skel.el + +;; Copyright (C) 2004, 2005, 2008, 2009 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; C++ skeletons. + +;;; Code: + +(require 'common-skel) +(require 'thingatpt) + +;;; Variables +(defvar jao-skel-cpp-root-namespace nil + "The root C++ namespace") + +(defvar jao-skel-cpp-brief-header-p nil + "If non-nil, generate brief header comments") + +(defvar jao-skel-cpp-make-guard-function #'jao-skel-cpp-make-guard-name + "Function generating #include guards") + +(defvar jao-skel-cpp-use-namespaces t + "Whether to generate namespaces") + +(defvar jao-skel-cpp-single-line-namespaces t + "Whether to put consecutive namespace decls in a single line") + +(defvar jao-skel-cpp-header-extension "hpp") + +;;; Auxiliar functions +(defun jao-skel-cpp--find-other (ext) + (file-name-nondirectory + (or (ff-other-file-name) + (concat (file-name-sans-extension (buffer-name)) "." ext)))) + +(defun jao-skel-cpp-make-guard-name (ns) + "Create a standard include guard name" + (upcase (mapconcat #'identity + `(,@ns ,(jao-basename) ,(jao-extension) + ,(user-login-name) + ,(format-time-string "%y%m%d%H%M")) + "_"))) + +;; namespaces +(defsubst jao-skel-cpp--read-ns (curr) + (read-string (format "Add namespace (current: %s): " (or curr "[none]")))) + +(defsubst jao-skel-cpp--ns2str (ns) (mapconcat 'identity ns "::")) + +(defun jao-skel-cpp--get-ns-list (&optional acc) + (do* ((result acc (cons next result)) + (next (jao-skel-cpp--read-ns (jao-skel-cpp--ns2str acc)) + (jao-skel-cpp--read-ns (jao-skel-cpp--ns2str (reverse result))))) + ((string= next "") (reverse result)))) + +(defun jao-skel-cpp--insert-open-ns-list (ns) + (dolist (n ns) + (insert (format "namespace %s {%s" + n + (if jao-skel-cpp-single-line-namespaces " " "\n"))) + (indent-according-to-mode)) + (when jao-skel-cpp-single-line-namespaces + (newline) + (indent-according-to-mode))) + +(defun jao-skel-cpp--insert-close-ns-list (ns) + (if jao-skel-cpp-single-line-namespaces + (insert (format "%s // namespace %s\n" + (make-string (length ns) ?}) + (jao-skel-cpp--ns2str ns))) + (dolist (n (reverse ns)) + (insert (format "} // namespace %s\n" n))))) + +(defun jao-skel-cpp--copy-ns-lines () + (let ((lines)) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "namespace\\s-\\w+\\s-{\\|}+\\s-//\\s-namespace" + nil t) + (push (thing-at-point 'line) lines) + (next-line))) + lines)) + +(defun jao-skel-cpp--copy-namespace () + (let* ((name (ff-other-file-name)) + (buff (and name (find-file-noselect name))) + (nlines)) + (when buff + (let ((lines (save-current-buffer + (set-buffer buff) + (jao-skel-cpp--copy-ns-lines)))) + (dolist (line lines) + (push line nlines) + (when (string-match "}" line) + (push "\n\n\n\n" nlines))))) + (mapconcat #'identity nlines "\n"))) + +(defsubst jao-skel-cpp--get-new-namespace () + (when jao-skel-cpp-use-namespaces + (jao-skel-cpp--get-ns-list + (and jao-skel-cpp-root-namespace (list jao-skel-cpp-root-namespace))))) + +;; skeletons +(define-skeleton jao-skel-cpp-header-long + "Initial file header blurb" + "Brief file description: " + "/**" + > \n + "* @file " (file-name-nondirectory (buffer-file-name)) + > \n + "* @brief " str + > \n + "* @author " (user-full-name) " <"user-mail-address">" + > \n + "* @date " (format-time-string "%a %b %d, %Y %H:%M") + > \n + "*" + > \n + (jao-copyright-line "* " "") + "*" + > ?\n + (jao-insert-copyright-file) + > \n \n _) + +(define-skeleton jao-skel-cpp-header-brief + "Brief initial header blurb" + nil + (jao-copyright-line "/* " " */") + \n) + +(define-skeleton jao-skel-cpp-header-comment + "Insert a standard comment block" + nil + '(if jao-skel-cpp-brief-header-p + (jao-skel-cpp-header-brief) + (jao-skel-cpp-header-long))) + +;; source C/C++ file ------------------------------------------------------ +(define-skeleton jao-skel-cpp-source-header + "Insert a standard C++ source header" + nil + '(jao-skel-cpp-header-comment) + ? \n + "#include \"" (jao-skel-cpp--find-other jao-skel-cpp-header-extension) "\"" + > \n \n _ + (jao-skel-cpp--copy-namespace) + \n) + +(define-skeleton jao-skel-c-source-header + "Insert a standard C source header" + nil + '(jao-skel-cpp-header-comment) + "#include \"" (jao-skel-cpp--find-other "h") "\"" + > _ \n \n \n \n + (jao-scm-line "/* " " */") + > \n) + + +;; header C/C++ files ------------------------------------------------------ +;; header guard + +;; class definition +(define-skeleton jao-skel-cpp-class-def + "Insert a class definition" + nil + '(setq v1 (jao-basename)) + > \n + "/**" + > \n + "*" + > \n + "*" + > \n + "*/" + > \n + "class " v1 + > \n + "{" + > \n + "public:" + > \n + "~" v1 "();" + > \n + v1 "();" + > \n + v1 "(const " v1 "& other);" + > \n \n + "private:" + > \n + "};" + > \n) + +(define-skeleton jao-skel-cpp-header + "Insert a standard C++ header (hpp files)" + nil + '(setq v1 (jao-skel-cpp--get-new-namespace)) + '(setq v2 (funcall jao-skel-cpp-make-guard-function v1)) + '(jao-skel-cpp-header-comment) + > \n + "#ifndef " v2 + > \n + "#define " v2 + > \n \n + '(when v1 (jao-skel-cpp--insert-open-ns-list v1)) + _ '(jao-skel-cpp-class-def) + > \n \n + '(when v1 (jao-skel-cpp--insert-close-ns-list v1)) + > \n \n + "#endif // " v2 + > \n) + +(define-skeleton jao-skel-c-header + "Insert a standard C header (.h files)" + nil + '(jao-skel-cpp-header-comment) + > \n + '(setq v1 (funcall jao-skel-cpp-make-guard-function nil)) + "#ifndef " v1 + > \n + "#define " v1 + > _ \n \n \n \n + "#endif /* " v1 " */" + > \n \n + (jao-scm-line "/* " " */") + > \n) + +(jao-skel-provide + '(("\\.cpp$" jao-skel-cpp-source-header) + ("\\.hpp$" jao-skel-cpp-header) + ("\\.c$" jao-skel-c-source-header) + ("\\.h$" jao-skel-c-header))) + +(provide 'cpp-skel) + +;;; cpp-skel.el ends here diff --git a/lib/skels/cppunit-skel.el b/lib/skels/cppunit-skel.el new file mode 100644 index 0000000..729f392 --- /dev/null +++ b/lib/skels/cppunit-skel.el @@ -0,0 +1,91 @@ +;;; cppunit-skel.el + +;; Copyright (C) 2004, 2005 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Skeletons creating cppunit classes. + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-cppunit-main + "Insert CPPUNIT main function" + nil + "#include <cppunit/extensions/TestFactoryRegistry.h>" > \n + "#include <cppunit/ui/text/TestRunner.h>" > \n \n + "int" > \n + "main(int argc, char* argv[])" > \n + "{" > \n + "CppUnit::TextUi::TestRunner runner;" > \n + "CppUnit::TestFactoryRegistry& registry =" > \n + "CppUnit::TestFactoryRegistry::getRegistry();" > \n \n + "runner.addTest(registry.makeTest());" > \n \n + "return !runner.run(\"\", false);" > \n + "}" > \n) + +(define-skeleton jao-cppunit-class + "Create a CPPUNIT class definition preamble" + nil + > + "CPPUNIT_TEST_SUITE(" (jao-basename) ");" + > \n + "CPPUNIT_TEST(test);" + > \n + "CPPUNIT_TEST_SUITE_END();" + > \n \n + "private:" + > \n \n + "void test();" + > \n \n + "private:" + > \n \n + "void set_up();" + > \n + "void tear_down();" + > \n) + +(define-skeleton jao-cppunit-classdef + "Create a CPPUNIT class implementation preamble" + nil + > + "CPPUNIT_TEST_SUITE_REGISTRATION(" (jao-basename) ");" + > \n \n + "void" + > \n + (jao-basename) "::set_up()" + > \n + "{" + > \n + "}" + > \n \n + "void" + > \n + (jao-basename) "::tear_down()" + > \n + "{" + > \n + "}" + > \n) + +(provide 'cppunit-skel) + diff --git a/lib/skels/dot.emacs.el b/lib/skels/dot.emacs.el new file mode 100644 index 0000000..a82e500 --- /dev/null +++ b/lib/skels/dot.emacs.el @@ -0,0 +1,11 @@ +;; boilerplate skels configuration: + +;;; add skels directory to your load path +(add-to-list 'load-path "~/lib/emacs/skels") +(load "init-skel") + +;;; set configuration variables +(setq jao-company-name "Free Software Foundation, Inc.") +(setq jao-cpp-root-namespace "") +(setq jao-copyright-file ".copyright") + diff --git a/lib/skels/fsf-copyright b/lib/skels/fsf-copyright new file mode 100644 index 0000000..af83705 --- /dev/null +++ b/lib/skels/fsf-copyright @@ -0,0 +1,12 @@ +This file is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +This file is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/lib/skels/fuel-skel.el b/lib/skels/fuel-skel.el new file mode 100644 index 0000000..786f4ec --- /dev/null +++ b/lib/skels/fuel-skel.el @@ -0,0 +1,45 @@ +;;; fuel-skel.el --- skeleton for fuel elisp files + +;; Copyright (C) 2008 Jose Antonio Ortega Ruiz + +;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> +;; Keywords: lisp + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-fuel-file + "Fuel file header" + "Brief description: " + ";;; " (file-name-nondirectory (buffer-file-name)) " -- " str "" + \n \n + (jao-copyright-line ";; ") + ";; See http://factorcode.org/license.txt for BSD license." + \n \n (jao-author-line ";; ") ";; Keywords: languages, fuel, factor" + \n (jao-date-line ";; ") + \n ";;; Comentary: " \n \n ";; " _ \n + \n ";;; Code: " \n \n \n \n + "" \n "(provide '" (jao-basename) ")" \n + ";;; " (file-name-nondirectory (buffer-file-name)) " ends here" + \n + \n) + +(jao-provide-skel "misc/fuel/.+\\.el\\'" 'jao-skel-fuel-file) + + +(provide 'fuel-skel) +;;; fuel-skel.el ends here diff --git a/lib/skels/geiser-skel.el b/lib/skels/geiser-skel.el new file mode 100644 index 0000000..3c9181a --- /dev/null +++ b/lib/skels/geiser-skel.el @@ -0,0 +1,50 @@ +;; geiser-skel.el -- geiser skeletons + +;; Copyright (C) 2009 Jose Antonio Ortega Ruiz + +;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> +;; Start date: Fri Sep 11, 2009 00:31 + +(require 'common-skel) + +(defconst jao-skel-geiser--bsd + ";; This program is free software; you can redistribute it and/or +;; modify it under the terms of the Modified BSD License. You should +;; have received a copy of the license along with this program. If +;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>. +") + +(defsubst jao-skel-geiser--end-line () + (format ";;; %s ends here\n\n" (file-name-nondirectory (buffer-file-name)))) + +(define-skeleton jao-skel-geiser--common + "Geiser elisp header" + "Brief description: " + ";;; " (file-name-nondirectory (buffer-file-name)) " -- " str "" + \n \n + (jao-copyright-line ";; ") \n + jao-skel-geiser--bsd + \n (jao-date-line ";; ") \n) + +(define-skeleton jao-skel-geiser-elisp + "Geiser elisp header" + nil + '(jao-skel-geiser--common) + "" \n _ \n \n "" \n "(provide '" (jao-basename) ")" \n + (jao-skel-geiser--end-line)) + +(jao-provide-skel "geiser/elisp/.+\\.el\\'" 'jao-skel-geiser-elisp) + +(define-skeleton jao-skel-geiser-scheme + "Geiser scheme header" + nil + '(jao-skel-geiser--common) _ + \n (jao-skel-geiser--end-line)) + +(jao-provide-skel "geiser/scheme/.+\\.\\(scm\\|ss\\|sls\\)\\'" + 'jao-skel-geiser-scheme) + + + +(provide 'geiser-skel) +;;; geiser-skel.el ends here diff --git a/lib/skels/haskell-skel.el b/lib/skels/haskell-skel.el new file mode 100644 index 0000000..8ea0301 --- /dev/null +++ b/lib/skels/haskell-skel.el @@ -0,0 +1,70 @@ +;;; haskell-skel.el --- skeleton for haskell source files +;; Copyright (C) 2003, 2004, 2005, 2009, 2010, 2012 Jose A Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@member.fsf.org> +;; Keywords: languages + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; + +;;; Code: + +(require 'common-skel) +(require 'jao-dominating-file) + +;;; Auxiliar +(defun jao-skel--read-haskell-module () + (let* ((ddir (jao-relative-path "\\.cabal\\'")) + (mbase (and ddir (concat (replace-regexp-in-string "/" "." ddir) + "."))) + (m (read-string "Module prefix (empty for no module): " + (concat (or mbase "") (jao-basename))))) + (or m ""))) + +(defconst jao-skel--haskell-line (make-string 78 ?-)) + +;;; Skeletons +(define-skeleton jao-skel-haskell-file + "Haskell hs file header" + "Brief description: " + '(setq v (jao-skel--read-haskell-module)) + jao-skel--haskell-line \n + "-- |" \n + "-- Module: " v \n + (jao-copyright-line "-- Copyright: " "" t) + "-- License: BSD3-style (see LICENSE)" \n + "--" \n + "-- Maintainer: " user-mail-address \n + "-- Stability: unstable" \n + "-- Portability: portable" \n + "-- Created: " (format-time-string "%a %b %d, %Y %H:%M") \n + "--" \n + "--" \n + "-- " str \n + "--" \n + jao-skel--haskell-line + \n \n \n + "module " v " where " \n \n \n) + +(jao-provide-skel "\\.hs\\'" 'jao-skel-haskell-file) +;; (jao-provide-skel "\\.lhs\\'" 'jao-skel-lit-haskell-file) + +(provide 'haskell-skel) + +;;; haskell-skel.el ends here diff --git a/lib/skels/init-skel.el b/lib/skels/init-skel.el new file mode 100644 index 0000000..7612f92 --- /dev/null +++ b/lib/skels/init-skel.el @@ -0,0 +1,39 @@ +;; skeleton configuration + +;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Initialisation file for jao skeletons + +;;; Code: + +(require 'autoinsert) +(setq auto-insert t) +(add-hook 'find-file-hooks 'auto-insert) +(setq auto-insert-directory "~/.autoinsert/") +(setq auto-insert-query t) + +(require 'common-skel) + +(provide 'init-skel) + +;;;; init-skel.el ends here diff --git a/lib/skels/latex-skel.el b/lib/skels/latex-skel.el new file mode 100644 index 0000000..330be22 --- /dev/null +++ b/lib/skels/latex-skel.el @@ -0,0 +1,52 @@ +;; latex skeletons + +;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; LaTeX skeletons + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-latex + "Latex standard header" + nil + "%%" + \n + "%% Author: " (user-full-name) " <"user-mail-address">" + \n + "%% Start date: " (format-time-string "%a %b %d, %Y %H:%M") + \n + "%% $" "Id$" + \n + "%%" + ?\n + (jao-copyright-line "% ") + \n + "%%" + \n \n) + +(jao-provide-skel "\\.tex$\\|\\.sty$\\|\\.cls$" 'jao-skel-latex) + +(provide 'latex-skel) + diff --git a/lib/skels/lisa-skel.el b/lib/skels/lisa-skel.el new file mode 100644 index 0000000..6cf3083 --- /dev/null +++ b/lib/skels/lisa-skel.el @@ -0,0 +1,157 @@ +;;; lisa variants of c skeletons + +;; Copyright (C) 2004, 2005, 2006 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Lisa variants for c skeletons + +;;; Code: + +(require 'common-skel) + +(defun jao-lisa-filename () + (let* ((fname (expand-file-name (buffer-file-name))) + (parts (split-string fname "/")) + (dirs (member "src" parts))) + (mapconcat 'identity dirs "/"))) + + +(defun jao-lisa-guard () + (upcase (concat (jao-basename) + "_" (jao-extension) "_" + (format-time-string "%y%m%d%H%M")))) + +(defun jao-lisa-header (&optional desc group prf) + (concat "/**" + "\n * @file " (jao-lisa-filename) + "\n * @author " (user-full-name) " <"user-mail-address">" + "\n * @date " (format-time-string "%a %b %d, %Y %H:%M") + "\n * @brief " (or desc (read-string "Description: ")) + (if group (concat "\n * @ingroup " group) "") + (if prf (concat "\n * @uutrx " prf) "") + "\n **/\n\n" + (jao-arch-line "// " ""))) + +(define-skeleton jao-skel-lisa-h + "Standard lisa c header" + nil + '(setq guard (jao-lisa-guard)) + (jao-lisa-header) + \n \n + "#ifndef " guard \n + "#define " guard \n + \n \n "#include \"" _ "\"" \n \n \n + "" \n "// Types" \n \n \n + "" \n "// Constants" \n \n \n + "" \n "// Functions" \n \n \n + \n \n + "#endif // " guard + \n \n) + +(define-skeleton jao-skel-lisa-c + "Standard lisa c body" + nil + (jao-lisa-header (concat (jao-other-file-name "h" "c") " implementation")) + \n \n + "#include \"" + (jao-basename) + ".h\"" > + > \n \n \n + "" \n "// Private" \n \n \n + _ + "" \n "// Public" \n \n \n + ) + +(define-skeleton jao-skel-lisa-test + "Cantata++ test file" + nil + '(setq v1 (read-string "File under test (sans extension): ")) + '(setq v0 (read-string "Doxygen group under test: ")) + '(setq v2 (concat "UnitTest" v0)) + (jao-lisa-header (concat "Unit tests for " v1) + v2 + (read-string "Prefix of functions being tested (e.g. 'rtos_?+'): ")) + \n \n + "#include \"test/test.h\"" > \n + "#include \"" v1 ".h\"" > \n \n \n + "// Test name" > \n + "char const *test_name = \"" (concat v1 "_test") "\";" > \n \n + "// Prototypes for test functions" > \n + "/**" \n + "* @defgroup " v2 " Unit tests" > \n + "* @ingroup " v0 > \n + "**/" > \n + "//@{" > \n + "//@}" > \n + \n \n \n + "void" > \n + "run_tests (void)" > \n + "{" > \n + "}" > \n \n + "// Test functions" > \n \n \n) + +(defun jao-add-cantata-test () + "Call this function inside a test buffer to add a new test fun" + (interactive) + (let* ((fn (read-string "Function under test: ")) + (tfn (concat "test_" fn))) + (goto-char (point-min)) + (if (not (search-forward-regexp "^// Prototypes for test functions$" nil t)) + (error "No beginning of test fun declarations found")) + (if (not (search-forward-regexp "//@\\}$" nil t)) + (error "Missing doxygen group marks in prototype function decls")) + (beginning-of-line) + (open-line 1) + (insert "/**\n * Unit tests for @ref " fn "\n */\n") + (insert "static void " tfn " (void);\n") + (if (not (search-forward-regexp "run_tests (void)$" nil t)) + (error "No run_tests() definition found")) + (if (not (search-forward-regexp "^}" nil t)) + (error "End of run_tests() not found")) + (beginning-of-line) + (insert "\n") + (previous-line 1) + (insert tfn " ();") + (indent-according-to-mode) + (goto-char (point-max)) + (jao-insert-cantata-test-fun tfn))) + +(defun jao-insert-cantata-test-fun (fn) + (beginning-of-line) + (insert "void\n" fn " (void)\n{\n") + (insert "START_TEST (\"" fn + "\", \"" (read-string "Test case description: ") "\");") + (indent-according-to-mode) + (insert "\n\n\nEND_TEST ();") + (indent-according-to-mode) + (insert "\n}\n")) + + +(defun jao-skel-lisa-activate () + (interactive) + (jao-provide-skel "\\.c$" 'jao-skel-lisa-c) + (jao-provide-skel "\\.h$" 'jao-skel-lisa-h) + (jao-provide-skel "tests/.*\\.c$" 'jao-skel-lisa-test)) + + +(provide 'lisa-skel) + diff --git a/lib/skels/lisp-skel.el b/lib/skels/lisp-skel.el new file mode 100644 index 0000000..e5bb91a --- /dev/null +++ b/lib/skels/lisp-skel.el @@ -0,0 +1,50 @@ +;;; lisp-skel.el --- skeleton for lisp-like languages + +;; Copyright (C) 2003, 2004, 2005, 2008, 2009 Jose A Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: lisp + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Skeleton for lisp like languages + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-lisp-file + "Lisp file header" + "Brief description: " + ";; " (file-name-nondirectory (buffer-file-name)) " -- " str "" + ?\n + (jao-c&co-line ";; ") + ?\n + (jao-insert-copyright-file) + \n ";;; Comentary: " \n \n ";; " _ \n + \n ";;; Code: " \n \n \n \n + '(when (eq major-mode 'emacs-lisp-mode) + (insert (format "\n(provide '%s)\n" (jao-basename)))) + ";;; " (file-name-nondirectory (buffer-file-name)) " ends here" + \n + \n) + +(jao-provide-skel "\\.\\(scm\\|ss\\|lisp\\|cl\\|el\\)\\'" 'jao-skel-lisp-file) + +(provide 'lisp-skel) +;;; lisp-skel.el ends here diff --git a/lib/skels/make-skel.el b/lib/skels/make-skel.el new file mode 100644 index 0000000..5607dbe --- /dev/null +++ b/lib/skels/make-skel.el @@ -0,0 +1,53 @@ +;; makefile skeletons + +;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Makefile skeletons + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-makefile + "Makefile standard header" + nil + "#" + \n + "# $" "Id$" + \n + "# " + \n + "# Author: " (user-full-name) " <"user-mail-address">" + \n + "# Start date: " (format-time-string "%a %b %d, %Y %H:%M") + \n + "#" + ?\n + (jao-copyright-line "# ") + \n + (jao-insert-copyright-file)) + +(jao-provide-skel "\\.mk$\\|Makefile\\(\\.am\\)?\\|configure\\.in" 'jao-skel-makefile) + +(provide 'make-skel) + diff --git a/lib/skels/muse-skel.el b/lib/skels/muse-skel.el new file mode 100644 index 0000000..86686d9 --- /dev/null +++ b/lib/skels/muse-skel.el @@ -0,0 +1,41 @@ +;;; muse-skel.el --- muse pages + +;; Copyright (C) 2006 Jose Antonio Ortega Ruiz + +;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-muse-file + "Muse file skeleton" + "Documents (sub)dir: " + _ \n \n \n \n \n \n \n + "----" \n + ";;; Local Variables:" \n + ";;; wiki-docs: " str \n + ";;; End:" \n \n + '(hack-local-variables)) + +(add-to-list 'auto-insert-alist + '("\\.muse\\'" . jao-skel-muse-file)) + +(provide 'muse-skel) +;;; muse-skel.el ends here diff --git a/lib/skels/noweb-skel.el b/lib/skels/noweb-skel.el new file mode 100644 index 0000000..0e37702 --- /dev/null +++ b/lib/skels/noweb-skel.el @@ -0,0 +1,48 @@ +;;; noweb-skel.el --- skeleton for noweb files + +;; Copyright (C) 2003, 2004, 2005 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Skeleton for noweb files + +;;; Code: + +(require 'common-skel) +(require 'latex-skel) + +(define-skeleton jao-skel-noweb + "Noweb standard header" + "Code mode (without -mode suffix): " + "% -*- mode: Noweb; noweb-code-mode: " str "-mode -*-" + '(setq noweb-code-mode (intern (concat str "-mode"))) + \n + '(jao-skel-latex) + \n _ \n \n + "%%% end of file" + \n) + +(add-to-list 'auto-insert-alist '("\\.nw$" . jao-skel-noweb)) + +(provide 'noweb-skel) + + +;;; noweb-skel.el ends here diff --git a/lib/skels/perl-skel.el b/lib/skels/perl-skel.el new file mode 100644 index 0000000..a5b5bb4 --- /dev/null +++ b/lib/skels/perl-skel.el @@ -0,0 +1,78 @@ +;;; perl-skel.el + +;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Perl skeletons + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-perl-script + "Standard perl script header" + "Brief file description: " + "#! /usr/bin/perl -w" + > \n + "#" + > \n + "# $Id" "$" + > \n + "# " (file-name-nondirectory (buffer-file-name)) ": " str + > \n + "#" + > ?\n + (jao-copyright-line "# ") + > ?\n + (jao-insert-copyright-file) + > \n + "use strict;" + > \n \n + > \n _) + +(define-skeleton jao-skel-perl-module + "Standard perl module header" + "Brief module description: " + "#" + > \n + "# " (file-name-nondirectory (buffer-file-name)) ": "str + > \n + "#" + > ?\n + (jao-copyright-line "# ") + > ?\n + (jao-insert-copyright-file) + "# " + > \n \n + "package " + (read-string (concat "Module name (" (jao-basename) "): ") + nil nil (jao-basename)) + ";" + > \n \n _ \n \n + "1;" + > \n) + +(jao-provide-skel "\\.pl$" 'jao-skel-perl-script) +(jao-provide-skel "\\.pm$" 'jao-skel-perl-module) + +(provide 'perl-skel) + diff --git a/lib/skels/pika-skel.el b/lib/skels/pika-skel.el new file mode 100644 index 0000000..654792d --- /dev/null +++ b/lib/skels/pika-skel.el @@ -0,0 +1,88 @@ +;;; pika variants of c skeletons + +;; Copyright (C) 2004, 2005 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Pika variants for c skeletons + +;;; Code: + +(require 'common-skel) + +(defun jao-pika-guard () + (upcase (concat "include__" (jao-basedir) "__" (jao-basename) "_h"))) + +(define-skeleton jao-pika-header + "" + "Brief file description: " + "/* " (file-name-nondirectory (buffer-file-name)) ": " str + \n "*" > \n + "****************************************************************" + > \n (jao-copyright-line "* ") + > \n "*" > \n + "* See the file \"COPYING\" for further information about" + > n + "* the copyright and warranty status of this work." + > n + "*/" \n "" \n _) + +(define-skeleton jao-skel-pika-h + "Standard pika c header" + nil + (jao-pika-header) + '(setq guard (jao-pika-guard)) + "#ifndef " guard \n + "#define " guard \n + "" + \n \n "#include \"" _ "\""\n \n + "" + \n \n \n + "" + \n + "#endif /* " guard " */" + \n \n "" \n + (jao-arch-line "/* " "*/") + \n) + +(define-skeleton jao-skel-pika-c + "Standard pika c body" + nil + (jao-pika-header) + \n "#include \"" (jao-dir-level 2) ".h\"" \n + \n + "" + \n \n _ \n \n "" \n + (jao-arch-line "/* " "*/") + \n) + +(defun jao-skel-pika-activate () + (interactive) + (let ((c (assoc "\\.c$" auto-insert-alist)) + (h (assoc "\\.h$" auto-insert-alist))) + (if c (setf (cdr c) 'jao-skel-pika-c) + (add-to-list 'auto-insert-alist '("\\.c$" . jao-skel-pika-c))) + (if h (setf (cdr h) 'jao-skel-pika-h) + (add-to-list 'auto-insert-alist '("\\.h$" . jao-skel-pika-h))))) + + +(provide 'pika-skel) + diff --git a/lib/skels/python-skel.el b/lib/skels/python-skel.el new file mode 100644 index 0000000..536f825 --- /dev/null +++ b/lib/skels/python-skel.el @@ -0,0 +1,53 @@ +;;; python-skel.el + +;; Copyright (C) 2004, 2005, 2009 Aleix Conchillo Flaque + +;; Author: Aleix Conchillo Flaque <aleix@member.fsf.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Python skeletons + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-python-module + "Standard python module header" + "Brief file description: " + "#! /usr/bin/env python" + > \n + "#" + > \n + "# $Id" "$" + > \n \n + "# " (file-name-nondirectory (buffer-file-name)) ": " str + > \n + "#" + > ?\n + (jao-copyright-line "# ") + > ?\n + (jao-insert-copyright-file) + > \n + > \n _) + +(jao-provide-skel "\\.py$" 'jao-skel-python-module) + +(provide 'python-skel) + diff --git a/lib/skels/readme-skel.el b/lib/skels/readme-skel.el new file mode 100644 index 0000000..9c22cce --- /dev/null +++ b/lib/skels/readme-skel.el @@ -0,0 +1,44 @@ +;; Copyright (C) 2004, 2005 Jose Antonio Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Simple skeleton for README files. + +;;; Code: + +(require 'common-skel) + +(define-skeleton jao-skel-readme-file + "README file header" + "Brief description: " + \n str + \n "-----------------------------------------------------" \n + _ \n \n \n + "-----------------------------------------------------" \n + (jao-copyright-line "" "") + \n \n + "$Id" "$" + \n) + +(add-to-list 'auto-insert-alist '("README" . jao-skel-readme-file)) + +(provide 'readme-skel) + diff --git a/lib/skels/s48-skel.el b/lib/skels/s48-skel.el new file mode 100644 index 0000000..30e749f --- /dev/null +++ b/lib/skels/s48-skel.el @@ -0,0 +1,61 @@ +;;; s48-skel.el --- skeleton for s48 + +;; Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Jose A Ortega Ruiz + +;; Author: Jose A Ortega Ruiz <jao@gnu.org> +;; Keywords: lisp + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Skeleton for s48/slime48 like languages + +;;; Code: + +(require 'common-skel) +(require 'lisp-skel) + +(define-skeleton jao-skel-s48-file + "Slime/Scheme48 file header" + "Package: " + ";; -*- mode: scheme48; scheme48-package: " str " -*-" + ?\n + (jao-co-line ";; ") + ?\n + (jao-insert-copyright-file) + \n ";;; Comentary: " \n \n ";; " _ \n + \n ";;; Code: " \n \n \n \n + ";;; " (file-name-nondirectory (buffer-file-name)) " ends here" + '(scheme48-mode) + \n + \n) + +(define-skeleton jao-skel-s48-file-maybe + "Choose between a s48 file and a plain scheme one" + nil + '(if (y-or-n-p "Is this a s48 file? ") (jao-skel-s48-file) + (jao-skel-lisp-file)) + '(hack-local-variables)) + + +(jao-provide-skel "\\.scm\\'" 'jao-skel-s48-file-maybe) + + +(provide 's48-skel) + + +;;; lisp-skel.el ends here diff --git a/lib/skels/scsh-skel.el b/lib/skels/scsh-skel.el new file mode 100644 index 0000000..495925f --- /dev/null +++ b/lib/skels/scsh-skel.el @@ -0,0 +1,45 @@ +;;; scsh-skel.el --- skeleton for scsh scripts + +;; Copyright (C) 2003, 2004, 2005, 2006, 2008 Jose Antonio Ortega Ruiz + +;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> +;; Keywords: abbrev + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +(require 'common-skel) + +(define-skeleton jao-skel-scsh + "Scsh script skeleton" + "Brief description: " + "#! " (executable-find "scsh") " \\" \n + "-e " (file-name-nondirectory (buffer-file-name)) " -s" \n + "!#" \n \n + ";;;; " str \n + "(define (" (file-name-nondirectory (buffer-file-name)) " args)" + \n + > _ " )" + > \n \n \n + ";; Local Variables:" \n + ";; mode: scheme" \n + ";; End:" + '(hack-local-variables) + \n \n) + +(provide 'scsh-skel) + + +;;; scsh-skel.el ends here diff --git a/lib/skels/texinfo-skel.el b/lib/skels/texinfo-skel.el new file mode 100644 index 0000000..dc73835 --- /dev/null +++ b/lib/skels/texinfo-skel.el @@ -0,0 +1,131 @@ +;;; texinfo-skel.el --- skeletons for texinfo files + +;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> +;; Keywords: languages + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; Skeletons to generate texinfo files templates. + +;;; Code: + +(require 'common-skel) + +(defun jao-dir-entry () + "Read dir file entry" + (let ((cat (read-string "Dir file category: ")) + (ent (read-string "Direntry name: ")) + (desc (read-string "Direntry description: "))) + (concat "@dircategory " cat + "\n@direntry\n" ent + ": (" (jao-basename) "). " desc "." + "\n@end direntry\n"))) + +(define-skeleton jao-skel-main-texinfo + "Main texinfo file skeleton" + "Document title: " + "\\input texinfo" + \n "@ignore" > + \n (jao-scm-line "") + "@end ignore" > + \n > "@c %**start of header" + \n "@setfilename " (jao-basename) ".info" > + \n "@settitle " str > + \n "@syncodeindex pg cp" > + \n "@setchapternewpage odd" > + \n "@footnotestyle separate" > + \n "@c %**end of header" > + \n \n + (jao-dir-entry) + \n + "@set UPDATED " (format-time-string "%B %Y") + \n "@set EDITION 0.1" + \n "@set VERSION 0.1" + \n "@set AUTHOR " (user-full-name) + \n \n "@copying" + \n "This manual is for " str " (version @value{VERSION}, @value{UPDATED})." + \n + \n "Copyright @copyright{} " (format-time-string "%Y") " " jao-company-name + \n + \n "@quotation" + \n "Permission is granted to copy, distribute and/or modify this document" + \n "under the terms of the GNU Free Documentation License, Version 1.1 or" + \n "any later version published by the Free Software Foundation; with no" + \n "Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''" + \n "and with the Back-Cover Texts as in (a) below. A copy of the" + \n "license is included in the section entitled ``GNU Free Documentation" + \n "License.''" + \n + \n "(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify" + \n "this GNU Manual, like GNU software. Copies published by the Free" + \n "Software Foundation raise funds for GNU development.''" + \n "@end quotation" + \n "@end copying" + \n \n "@titlepage" + \n "@title " str + \n "@subtitle Edition @value{EDITION}, for version @value{VERSION}" + \n "@subtitle @value{UPDATED}" + \n "@author by @value{AUTHOR} (@email{jao@@gnu.org})" + \n "@page" + \n "@vskip 0pt plus 1filll" + \n "@insertcopying" + \n "@end titlepage" + \n + \n "@shortcontents" + \n "@contents" + \n + \n "@ifnottex" + \n "@node Top, , (dir), (dir)" + \n \n "@insertcopying" + \n "@end ifnottex" + \n \n + "@menu" > \n "@detailmenu" \n \n > "@end detailmenu" > \n "@end menu" + \n \n \n + "@include intro.texi" > + \n \n \n + "@bye" + \n) + +(define-skeleton jao-skel-child-texinfo + "Template for child texinfo docs" + "Node name: " + "@node " str \n + > "@chapter " str \n + > "@ignore" \n + (jao-scm-line "") + > "@end ignore" \n \n + _ \n \n + "@c This is part of the " (read-string "Main doc title: ") \n + "@c See the main file for copying conditions." + \n \n) + +(define-skeleton jao-skel-texinfo + "Skeleton for texinfo files" + nil + '(if (y-or-n-p "Is this the main texinfo file? ") + (jao-skel-main-texinfo) + (jao-skel-child-texinfo)) + _) + +(add-to-list 'auto-insert-alist '("\\.texi$" . jao-texinfo-skel)) + + +(provide 'texinfo-skel) + + +;;; texinfo-skel.el ends here |