annotate lisp/emacs-lisp/copyright.el @ 43351:043ec968d20b

(idlwave-mode): Do not use make-local-hook.
author Pavel Janík <Pavel@Janik.cz>
date Sat, 16 Feb 2002 12:53:42 +0000
parents 717543e790e1
children 09736ff1baa6 d7ddb3e565de ef4c8f452558
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
1 ;;; copyright.el --- update the copyright notice in current buffer
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 611
diff changeset
2
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
3 ;; Copyright (C) 1991, 92, 93, 94, 95, 98, 2001 Free Software Foundation, Inc.
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
23869
8d2bb5d1416a Update comment.
Karl Heuer <kwzh@gnu.org>
parents: 22580
diff changeset
5 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
6 ;; Keywords: maint, tools
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
7
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
8 ;; This file is part of GNU Emacs.
773
9c89fd7ddd41 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 718
diff changeset
9
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
13 ;; any later version.
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
14
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
18 ;; GNU General Public License for more details.
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
19
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
23 ;; Boston, MA 02111-1307, USA.
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
24
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
25 ;;; Commentary:
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
26
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
27 ;; Allows updating the copyright year and above mentioned GPL version manually
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
28 ;; or when saving a file. Do (add-hook 'write-file-hooks 'copyright-update).
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
29
773
9c89fd7ddd41 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 718
diff changeset
30 ;;; Code:
9c89fd7ddd41 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 718
diff changeset
31
21328
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
32 (defgroup copyright nil
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
33 "Update the copyright notice in current buffer."
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
34 :group 'tools)
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
35
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
36 (defcustom copyright-limit 2000
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
37 "*Don't try to update copyright beyond this position unless interactive.
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
38 A value of nil means to search whole buffer."
21328
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
39 :group 'copyright
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
40 :type '(choice (integer :tag "Limit")
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
41 (const :tag "No limit")))
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
42
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
43 ;; Would it be cleaner to specify Latin-1 coding for this file,
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
44 ;; and not use both unibyte and multibyte copyright symbol characters?
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
45
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
46 ;; The character classes include the unibyte (C) sign,
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
47 ;; the Latin-1 version, and the Latin-9 version.
21328
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
48 (defcustom copyright-regexp
43169
717543e790e1 (copyright-regexp): Delete the unibyte copyright symbol; it's redundant.
Richard M. Stallman <rms@gnu.org>
parents: 42892
diff changeset
49 "\\([]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
717543e790e1 (copyright-regexp): Delete the unibyte copyright symbol; it's redundant.
Richard M. Stallman <rms@gnu.org>
parents: 42892
diff changeset
50 \\|[Cc]opyright\\s *:?\\s *[]\\)\
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
51 \\s *\\([1-9]\\([-0-9, ';\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
52 "*What your copyright notice looks like.
21328
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
53 The second \\( \\) construct must match the years."
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
54 :group 'copyright
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
55 :type 'regexp)
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
56
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
57
21328
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
58 (defcustom copyright-query 'function
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
59 "*If non-nil, ask user before changing copyright.
21328
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
60 When this is `function', only ask when called non-interactively."
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
61 :group 'copyright
d5ffccfcea21 Customized.
Andreas Schwab <schwab@suse.de>
parents: 19108
diff changeset
62 :type '(choice (const :tag "Do not ask")
22580
a191ee97be00 (copyright-query): Use `other' widget
Andreas Schwab <schwab@suse.de>
parents: 21754
diff changeset
63 (const :tag "Ask unless interactive" function)
a191ee97be00 (copyright-query): Use `other' widget
Andreas Schwab <schwab@suse.de>
parents: 21754
diff changeset
64 (other :tag "Ask" t)))
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
65
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
66
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13684
diff changeset
67 ;; when modifying this, also modify the comment generated by autoinsert.el
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
68 (defconst copyright-current-gpl-version "2"
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
69 "String representing the current version of the GPL or nil.")
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
70
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
71 (defvar copyright-update t)
718
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
72
35129
9f38c893ea39 (copyright-current-year): Now a defvar.
Eli Zaretskii <eliz@gnu.org>
parents: 27329
diff changeset
73 ;; This is a defvar rather than a defconst, because the year can
9f38c893ea39 (copyright-current-year): Now a defvar.
Eli Zaretskii <eliz@gnu.org>
parents: 27329
diff changeset
74 ;; change during the Emacs session.
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
75 (defvar copyright-current-year (substring (current-time-string) -4)
35129
9f38c893ea39 (copyright-current-year): Now a defvar.
Eli Zaretskii <eliz@gnu.org>
parents: 27329
diff changeset
76 "String representing the current year.")
9f38c893ea39 (copyright-current-year): Now a defvar.
Eli Zaretskii <eliz@gnu.org>
parents: 27329
diff changeset
77
9f38c893ea39 (copyright-current-year): Now a defvar.
Eli Zaretskii <eliz@gnu.org>
parents: 27329
diff changeset
78
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
79 ;;;###autoload
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
80 (defun copyright-update (&optional arg)
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
81 "Update copyright notice at beginning of buffer to indicate the current year.
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
82 With prefix ARG, replace the years in the notice rather than adding
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
83 the current year after them. If necessary, and
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
84 `copyright-current-gpl-version' is set, any copying permissions
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
85 following the copyright are updated as well."
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
86 (interactive "*P")
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
87 (if copyright-update
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
88 (save-excursion
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
89 (save-restriction
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
90 (widen)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
91 (goto-char (point-min))
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
92 ;; Note that `current-time-string' isn't locale-sensitive.
35129
9f38c893ea39 (copyright-current-year): Now a defvar.
Eli Zaretskii <eliz@gnu.org>
parents: 27329
diff changeset
93 (setq copyright-current-year (substring (current-time-string) -4))
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
94 (if (re-search-forward copyright-regexp copyright-limit t)
13684
0263e1d2888e (copyright-regexp): Recognize ISO copyright symbol.
Karl Heuer <kwzh@gnu.org>
parents: 12518
diff changeset
95 (if (string= (buffer-substring (- (match-end 2) 2) (match-end 2))
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
96 (substring copyright-current-year -2))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
97 ()
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
98 (if (or (not copyright-query)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
99 (and (eq copyright-query 'function)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
100 (eq this-command 'copyright-update))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
101 (y-or-n-p (if arg
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
102 (concat "Replace copyright year(s) by "
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
103 copyright-current-year "? ")
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
104 (concat "Add " copyright-current-year
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
105 " to copyright? "))))
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
106 (if arg
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
107 (progn
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
108 (delete-region (match-beginning 1) (match-end 1))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
109 (insert copyright-current-year))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
110 (setq arg (save-excursion (skip-chars-backward "0-9")))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
111 (if (and (eq (% (- (string-to-number
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
112 copyright-current-year)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
113 (string-to-number (buffer-substring
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
114 (+ (point) arg)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
115 (point))))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
116 100)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
117 1)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
118 (or (eq (char-after (+ (point) arg -1)) ?-)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
119 (eq (char-after (+ (point) arg -2)) ?-)))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
120 (delete-char arg)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
121 (insert ", ")
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
122 (if (eq (char-after (+ (point) arg -3)) ?')
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
123 (insert ?')))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
124 (insert (substring copyright-current-year arg))))))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
125 (goto-char (point-min))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
126 (and copyright-current-gpl-version
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
127 ;; match the GPL version comment in .el files, including the
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
128 ;; bilingual Esperanto one in two-column, and in texinfo.tex
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
129 (re-search-forward "\\(the Free Software Foundation;\
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
130 either \\|; a\\^u eldono \\([0-9]+\\)a, ? a\\^u (la\\^u via \\)\
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
131 version \\([0-9]+\\), or (at"
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
132 copyright-limit t)
42732
7db08aae2e67 (copyright-regexp): Make (C) optional.
Richard M. Stallman <rms@gnu.org>
parents: 42533
diff changeset
133 (not (string= (match-string 3) copyright-current-gpl-version))
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
134 (or (not copyright-query)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
135 (and (eq copyright-query 'function)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
136 (eq this-command 'copyright-update))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
137 (y-or-n-p (concat "Replace GPL version by "
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
138 copyright-current-gpl-version "? ")))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
139 (progn
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
140 (if (match-end 2)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
141 ;; Esperanto bilingual comment in two-column.el
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
142 (progn
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
143 (delete-region (match-beginning 2) (match-end 2))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
144 (goto-char (match-beginning 2))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
145 (insert copyright-current-gpl-version)))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
146 (delete-region (match-beginning 3) (match-end 3))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
147 (goto-char (match-beginning 3))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
148 (insert copyright-current-gpl-version))))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
149 (set (make-local-variable 'copyright-update) nil)))
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
150 ;; If a write-file-hook returns non-nil, the file is presumed to be written.
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
151 nil)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
152
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
153
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
154 ;;;###autoload
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
155 (define-skeleton copyright
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
156 "Insert a copyright by $ORGANIZATION notice at cursor."
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
157 "Company: "
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
158 comment-start
35129
9f38c893ea39 (copyright-current-year): Now a defvar.
Eli Zaretskii <eliz@gnu.org>
parents: 27329
diff changeset
159 "Copyright (C) " `(substring (current-time-string) -4) " by "
12503
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
160 (or (getenv "ORGANIZATION")
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
161 str)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
162 '(if (> (point) copyright-limit)
f77164f5bc6b New name for generalized upd-copyr.el
Karl Heuer <kwzh@gnu.org>
parents: 10510
diff changeset
163 (message "Copyright extends beyond `copyright-limit' and won't be updated automatically."))
39764
fb28cd06b2f6 (copyright): Add final \n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38436
diff changeset
164 comment-end \n)
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
165
18383
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 17977
diff changeset
166 (provide 'copyright)
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 17977
diff changeset
167
27229
fdaa887d0f8f Tag as emacs-mule coding.
Dave Love <fx@gnu.org>
parents: 23869
diff changeset
168 ;; For the copyright sign:
fdaa887d0f8f Tag as emacs-mule coding.
Dave Love <fx@gnu.org>
parents: 23869
diff changeset
169 ;; Local Variables:
fdaa887d0f8f Tag as emacs-mule coding.
Dave Love <fx@gnu.org>
parents: 23869
diff changeset
170 ;; coding: emacs-mule
fdaa887d0f8f Tag as emacs-mule coding.
Dave Love <fx@gnu.org>
parents: 23869
diff changeset
171 ;; End:
fdaa887d0f8f Tag as emacs-mule coding.
Dave Love <fx@gnu.org>
parents: 23869
diff changeset
172
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 35129
diff changeset
173 ;;; copyright.el ends here