Save yourself some license template copypasta (in emacs)

Add this to your .emacs

(defun insert-mpl-tri-license () (interactive)
  (insert 
"/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-\n"
" * vim: sw=2 ts=8 et :\n"
" */\n"
"/* ***** BEGIN LICENSE BLOCK *****\n"
" * Version: MPL 1.1/GPL 2.0/LGPL 2.1\n"
" *\n"
" * The contents of this file are subject to the Mozilla Public License Version\n"
" * 1.1 (the \"License\"); you may not use this file except in compliance with\n"
" * the License. You may obtain a copy of the License at:\n"
" * http://www.mozilla.org/MPL/\n"
" *\n"
" * Software distributed under the License is distributed on an \"AS IS\" basis,\n"
" * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\n"
" * for the specific language governing rights and limitations under the\n"
" * License.\n"
" *\n"
" * The Original Code is Mozilla Code.\n"
" *\n"
" * The Initial Developer of the Original Code is\n"
" *   The Mozilla Foundation\n"
" * Portions created by the Initial Developer are Copyright (C) 2010\n"
" * the Initial Developer. All Rights Reserved.\n"
" *\n"
" * Contributor(s):\n"
" *   [YOUR NAME/EMAIL HERE]\n"
" *\n"
" * Alternatively, the contents of this file may be used under the terms of\n"
" * either the GNU General Public License Version 2 or later (the \"GPL\"), or\n"
" * the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"),\n"
" * in which case the provisions of the GPL or the LGPL are applicable instead\n"
" * of those above. If you wish to allow use of your version of this file only\n"
" * under the terms of either the GPL or the LGPL, and not to allow others to\n"
" * use your version of this file under the terms of the MPL, indicate your\n"
" * decision by deleting the provisions above and replace them with the notice\n"
" * and other provisions required by the GPL or the LGPL. If you do not delete\n"
" * the provisions above, a recipient may use your version of this file under\n"
" * the terms of any one of the MPL, the GPL or the LGPL.\n"
" *\n"
" * ***** END LICENSE BLOCK ***** */\n"))
(global-set-key "\C-xg" 'insert-mpl-tri-license)

(replacing “[YOUR NAME/EMAIL HERE]” of course), then “C-x g” to victory.

Comments (5)

  1. Josh Matthews wrote::

    <3

    Thursday, March 25, 2010 at 00:34 #
  2. Well, that works for files that use C-style comments, at least ;-)

    Thursday, March 25, 2010 at 03:42 #
  3. Gerv wrote::

    Note that this only works as-is if you are a MoCo/MoFo/MoMo employee or contractor. Otherwise, you need to make yourself or your employer the Initial Developer.

    Otherwise, cool :-)

    Thursday, March 25, 2010 at 05:24 #
  4. Joseph wrote::

    I have a set of commands that insert boilerplate license info http://digitasaru.net/computers/.emacs.shtml

    You’ll need to change my name to yours, natch. :)

    Thursday, March 25, 2010 at 06:36 #
  5. Josh wrote::

    Have you looked at yasnippet (http://code.google.com/p/yasnippet/)?

    Thursday, March 25, 2010 at 08:49 #