diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-09-28 15:31:34 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-09-28 15:31:34 +0100 |
commit | 2c1f1858b7425257725ca2da8c176cf5616557a1 (patch) | |
tree | d7b7a70f5edc1f3b7d7709f3594d02fd7f6603a2 | |
parent | 249e3f0dcaeaf6394abb757082a0a4d57f19917a (diff) | |
download | dotfiles-2c1f1858b7425257725ca2da8c176cf5616557a1.tar.gz dotfiles-2c1f1858b7425257725ca2da8c176cf5616557a1.tar.bz2 dotfiles-2c1f1858b7425257725ca2da8c176cf5616557a1.zip |
(Emacs)~license.el now has a function to insert copyright notices
For the top of source code blocks.
-rw-r--r-- | Emacs/.config/emacs/elisp/license.el | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Emacs/.config/emacs/elisp/license.el b/Emacs/.config/emacs/elisp/license.el index 084f202..cb48e47 100644 --- a/Emacs/.config/emacs/elisp/license.el +++ b/Emacs/.config/emacs/elisp/license.el @@ -24,6 +24,8 @@ ;;; Code: +(defvar +license/license-choice nil) + (defconst +license/licenses-alist `(("MIT" ,(format "MIT License @@ -410,12 +412,28 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <https://unlicense.org>"))) -(defun +license/insert-license () +(defun +license/insert-complete-license () (interactive) (let ((choice (completing-read "Choose license: " (mapcar #'car +license/licenses-alist) nil t))) (insert (car (alist-get choice +license/licenses-alist "" nil #'string=))))) +(defun +license/insert-copyright-notice () + (interactive) + (let ((license-name (or (if (listp +license/license-choice) + (car +license/license-choice) + +license/license-choice) + "Unlicense"))) + (insert (format "Copyright (C) %s %s + +You may distribute and modify this code under the terms of the %s license. + +You should have received a copy of the %s license with this file. If not, please write to: %s." + (format-time-string "%Y") + user-full-name + license-name + license-name + user-mail-address)))) (provide 'license) ;;; license.el ends here |