(Emacs/elisp/license)~Update license names, +URLs to LICENSE text

Now copyright notices can point to a URL instead of my email.
This commit is contained in:
2024-07-01 04:13:59 +01:00
parent 0ef894049b
commit 2d92763005
2 changed files with 21 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
;;; Directory Local Variables -*- no-byte-compile: t; -*- ;;; Directory Local Variables -*- no-byte-compile: t; -*-
;;; For more information see (info "(emacs) Directory Variables") ;;; For more information see (info "(emacs) Directory Variables")
((nil . ((+license/license-choice . "MIT")))) ((nil . ((+license/license-choice . "MIT License"))))

View File

@@ -24,7 +24,7 @@
(defvar +license/license-choice nil) (defvar +license/license-choice nil)
(defconst +license/licenses-alist (defconst +license/licenses-alist
`(("MIT" ,(format "MIT License `(("MIT License" (,(format "MIT License
Copyright (c) %s %s Copyright (c) %s %s
@@ -44,8 +44,8 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE." (format-time-string "%Y") user-full-name)) SOFTWARE." (format-time-string "%Y") user-full-name) "https://opensource.org/license/MIT"))
("GPLv2" " GNU GENERAL PUBLIC LICENSE ("GNU General Public License Version 2" (" GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
@@ -382,8 +382,8 @@ This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.") Public License instead of this License." "https://www.gnu.org/licenses/"))
("Unlicense" "This is free and unencumbered software released into the public domain. ("Unlicense" ("This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled distribute this software, either in source code form or as a compiled
@@ -406,13 +406,14 @@ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>"))) For more information, please refer to <https://unlicense.org>" "https://unlicense.org/"))))
(defun +license/choose-copy-of-license () (defun +license/choose-copy-of-license ()
(interactive) (interactive)
(let ((choice (completing-read "Choose license: " (mapcar #'car +license/licenses-alist) (let ((choice (completing-read "Choose license: " (mapcar #'car +license/licenses-alist)
nil t))) nil t)))
(car (alist-get choice +license/licenses-alist "" nil #'string=)))) (caar (alist-get choice +license/licenses-alist "" nil #'string=))))
(defun +license/copyright-notice () (defun +license/copyright-notice ()
(let ((license-name (if (listp +license/license-choice) (let ((license-name (if (listp +license/license-choice)
@@ -421,12 +422,18 @@ For more information, please refer to <https://unlicense.org>")))
(concat (concat
(format "Copyright (C) %s %s\n\n" (format-time-string "%Y") user-full-name) (format "Copyright (C) %s %s\n\n" (format-time-string "%Y") user-full-name)
(if license-name (if license-name
(format "You may distribute and modify this code under the terms of the %s (let ((url (cadar (alist-get license-name +license/licenses-alist "" nil #'string=))))
license. You should have received a copy of the %s license with (format "This program is distributed in the hope that it will be useful,
this file. If not, please write to: %s." but WITHOUT ANY WARRANTY; without even the implied warranty of
license-name MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %s
license-name for details.
user-mail-address)
You may distribute and modify this code under the terms of the
%s, which you should have received a copy of along with this
program. If not, please go to <%s>."
license-name
license-name
url))
(format (format
"All rights reserved. You may not distribute or modify this code "All rights reserved. You may not distribute or modify this code
without explicit legal permission from the author \"%s\"" without explicit legal permission from the author \"%s\""