unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] etc: Add copyright.
@ 2017-12-20 14:40 Oleg Pykhalov
  2017-12-20 15:26 ` Oleg Pykhalov
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Pykhalov @ 2017-12-20 14:40 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: [PATCH] etc: Add copyright. --]
[-- Type: text/x-patch, Size: 3289 bytes --]

From f8df6a8059878e9b61c7b211e854194c56c74efc Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Wed, 20 Dec 2017 16:57:37 +0300
Subject: [PATCH] etc: Add copyright.

* etc/copyright.el: New file.
* doc/contributing.texi (The Perfect Setup): Document copyright.
---
 doc/contributing.texi | 27 +++++++++++++++++++++++++++
 etc/copyright.el      | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 etc/copyright.el

diff --git a/doc/contributing.texi b/doc/contributing.texi
index 01f8aad9f..5b72b1c40 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -221,6 +221,33 @@ trigger string @code{origin...}, which can be expanded further.  The
 @code{origin} snippet in turn may insert other trigger strings ending on
 @code{...}, which also can be expanded further.
 
+@cindex insert or update copyright
+@cindex @code{M-x guix-copyright}
+@cindex @code{M-x copyright-update}
+Additionaly we provide insertion and automatic update of a copyright in
+@file{etc/copyright.el}.  You may want to set your full name, mail, and
+load a file.
+
+@lisp
+(setq user-full-name "NAME")
+(setq user-mail-address "EMAIL")
+;; @r{Assuming the Guix checkout is in ~/src/guix.}
+(load-file "~/src/guix/etc/copyright.el")
+@end lisp
+
+To insert a copyright at the current line invoke @code{M-x guix-copyright}.
+
+To update a copyright you need to specify a @code{copyright-names-regexp}.
+
+@lisp
+(setq copyright-names-regexp
+      (format "%s <%s>" user-full-name user-mail-address))
+@end lisp
+
+You can check if your copyright is up to date by evaluating @code{M-x
+copyright-update}.  If you want to do it automatically after each buffer
+save then add @code{(add-hook 'after-save-hook 'copyright-update)} in
+Emacs.
 
 @node Coding Style
 @section Coding Style
diff --git a/etc/copyright.el b/etc/copyright.el
new file mode 100644
index 000000000..9f6b773b1
--- /dev/null
+++ b/etc/copyright.el
@@ -0,0 +1,34 @@
+;;; copyright.el --- Insert a Guix copyright.
+
+;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
+
+;; This file is part of GNU Guix.
+
+;; GNU Guix 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.
+
+;; GNU Guix 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:
+
+;; This package provides skeleton to insert a copyright with `guix-copyright'.
+
+;;; Code:
+
+(define-skeleton guix-copyright
+  "Insert a copyright by $USER notice at cursor."
+  "FULL_NAME <MAIL_ADDRESS>: "
+  comment-start
+  ";; Copyright © " `(format-time-string "%Y") " "
+  (or (format "%s <%s>" user-full-name user-mail-address) str)
+  comment-end)
+
+;;; copyright.el ends here
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] etc: Add copyright.
  2017-12-20 14:40 [PATCH] etc: Add copyright Oleg Pykhalov
@ 2017-12-20 15:26 ` Oleg Pykhalov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Pykhalov @ 2017-12-20 15:26 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

Oleg Pykhalov <go.wigust@gmail.com> writes:

[...]

> +save then add @code{(add-hook 'after-save-hook 'copyright-update)} in

Probably better before-save-hook.

[...]

Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-20 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20 14:40 [PATCH] etc: Add copyright Oleg Pykhalov
2017-12-20 15:26 ` Oleg Pykhalov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).