annotate lisp/emacs-lisp/copyright.el @ 10219:d97313bb6f39

(bibtex-string, bibtex-preamble): Use forward-line. (sort-subr): Don't call autload for this--that's done in loaddefs.el. (bibtex-mode): Add autoload cookie. Changed keybinding for bibtex-print-help-message (from \C-ch to \C-c?). Therefore, describe-mode is not longer on \C-c?. Also, changed prefix \C-cn for bibtex-narrow functions to \C-c\C-r. (bibtex-string-files): Changed documentation. (bibtex-mode-map): Inscriptions of menu bar changed from "Entry Types" to "Entry-Types" and "Bibtex Edit" to "BibTeX-Edit". (bibtex-string-files): Changed documentation. (bibtex-mode): If environment variable BIBINPUTS isn't defined, string files are searched in the current directory. (bibtex-completion-candidates): Now buffer-local to allow evaluation of different bibtex-string-files in different buffers. (bibtex-autokey-edit-before-use, bibtex-clean-entry): New variable that determines, if the user is allowed to edit auto-generated reference keys before they are used. (bibtex-generate-autokey, bibtex-clean-entry): New function to generate an autokey if necessary. (bibtex-autokey-names, bibtex-autokey-name-change-strings, bibtex-autokey-name-length, bibtex-autokey-name-separator, bibtex-autokey-year-length, bibtex-autokey-titlewords, bibtex-autokey-title-terminators, bibtex-autokey-titlewords-stretch, bibtex-autokey-titleword-first-ignore, bibtex-autokey-titleword-abbrevs, bibtex-autokey-titleword-change-strings, bibtex-autokey-titleword-length, bibtex-autokey-titleword-separator, bibtex-autokey-name-year-separator, bibtex-autokey-year-title-separator): New variables related to bibtex-generate-autokey. (bibtex-find-entry-location): Optional second parameter maybedup to tell it that entering a duplicate entry isn't to report by an error but by the return value of the function (necessary for bibtex-clean-entry to find the correct position of an entry with an autogenerated key without disturbing the user with unwanted messages). (bibtex-help-message): New variable to avoid printing of help messages in the echo area. (assoc-of-regexp): New function to match an alist of regexps. (bibtex-string-files, bibtex-completion-candidates, bibtex-mode): New variables to allow bibtex-complete-string to work on strings initialized from a variable and from @String definitions in a list of files, too. (bibtex-predefined-strings, bibtex-entry-field-alist): Changed to user options. (bibtex-mode): Changed doc string. (many functions and variables): Changed documentation strings of variables and functions to hold a complete sentence in the first line. (bibtex-print-help-message): Now line dependent and reports if it is called outside a BibTeX field. (validate-bibtex-buffer): Completely rewritten to validate, if buffer is syntactically correct. (find-bibtex-duplicates): Moved into validate-bibtex-buffer. (ispell-abstract, bibtex-ispell-abstract, ispell-bibtex-entry, bibtex-ispell-entry, beginning-of-bibtex-entry, bibtex-beginning-of-entry, end-of-bibtex-entry, bibtex-end-of-entry, hide-bibtex-entry-bodies, bibtex-hide-entry-bodies, narrow-to-bibtex-entry, bibtex-narrow-to-entry, sort-bibtex-entries, bibtex-sort-entries, validate-bibtex-buffer, bibtex-validate-buffer, find-bibtex-entry-location, bibtex-find-entry-location): All interactive functions are renamed, so that any interface function begins with "bibtex-". Mapping: ispell-abstract --> bibtex-ispell-abstract ispell-bibtex-entry --> bibtex-ispell-entry beginning-of-bibtex-entry --> bibtex-beginning-of-entry end-of-bibtex-entry --> bibtex-end-of-entry hide-bibtex-entry-bodies --> bibtex-hide-entry-bodies narrow-to-bibtex-entry --> bibtex-narrow-to-entry sort-bibtex-entries --> bibtex-sort-entries validate-bibtex-buffer --> bibtex-validate-buffer find-bibtex-entry-location --> bibtex-find-entry-location (bibtex-maintain-sorted-entries, bibtex-sort-ignore-string-entries): Default is now t. (bibtex-complete-string): String list is built from additional string list bibtex-predefined-string and current strings in file. (string-equalp): Deleted and substituted by string-equal. (assoc-string-equalp): Renamed to assoc-ignore-case. (bibtex-entry): Reference key can be entered with completion. All reference keys that are defined in buffer and all labels that appear in crossreference entries are object to completion. (Entry types): Changed order of entries in menu "entry types". (bibtex-entry-field-alist): Changed order of entries slightly to be more conform with standard BibTeX style layouts. (bibtex-mode-map): Uniform keybindings for \C-c\C-e prefix (often used types on control keys, sometimes used types on normal keys, rarely used types on shift keys, almost never used types on meta keys). (bibtex-mode-map): Function narrow-to-bibtex-entry and counterpart widen and function hide-bibtex-entry-bodies and counterpart show-all bounded to appropriate local keys. (bibtex-abbrev-table): Deleted (bibtex-current-entry-label, put-string-on-kill-ring): Deleted (AUCTeX provides all the functionality needed for citation completion). (bibtex-enclosing-reference, bibtex-pop-previous, bibtex-pop-next, bibtex-clean-entry): Hacked for speed (bibtex-pop-previous and bibtex-pop-next were to slow for larger BibTeX files). (bibtex-pop-previous, bibtex-pop-next): Delimiters from previous or next entry are changed to actual delimters if necessary. (bibtex-entry): Fixed bug (False entry wasn't reported in error message if bibtex-entry was called with undefined reference name). (bibtex-entry-field-alist, bibtex-entry, bibtex-make-field, bibtex-next-field, bibtex-clean-entry): Every reference entry now contains a comment in addition to the name of the reference. This comment appears in the echo area if you start editing that field (after calling bibtex-next-field). (bibtex-include-OPTcrossref, bibtex-entry): Changed bibtex-include-OPTcrossref from single boolean variable to hold a list of reference names which should have a crossref field. (bibtex-complete-word): New function, which completes word fragment before point to the longest prefix of predefined strings in the buffer in the same way that ispell-complete-word operates for words found in the dictionary. (bibtex-reference-head): Start of bibtex-reference-head changed from "^[ \t]*\\(" to "^\\( \\|\t\\)*\\(" (bibtex-pop-previous and bibtex-pop-next didn't work, probably due to a bug in re-search-forward). (several functions): Added support for {} as field delimiters (better than '"' for accented characters. (bibtex-clean-entry): If optional field crossref is empty or missing, former optional fields (if bibtex-include-OPTcrossref was t) are necessary again. bibtex-clean-entry complains if they are empty but not if they are missing, so you can intenionally omit them, e. g. for a pseudo @Journal entry (needed for crossreferences) made out of an @article with missing non-optional fields. Menu bar entries aren't centered anymore.
author Richard M. Stallman <rms@gnu.org>
date Fri, 23 Dec 1994 04:18:29 +0000
parents 089ea68c1fdb
children 3070ab43f748
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
792
45d748a65f24 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 773
diff changeset
1 ;;; upd-copyr.el --- update the copyright notice in a GNU Emacs Lisp file
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 611
diff changeset
2
5603
f369023b3cc3 (update-copyright): Wrap final copyright-matching regexp in parens, so \1
Roland McGrath <roland@gnu.org>
parents: 4647
diff changeset
3 ;;; Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
773
9c89fd7ddd41 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 718
diff changeset
5 ;; Author: Roland McGrath <roland@gnu.ai.mit.edu>
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 792
diff changeset
6 ;; Keywords: maint
773
9c89fd7ddd41 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 718
diff changeset
7
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
8 ;;; This file is part of GNU Emacs.
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
9
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
10 ;;; This program is free software; you can redistribute it and/or modify
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
11 ;;; it under the terms of the GNU General Public License as published by
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
12 ;;; the Free Software Foundation; either version 2, or (at your option)
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
13 ;;; any later version.
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
14 ;;;
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
15 ;;; This program is distributed in the hope that it will be useful,
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
18 ;;; GNU General Public License for more details.
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
19 ;;;
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
20 ;;; A copy of the GNU General Public License can be obtained from this
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
21 ;;; program's author (send electronic mail to roland@ai.mit.edu) or from
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
22 ;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
23 ;;; 02139, USA.
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
24
773
9c89fd7ddd41 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 718
diff changeset
25 ;;; Code:
9c89fd7ddd41 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 718
diff changeset
26
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
27 (defconst current-year (substring (current-time-string) -4)
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
28 "String representing the current year.")
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
29
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
30 (defvar current-gpl-version "2"
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
31 "String representing the current version of the GPL.")
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
32
290
56fa777d299a *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 288
diff changeset
33 ;;;###autoload
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
34 (defvar replace-copying-with nil
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
35 "*If non-nil, replace copying notices with this file.")
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
36
718
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
37 (defvar inhibit-update-copyright nil
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
38 "If nil, ask the user whether or not to update the copyright notice.
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
39 If the user has said no, we set this to t locally.")
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
40
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
41 ;;;###autoload
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
42 (defun update-copyright (&optional replace ask-upd ask-year)
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
43 "Update the copyright notice at the beginning of the buffer
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
44 to indicate the current year. If optional arg REPLACE is given
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
45 \(interactively, with prefix arg\) replace the years in the notice
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
46 rather than adding the current year after them.
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
47 If `replace-copying-with' is set, the copying permissions following the
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
48 copyright are replaced as well.
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
49
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
50 If optional third argument ASK is non-nil, the user is prompted for whether
1754
71e65e9d4f86 (update-copyright): Doc fix.
Roland McGrath <roland@gnu.org>
parents: 841
diff changeset
51 or not to update the copyright. If optional fourth argument ASK-YEAR is
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
52 non-nil, the user is prompted for whether or not to replace the year rather
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
53 than adding to it."
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
54 (interactive "*P")
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
55 (save-excursion
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
56 (save-restriction
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
57 (widen)
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
58 (goto-char (point-min))
4647
4becc54c89df (update-copyright): Handle two-digit years with apostrophes.
Roland McGrath <roland@gnu.org>
parents: 1754
diff changeset
59 ;; Handle abbreviated year lists like "1800, 01, 02, 03"
4becc54c89df (update-copyright): Handle two-digit years with apostrophes.
Roland McGrath <roland@gnu.org>
parents: 1754
diff changeset
60 ;; or "1900, '01, '02, '03".
4becc54c89df (update-copyright): Handle two-digit years with apostrophes.
Roland McGrath <roland@gnu.org>
parents: 1754
diff changeset
61 (if (re-search-forward (concat "\\(" (substring current-year 0 2)
4becc54c89df (update-copyright): Handle two-digit years with apostrophes.
Roland McGrath <roland@gnu.org>
parents: 1754
diff changeset
62 "\\)?"
4becc54c89df (update-copyright): Handle two-digit years with apostrophes.
Roland McGrath <roland@gnu.org>
parents: 1754
diff changeset
63 "\\([0-9][0-9]\\(,\\s \\)+\\)*'?"
718
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
64 (substring current-year 2))
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
65 nil t)
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
66 (or ask-upd
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
67 (message "Copyright notice already includes %s." current-year))
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
68 (goto-char (point-min))
718
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
69 (if (and (not inhibit-update-copyright)
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
70 (or (not ask-upd)
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
71 ;; If implicit, narrow it down to things that
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
72 ;; look like GPL notices.
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
73 (prog1
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
74 (search-forward "is free software" nil t)
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
75 (goto-char (point-min))))
718
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
76 (re-search-forward
5603
f369023b3cc3 (update-copyright): Wrap final copyright-matching regexp in parens, so \1
Roland McGrath <roland@gnu.org>
parents: 4647
diff changeset
77 "[Cc]opyright[^0-9]*\\(\\(\\([-, \t]*\\([0-9]+\\)\\)\\)+\\)"
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
78 nil t)
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
79 (or (not ask-upd)
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
80 (save-window-excursion
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
81 (pop-to-buffer (current-buffer))
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
82 (save-excursion
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
83 ;; Show the user the copyright.
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
84 (goto-char (point-min))
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
85 (sit-for 0)
718
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
86 (or (y-or-n-p "Update copyright? ")
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
87 (progn
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
88 (set (make-local-variable
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
89 'inhibit-update-copyright) t)
2011f5e67975 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 657
diff changeset
90 nil))))))
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
91 (progn
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
92 (setq replace
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
93 (or replace
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
94 (and ask-year
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
95 (save-window-excursion
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
96 (pop-to-buffer (current-buffer))
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
97 (save-excursion
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
98 ;; Show the user the copyright.
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
99 (goto-char (point-min))
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
100 (sit-for 0)
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
101 (y-or-n-p "Replace copyright year? "))))))
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
102 (if replace
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
103 (delete-region (match-beginning 1) (match-end 1))
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
104 (insert ", "))
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
105 (insert current-year)
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
106 (message "Copyright updated to %s%s."
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
107 (if replace "" "include ") current-year)
611
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
108 (if replace-copying-with
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
109 (let ((case-fold-search t)
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
110 beg)
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
111 (goto-char (point-min))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
112 ;; Find the beginning of the copyright.
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
113 (if (search-forward "copyright" nil t)
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
114 (progn
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
115 ;; Look for a blank line or a line
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
116 ;; containing only comment chars.
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
117 (if (re-search-forward "^\\(\\s \\s<\\|\\s>\\)*$" nil t)
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
118 (forward-line 1)
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
119 (with-output-to-temp-buffer "*Help*"
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
120 (princ (substitute-command-keys "\
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
121 I don't know where the copying notice begins.
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
122 Put point there and hit \\[exit-recursive-edit]."))
9844
089ea68c1fdb (update-copyright): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 5603
diff changeset
123 (save-excursion
089ea68c1fdb (update-copyright): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 5603
diff changeset
124 (set-buffer standard-output)
089ea68c1fdb (update-copyright): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 5603
diff changeset
125 (help-mode))
611
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
126 (recursive-edit)))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
127 (setq beg (point))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
128 (or (search-forward "02139, USA." nil t)
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
129 (with-output-to-temp-buffer "*Help*"
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
130 (princ (substitute-command-keys "\
291
7baca7c86dc1 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 290
diff changeset
131 I don't know where the copying notice ends.
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
132 Put point there and hit \\[exit-recursive-edit]."))
9844
089ea68c1fdb (update-copyright): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 5603
diff changeset
133 (save-excursion
089ea68c1fdb (update-copyright): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 5603
diff changeset
134 (set-buffer standard-output)
089ea68c1fdb (update-copyright): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 5603
diff changeset
135 (help-mode))
611
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
136 (recursive-edit)))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
137 (delete-region beg (point))))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
138 (insert-file replace-copying-with))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
139 (if (re-search-forward
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
140 "; either version \\(.+\\), or (at your option)"
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
141 nil t)
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
142 (progn
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
143 (goto-char (match-beginning 1))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
144 (delete-region (point) (match-end 1))
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
145 (insert current-gpl-version))))
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
146 (or ask-upd
611
10b56d2a2c2b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 581
diff changeset
147 (error "This buffer contains no copyright notice!"))))))))
581
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
148
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
149 ;;;###autoload
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
150 (defun ask-to-update-copyright ()
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
151 "If the current buffer contains a copyright notice that is out of date,
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
152 ask the user if it should be updated with `update-copyright' (which see).
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
153 Put this on write-file-hooks."
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
154 (update-copyright nil t t)
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
155 ;; Be sure return nil; if a write-file-hook return non-nil,
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
156 ;; the file is presumed to be already written.
e7dd969ff98b *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 291
diff changeset
157 nil)
288
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
158
5c0f837c0287 Initial revision
Roland McGrath <roland@gnu.org>
parents:
diff changeset
159 (provide 'upd-copyr)
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 611
diff changeset
160
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 611
diff changeset
161 ;;; upd-copyr.el ends here