]> jturnerusa.dev Git - emacs.d/commitdiff
created some small functions to insert license headers into buffers
authorJohn Turner <jturner.usa@gmail.com>
Fri, 23 Dec 2022 02:31:26 +0000 (21:31 -0500)
committerJohn Turner <jturner.usa@gmail.com>
Fri, 23 Dec 2022 02:42:07 +0000 (21:42 -0500)
init.el
lisp/license-boilerplate/license-boilerplate.el [new file with mode: 0644]

diff --git a/init.el b/init.el
index 44aae92c305fe6b50d01adedbd780dd8cc777981..afbab3c15378b93da746195700c880774a3a55e4 100644 (file)
--- a/init.el
+++ b/init.el
@@ -74,6 +74,7 @@
 
 (require 'man-completion)
 
+(require 'license-boilerplate)
 
 (when (file-exists-p custom-file)
   (load custom-file))
diff --git a/lisp/license-boilerplate/license-boilerplate.el b/lisp/license-boilerplate/license-boilerplate.el
new file mode 100644 (file)
index 0000000..7cbbbaf
--- /dev/null
@@ -0,0 +1,33 @@
+(defgroup license-boilerplate nil
+  "A small script for inserting license boilerplate text into source files.")
+
+(defcustom license-boilerplate-copyright-author
+  nil
+  "The value to insert into the Copyright line."
+  :group 'license-boilerplate
+  :type 'string)
+
+(defun license-boilerplate-gpl-3 ()
+  (interactive)
+  (save-excursion
+    (let ((saved-point (point)))
+      (insert (format "Copyright (C) %s" (format-time-string "%Y")))
+      (when-let ((author license-boilerplate-copyright-author))
+        (insert (format " %s" author)))
+      (insert "\n")
+      (insert "\
+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 <https://www.gnu.org/licenses/>.")
+      (comment-region saved-point (point)))))
+
+(provide 'license-boilerplate)