Commit | Line | Data |
---|---|---|
66fd374b | 1 | ;;; authors.el --- utility for maintaining Emacs' AUTHORS file -*-coding: iso-2022-7bit;-*- |
3215096c | 2 | |
f39caf44 | 3 | ;; Copyright (C) 2000, 2003 Free Software Foundation, Inc. |
3215096c | 4 | |
60e8e0a5 | 5 | ;; Author: Gerd Moellmann <gerd@gnu.org> |
f39caf44 | 6 | ;; Maintainer: Kim F. Storm <storm@cua.dk> |
60e8e0a5 GM |
7 | ;; Keywords: maint |
8 | ||
3215096c GM |
9 | ;; This file is part of GNU Emacs. |
10 | ||
11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 | ;; it under the terms of the GNU General Public License as published by | |
13 | ;; the Free Software Foundation; either version 2, or (at your option) | |
14 | ;; any later version. | |
15 | ||
16 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;; GNU General Public License for more details. | |
20 | ||
21 | ;; You should have received a copy of the GNU General Public License | |
22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 | ;; Boston, MA 02111-1307, USA. | |
25 | ||
26 | ;;; Commentary: | |
27 | ||
28 | ;; Use M-x authors RET to create an *Authors* buffer that can used as | |
29 | ;; or merged with Emacs' AUTHORS file. | |
30 | ||
31 | ;;; Code: | |
32 | ||
f39caf44 KS |
33 | (defvar authors-coding-system 'iso-2022-7bit |
34 | "Coding system used in the AUTHORS file.") | |
35 | ||
3215096c GM |
36 | (defconst authors-many-files 20 |
37 | "Maximum number of files for which to print individual information. | |
f39caf44 KS |
38 | If an author has modified more files, only the names of the most |
39 | frequently modified files are printed and a count of the additional | |
40 | files.") | |
3215096c GM |
41 | |
42 | (defconst authors-aliases | |
f39caf44 | 43 | '( |
f39caf44 KS |
44 | ("Barry A. Warsaw" "Barry A. Warsaw, Century Computing, Inc." |
45 | "Barry A. Warsaw, ITB" "Barry Warsaw") | |
46 | ("Bj\e,Av\e(Brn Torkelsson" "Bjorn Torkelsson") | |
47 | ("Brian Fox" "Brian J. Fox") | |
48 | ("Christoph Wedler" "Christoph.Wedler@sap.com") | |
49 | ("Daniel Pfeiffer" "<Daniel.Pfeiffer@Informatik.START.db.de>" | |
50 | "<Daniel.Pfeiffer@Informatik.START.dbp.de>") | |
51 | ("David Gillespie" "Dave Gillespie") | |
52 | ("David K\e,Ae\e(Bgedal" "David K..edal") | |
53 | ("David M. Koppelman" "David M. Koppelman, Koppel@Ee.Lsu.Edu") | |
d0f483e8 KS |
54 | ("David M. Smith" "David Smith" "David M Smith") |
55 | ("Ed L. Cashin" "Ed L Cashin") | |
f39caf44 KS |
56 | ("Edward M. Reingold" "Ed Reingold" "Edward M Reingold" |
57 | "Reingold Edward M") | |
58 | ("Eli Zaretskii" "eliz") | |
4ee02020 | 59 | ("Emilio C. Lopes" "Emilio Lopes") |
d0f483e8 | 60 | ("Era Eriksson" "Era@Iki.Fi") |
f39caf44 KS |
61 | ("Eric M. Ludlam" "Eric Ludlam") |
62 | ("Eric S. Raymond" "Eric Raymond") | |
63 | ("Eric Youngdale" "(Eric Youngdale at youngdale@v6550c.nrl.navy.mil)") | |
d0f483e8 | 64 | ("Francis J. Wright" "Dr Francis J. Wright" "Francis Wright") |
f39caf44 | 65 | ("Fran\e,Ag\e(Bois Pinard" "Francois Pinard") |
97c437db | 66 | ("Francesco Potort\e,Al\e(B" "Francesco Potorti" "Francesco Potorti`") |
f39caf44 KS |
67 | ("Frederic Pierresteguy" "Fred Pierresteguy") |
68 | ("Geoff Voelker" "voelker") | |
69 | ("Hallvard B. Furuseth" "Hallvard B Furuseth") | |
d0f483e8 | 70 | ("Hrvoje Nik\e,B9\e(Bi\e,Bf\e(B" "Hrvoje Niksic") |
f39caf44 KS |
71 | (nil "(afs@hplb.hpl.hp.com)") |
72 | (nil "<Use-Author-Address-Header@\\[127.1\\]>") | |
73 | (nil "Code Extracted") | |
74 | (nil "Fsf") | |
75 | (nil "ISO-2022-JP") | |
76 | ("Jaeyoun Chung" "Jae-youn Chung" "Jae-you Chung" "Chung Jae-youn") | |
77 | ("Jan Dj\e,Ad\e(Brv" "Jan D." "Jan Djarv") | |
d0f483e8 KS |
78 | ("Jay K. Adams" "jka@ece.cmu.edu" "Jay Adams") |
79 | ("J\e,Ai\e(Br\e,At\e(Bme Marant" "J\e,bi\e(Br\e,bt\e(Bme Marant" "Jerome Marant") | |
f39caf44 | 80 | ("Jens-Ulrik Holger Petersen" "Jens-Ulrik Petersen") |
4ee02020 | 81 | ("John W. Eaton" "John Eaton") |
f39caf44 KS |
82 | ("Jonathan I. Kamens" "Jonathan Kamens") |
83 | ("Joseph Arceneaux" "Joe Arceneaux") | |
4ee02020 | 84 | ("Juan Le\e,As\e(Bn Lahoz Garc\e,Am\e(Ba" "Juan-Leon Lahoz Garcia") |
f39caf44 KS |
85 | ("K. Shane Hartman" "Shane Hartman") |
86 | ("Kai Gro\e,A_\e(Bjohann" "Kai Grossjohann" "Kai Gro\e,b_\e(Bjohann" | |
d0f483e8 KS |
87 | "Kai.Grossjohann@Cs.Uni-Dortmund.De" |
88 | "Kai.Grossjohann@Gmx.Net") | |
f39caf44 | 89 | ("Karl Berry" "K. Berry") |
d0f483e8 | 90 | ("Kazushi Marukawa" "Kazushi") |
f39caf44 KS |
91 | ("Ken Manheimer" "Kenneth Manheimer") |
92 | ("Kenichi Handa" "Ken'ichi Handa" "Kenichi HANDA") | |
4ee02020 | 93 | ("Kevin Greiner" "Kevin J. Greiner") |
f39caf44 | 94 | ("Kim F. Storm" "Kim Storm") |
d0f483e8 | 95 | ("Kyle Jones" "Kyle E. Jones") |
f39caf44 | 96 | ("Marcus G. Daniels" "Marcus Daniels") |
d0f483e8 KS |
97 | ("Mark D. Baushke" "Mark D Baushke") |
98 | ("Martin Lorentzon" "Martin Lorentzson") | |
99 | ("Matt Swift" "Matthew Swift") | |
4ee02020 | 100 | ("Michael R. Mauger" "Michael Mauger") |
f39caf44 KS |
101 | ("Michael D. Ernst" "Michael Ernst") |
102 | ("Michael I. Bushnell" "Michael I Bushnell" "Michael I. Bushnell, P/Bsg") | |
4ee02020 | 103 | ("Mikio Nakajima" "Nakajima Mikio") |
f39caf44 KS |
104 | ("Paul Eggert" "eggert") |
105 | ("Paul Reilly" "(pmr@legacy.pajato.com)") | |
d0f483e8 | 106 | ("Pavel Jan\e,Bm\e(Bk" "Pavel Jan\e,Am\e(Bk Ml." "Pavel Jan\e,Am\e(Bk" "Pavel@Janik.Cz") |
f39caf44 | 107 | ("Per Abrahamsen" "Per Abhiddenware") |
d0f483e8 KS |
108 | ("Peter S. Galbraith" "Peter Galbraith") |
109 | ("Peter Runestig" "Peter 'luna' Runestig") | |
f39caf44 KS |
110 | ("Peter S. Galbraith" "Peter S Galbraith") |
111 | ("Richard M. Stallman" "Richard M. Stallman,,," "Richard Stallman" | |
a1506d29 | 112 | "rms" "rms@gnu.org") |
f39caf44 KS |
113 | ("Robert J. Chassell" "Bob Chassell") |
114 | ("Roland B. Roberts" "Roland B Roberts" "Roland Roberts") | |
115 | ("Rui-Tao Dong" "Rui-Tao Dong ~{6-Hpln~}") | |
116 | ("Sam Steingold" "Sam Shteingold") | |
d0f483e8 | 117 | ("Stefan Monnier" "Stefan") |
f39caf44 KS |
118 | ("Stephen A. Wood" "(saw@cebaf.gov)") |
119 | ("Steven L. Baur" "SL Baur" "Steven L Baur") | |
120 | ("Takaaki Ota" "Tak Ota") | |
4ee02020 | 121 | ("Takahashi Naoto" "Naoto Takahashi") |
d0f483e8 | 122 | ("Teodor Zlatanov" "Ted Zlatanov") |
f39caf44 KS |
123 | ("Torbj\e,Av\e(Brn Axelsson" "Torbjvrn Axelsson") |
124 | ("Torbj\e,Av\e(Brn Einarsson" "Torbj.*rn Einarsson") | |
125 | ("Toru Tomabechi" "Toru Tomabechi,") | |
126 | ("Vincent Del Vecchio" "Vince Del Vecchio") | |
127 | ("Wlodzimierz Bzyl" "W.*dek Bzyl") | |
128 | ("Yutaka NIIBE" "NIIBE Yutaka") | |
d5ab63b2 | 129 | ) |
3215096c GM |
130 | "Alist of author aliases. |
131 | ||
f39caf44 | 132 | Each entry is of the form (REALNAME REGEXP...). If an author's name |
a1506d29 | 133 | matches one of the REGEXPs, use REALNAME instead. |
f39caf44 | 134 | If REALNAME is nil, ignore that author.") |
3215096c GM |
135 | |
136 | ||
0a521885 GM |
137 | (defvar authors-public-domain-files |
138 | '("auto-show\\.el" | |
139 | "form-d2\\.el" | |
140 | "emerge\\.el" | |
141 | "unused\\.el" | |
142 | "vi\\.el" | |
143 | "feedmail\\.el" | |
144 | "mailpost\\.el" | |
145 | "hanoi\\.el" | |
146 | "meese\\.el" | |
147 | "studly\\.el" | |
148 | "modula2\\.el") | |
149 | "List of regexps matching files for which the FSF doesn't need papers.") | |
150 | ||
151 | ||
8a5506f2 GM |
152 | (defvar authors-obsolete-files-regexps |
153 | '("vc-\\*\\.el$" | |
154 | "spec.txt$" | |
155 | "vc-\\(rcs\\|cvs\\|sccs\\)-hooks\\.el$") | |
156 | "List of regexps matching obsolete files. | |
157 | Changes to files matching one of the regexps in this list are not | |
158 | listed.") | |
159 | ||
4ee02020 KS |
160 | (defconst authors-ignored-files |
161 | '("external-lisp" | |
162 | "lock" "share-lib" "local-lisp" | |
163 | "noleim-Makefile.in" | |
164 | "NEWS" "PROBLEMS" "FAQ") | |
165 | "List of files and directories to ignore. | |
166 | Changes to files in this list are not listed.") | |
8a5506f2 | 167 | |
d5ab63b2 | 168 | (defconst authors-fixed-entries |
f39caf44 KS |
169 | '(("Richard M. Stallman" :wrote "[The original GNU emacs and numerous files]") |
170 | ("Joseph Arceneaux" :wrote "xrdb.c") | |
d5ab63b2 GM |
171 | ("Blitz Product Development Corporation" :wrote "ispell.el") |
172 | ("Frank Bresz" :wrote "diff.el") | |
173 | ("David M. Brown" :wrote "array.el") | |
174 | ("Gary Byers" :changed "xenix.h") | |
175 | ("Shawn M. Carey" :wrote "freebsd.h") | |
176 | ("Eric Decker" :changed "hp9000s800.h" "hpux.h" "sysdep.c") | |
177 | ("Lawrence R. Dodd" :wrote "dired-x.el") | |
178 | ("Viktor Dukhovni" :wrote "unexsunos4.c") | |
179 | ("Paul Eggert" :wrote "rcs2log" "vcdiff") | |
180 | ("Fred Fish" :changed "unexec.c") | |
181 | ("Tim Fleehart" :wrote "makefile.nt") | |
182 | ("Keith Gabryelski" :wrote "hexl.c") | |
183 | ("Kevin Gallagher" :wrote "flow-ctrl.el") | |
184 | ("Howard Gayle" :wrote "disp-table.el" "iso-syntax.el" "casetab.c") | |
185 | ("Stephen Gildea" :wrote "refcard.tex" "mh-funcs.el" "mh-pick.el") | |
186 | ("David Gillespie" :wrote "cl.texinfo") | |
187 | ("Hewlett-Packard" :changed "emacsclient.c" "emacsserver.c" | |
188 | "server.el" "keyboard.c") | |
189 | ("Thomas Horsley" :wrote "cxux.h" "cxux7.h") | |
190 | ("Indiana University Foundation" :changed "buffer.c" "buffer.h" | |
191 | "indent.c" "search.c" "xdisp.c" "region-cache.c" "region-cache.h") | |
192 | ("International Business Machines" :changed "emacs.c" "fileio.c" | |
193 | "ibmrt.h" "process.c" "sysdep.c" "unexec.c" "ibmrt-aix.h") | |
194 | ("Ishikawa Chiaki" :changed "aviion.h" "dgux.h") | |
195 | ("Michael K. Johnson" :changed "configure.in" "emacs.c" "intel386.h" | |
196 | "mem-limits.h" "process.c" "template.h" "sysdep.c" "syssignal.h" "systty.h" "unexec.c" | |
197 | "ymakefile" "linux.h") | |
198 | ("Kyle E. Jones" :wrote "mldrag.el") | |
4ee02020 | 199 | ("Henry Kautz" :wrote "bib-mode.el") |
d5ab63b2 GM |
200 | ("Joseph M. Kelsey" :changed "fileio.c" "vms-pwd.h" "vmsfns.c" "dir.h" |
201 | "uaf.h") | |
202 | ("Sam Kendall" :changed "etags.c" "etags.el") | |
203 | ("Richard King" :wrote "backquote.el" "userlock.el" "filelock.c") | |
204 | ("Larry Kolodney" :wrote "cvtmail.c") | |
205 | ("Sebastian Kremer" :changed "add-log.el") | |
206 | ("Mark Lambert" :changed "process.c" "process.h") | |
207 | ("Aaron Larson" :changed "bibtex.el") | |
208 | ("James R. Larus" :wrote "mh-e.el") | |
209 | ("Lars Lindberg" :changed "dabbrev.el" :wrote "imenu.el") | |
210 | ("Lucid, Inc." :changed "bytecode.c" "byte-opt.el" "byte-run.el" | |
211 | "bytecomp.el" "delsel.el" "disass.el" "faces.el" "font-lock.el" | |
212 | "lmenu.el" "lselect.el" "mailabbrev.el" "select.el" "xfaces.c" | |
213 | "xselect.c") | |
214 | ("MCC" :changed "etags.c" "emacsclient.c" "emacsserver.c" "movemail.c" | |
215 | "rmail.el" "rmailedit.el" "rmailkwd.el" | |
216 | "rmailmsc.el" "rmailout.el" "rmailsum.el" "scribe.el" | |
217 | "server.el" "lisp.h" "sysdep.c" "unexec.c" :wrote "xmenu.c") | |
218 | ("Niall Mansfield" :changed "etags.c") | |
219 | ("Brian Marick" :wrote "hideif.el") | |
220 | ("Marko Kohtala" :changed "info.el") | |
221 | ("Sidney Markowitz" :changed "doctor.el") | |
222 | ("Richard Mlynarik" :wrote "env.c" "ehelp.el") | |
223 | ("Mosur Mohan" :changed "etags.c") | |
224 | ("Jeff Morgenthaler" :changed "flow-ctrl.el" "vt200.el" "vt201.el" | |
225 | "vt220.el" "vt240.el") | |
226 | ("Motorola" :changed "buff-menu.el") | |
227 | ("Hiroshi Nakano" :changed "ralloc.c") | |
228 | ("Sundar Narasimhan" :changed "rnewspost.el") | |
229 | ("NeXT, Inc." :wrote "unexnext.c") | |
230 | ("Mark Neale" :changed "fortran.el") | |
231 | ("Martin Neitzel" :changed "sc.el") | |
232 | ("Andrew Oram" :changed "miscellaneous changes to files in man/" | |
233 | "man/calendar.texi") | |
234 | ("Frederic Pierresteguy" :wrote "widget.c") | |
235 | ("Michael D. Prange" :changed "tex-mode.el") | |
236 | ("Paul Reilly" :wrote "gux5-4r2.h" "dgux5-4r3.h") | |
d0f483e8 | 237 | ("Roland B. Roberts" :changed "files.el" "sort.el" "vmsproc.el" |
d5ab63b2 GM |
238 | "buffer.h" "callproc.c" "dired.c" "process.c" "sysdep.c" "systty.h" |
239 | "vmspaths.h" "build.com" "compile.com" "kepteditor.com" "precomp.com" | |
240 | :wrote "logout.com" "mailemacs.com") | |
241 | ("Guillermo J. Rozas" :wrote "fakemail.c") | |
242 | ("Wolfgang Rupprecht" :changed "lisp-mode.el" "loadup.el" | |
243 | "sort.el" "alloc.c" "callint.c" | |
244 | "config.h.in" "crt0.c" "data.c" "fns.c" | |
245 | "lisp.h" "lread.c" "sun3.h" | |
246 | "print.c" "ymakefile" :wrote "float-sup.el" "floatfns.c") | |
247 | ("Schlumberger Technology Corporation" :changed "gud.el") | |
248 | ("Gregor Schmid" :wrote "tcl-mode.el") | |
249 | ("Rainer Schoepf" :wrote "alpha.h" "unexalpha.c") | |
250 | ("William Sommerfeld" :wrote "emacsclient.c" "emacsserver.c" "scribe.el") | |
251 | ("Leigh Stoller" :changed "emacsclient.c" "emacsserver.c" "server.el") | |
252 | ("Steve Strassman" :wrote "spook.el") | |
253 | ("Shinichirou Sugou" :changed "etags.c") | |
254 | ("Sun Microsystems, Inc" :changed "emacsclient.c" "emacsserver.c" | |
255 | "server.el" :wrote "emacs.icon" "emacstool.1" "emacstool.c" "sun-curs.el" | |
256 | "sun-fns.el" "sun-mouse.el" "sun.el" "sunfns.c") | |
257 | ("Kayvan Sylvan" :changed "sc.el") | |
258 | ("Spencer Thomas" :changed "emacsclient.c" "emacsserver.c" "server.el" | |
259 | "dabbrev.el" "unexec.c" "tcp.c" "gnus.texi") | |
260 | ("Jonathan Vail" :changed "vc.el") | |
261 | ("James Van Artsdalen" :changed "usg5-4.h" "unexec.c") | |
262 | ("Geoff Voelker" :wrote "src/makefile.nt" "lisp/makefile.nt" "winnt.el" | |
263 | "nt.c" "nt.h" "ntheap.c" "ntheap.h" "ntinevt.c" | |
264 | "ntproc.c" "ntterm.c" "windowsnt.h") | |
265 | ("Morten Welinder" :wrote "dosfns.c" "[many MSDOS files]" "msdos.h") | |
266 | ("Pace Willisson" :wrote "ispell.el") | |
267 | ("Garrett Wollman" :changed "sendmail.el") | |
268 | ("Dale Worley" :changed "mail-extr.el") | |
269 | ("Jamie Zawinski" :changed "bytecode.c" :wrote "disass.el" "tar-mode.el")) | |
270 | "Actions taken from the original, manually (un)maintained AUTHORS file.") | |
271 | ||
272 | ||
f39caf44 KS |
273 | (defconst authors-valid-file-names |
274 | '("aclocal.m4" | |
4ee02020 KS |
275 | "makedist.bat" |
276 | "make-delta") | |
f39caf44 KS |
277 | "File names which are valid, but no longer exists (or cannot be |
278 | found) in the repository.") | |
279 | ||
280 | (defconst authors-renamed-files-alist | |
281 | '(("nt.c" . "w32.c") ("nt.h" . "w32.h") | |
282 | ("ntheap.c" . "w32heap.c") ("ntheap.h" . "w32heap.h") | |
283 | ("ntinevt.c" . "w32inevt.c") ("ntinevt.h" . "w32inevt.h") | |
284 | ("ntproc.c" . "w32proc.c") | |
285 | ("w32console.c" . "w32term.c") | |
286 | ("unexnt.c" . "unexw32.c") | |
287 | ("s/windowsnt.h" . "s/ms-w32.h") | |
288 | ("config.emacs" . "configure") | |
289 | ("GETTING.GNU.SOFTWARE" . "FTP") | |
4ee02020 KS |
290 | ("leim-Makefile" . "leim/Makefile") |
291 | ("leim-Makefile.in" . "leim/Makefile.in") | |
292 | ("INSTALL-CVS" . "INSTALL.CVS") | |
f39caf44 KS |
293 | ) |
294 | "Alist of files which have been renamed during their lifetime. | |
295 | Elements are (OLDNAME . NEWNAME).") | |
296 | ||
297 | (defconst authors-renamed-files-regexps | |
298 | '(("^m/m-\\(.*\\.h\\)$" . "m/\\1") | |
299 | ("^m-\\(.*\\.h\\)$" . "\\1") | |
300 | ("^s/s-\\(.*\\.h\\)$" . "s/\\1") | |
301 | ("^s-\\(.*\\.h\\)$" . "\\1") | |
302 | ("^s/[-.a-zA-Z0-9_]+\\.h$" . t) | |
303 | ("\\(.*\\)\\.cmd$" . "\\1.bat") | |
304 | ("\\.bat$" . t) | |
305 | ("\\.[ch]$" . t) | |
306 | ("\\.el$" . t) | |
307 | ("\\.ps$" . t) | |
308 | ("\\.texi?$" . t) | |
309 | ("\\.texinfo$" . t) | |
310 | ("\\.xml?$" . t) | |
311 | ("\\.x[pb]m$" . t) | |
312 | ("\\.[xp]bm$" . t) | |
313 | ("^paths\\." . t) | |
314 | ("^install\\." . t) | |
315 | ) | |
316 | "List regexps and rewriting rules for renamed files. | |
317 | Elements are (REGEXP . REPLACE). If REPLACE is a string, the file | |
318 | name matching REGEXP is replaced by REPLACE using `replace-string'. | |
319 | Otherwise, the file name is accepted as is.") | |
320 | ||
321 | (defvar authors-checked-files-alist) | |
322 | (defvar authors-invalid-file-names) | |
323 | ||
324 | (defun authors-canonical-file-name (file log-file pos author) | |
325 | "Return canonical file name for FILE found in LOG-FILE at POS for AUTHOR. | |
326 | Checks whether FILE is a valid (existing) file name, has been renamed, | |
327 | or is on the list of removed files. Returns the non-diretory part of | |
328 | the file name." | |
329 | (let ((entry (assoc file authors-checked-files-alist)) | |
330 | relname | |
331 | valid) | |
332 | (if entry | |
333 | (cdr entry) | |
334 | (setq relname (file-name-nondirectory file)) | |
335 | (if (or (member relname authors-valid-file-names) | |
336 | (file-exists-p file) | |
337 | (file-exists-p relname) | |
338 | (file-exists-p (concat "etc/" relname))) | |
339 | (setq valid relname) | |
340 | (setq valid (assoc file authors-renamed-files-alist)) | |
341 | (if valid | |
342 | (setq valid (cdr valid)) | |
343 | (let ((rules authors-renamed-files-regexps)) | |
344 | (while rules | |
345 | (if (string-match (car (car rules)) file) | |
346 | (setq valid (if (stringp (cdr (car rules))) | |
347 | (file-name-nondirectory | |
348 | (replace-match (cdr (car rules)) t nil file)) | |
349 | relname) | |
350 | rules nil)) | |
351 | (setq rules (cdr rules)))))) | |
352 | (setq authors-checked-files-alist | |
353 | (cons (cons file valid) authors-checked-files-alist)) | |
354 | (unless valid | |
a1506d29 | 355 | (setq authors-invalid-file-names |
f39caf44 KS |
356 | (cons (format "%s:%d: unrecognized `%s' for %s" |
357 | log-file | |
358 | (1+ (count-lines (point-min) pos)) | |
359 | file author) | |
360 | authors-invalid-file-names))) | |
361 | valid))) | |
362 | ||
d5ab63b2 GM |
363 | (defun authors-add-fixed-entries (table) |
364 | "Add actions from `authors-fixed-entries' to TABLE." | |
365 | (dolist (entry authors-fixed-entries) | |
366 | (let ((author (car entry)) | |
367 | action) | |
368 | (dolist (item (cdr entry)) | |
369 | (if (symbolp item) | |
370 | (setq action item) | |
371 | (authors-add author item action table)))))) | |
372 | ||
3932b29a | 373 | |
8a5506f2 GM |
374 | (defun authors-obsolete-file-p (file) |
375 | "Return non-nil if FILE is obsolete. | |
3932b29a | 376 | FILE is considered obsolete if it matches one of the regular expressions |
8a5506f2 GM |
377 | from `authors-obsolete-files-regexps'." |
378 | (let (obsolete-p | |
379 | (regexps authors-obsolete-files-regexps)) | |
380 | (while (and regexps (not obsolete-p)) | |
381 | (setq obsolete-p (string-match (car regexps) file) | |
382 | regexps (cdr regexps))) | |
383 | obsolete-p)) | |
384 | ||
385 | ||
3215096c GM |
386 | (defun authors-add (author file action table) |
387 | "Record that AUTHOR worked on FILE. | |
388 | ACTION is a keyword symbol describing what he did. Record file, | |
389 | author and what he did in hash table TABLE. See the description of | |
390 | `authors-scan-change-log' for the structure of the hash table." | |
4ee02020 KS |
391 | (unless (or (member file authors-ignored-files) |
392 | (authors-obsolete-file-p file) | |
9c1af546 | 393 | (equal author "")) |
8a5506f2 | 394 | (let* ((value (gethash author table)) |
f39caf44 KS |
395 | (entry (assoc file value)) |
396 | slot) | |
8a5506f2 | 397 | (if (null entry) |
f39caf44 KS |
398 | (puthash author (cons (list file (cons action 1)) value) table) |
399 | (if (setq slot (assoc action (cdr entry))) | |
400 | (setcdr slot (1+ (cdr slot))) | |
401 | (nconc entry (list (cons action 1)))))))) | |
3215096c GM |
402 | |
403 | ||
404 | (defun authors-process-lines (program &rest args) | |
405 | "Execute PROGRAM with ARGS, returning its output as a list of lines. | |
406 | Signal an error if the program returns with a non-zero exit status." | |
407 | (with-temp-buffer | |
408 | (let ((status (apply 'call-process program nil (current-buffer) nil args))) | |
409 | (unless (eq status 0) | |
410 | (error "%s exited with status %s" program status)) | |
411 | (goto-char (point-min)) | |
412 | (let (lines) | |
413 | (while (not (eobp)) | |
414 | (setq lines (cons (buffer-substring-no-properties | |
415 | (line-beginning-position) | |
416 | (line-end-position)) | |
417 | lines)) | |
418 | (forward-line 1)) | |
419 | (nreverse lines))))) | |
420 | ||
421 | ||
422 | (defun authors-canonical-author-name (author) | |
423 | "Return a canonicalized form of AUTHOR, an author name. | |
424 | If AUTHOR has an alias, use that. Remove email addresses. Capitalize | |
425 | words in the author's name." | |
f39caf44 KS |
426 | (let* ((aliases authors-aliases) |
427 | regexps realname) | |
3215096c | 428 | (while aliases |
f39caf44 KS |
429 | (setq realname (car (car aliases)) |
430 | regexps (cdr (car aliases)) | |
431 | aliases (cdr aliases)) | |
432 | (while regexps | |
433 | (if (string-match (car regexps) author) | |
434 | (setq author realname | |
435 | regexps nil | |
436 | aliases nil) | |
437 | (setq regexps (cdr regexps)))))) | |
438 | (when author | |
439 | (setq author (replace-regexp-in-string "[ \t]*[(<].*$" "" author)) | |
d0f483e8 | 440 | (setq author (replace-regexp-in-string "\`[ \t]+" "" author)) |
f39caf44 | 441 | (setq author (replace-regexp-in-string "[ \t]+$" "" author)) |
d0f483e8 KS |
442 | (setq author (replace-regexp-in-string "[ \t]+" " " author)) |
443 | (unless (string-match "[-, \t]" author) | |
444 | (setq author "")) | |
f39caf44 KS |
445 | (capitalize author))) |
446 | ||
f39caf44 KS |
447 | (defun authors-scan-change-log (log-file table) |
448 | "Scan change log LOG-FILE for author information. | |
3215096c GM |
449 | |
450 | For each change mentioned in the log, add an entry to hash table TABLE | |
451 | under the author's canonical name. | |
452 | ||
453 | Keys of TABLE are author names. Values are alists of entries (FILE | |
f39caf44 KS |
454 | \(ACTION . COUNT) ...). FILE is one file the author worked on. The |
455 | rest of the entry is a list of keyword symbols describing what he did | |
456 | with the file and the number of each action. | |
3215096c GM |
457 | |
458 | :wrote means the author wrote the file | |
f39caf44 | 459 | :changed means he changed the file COUNT times." |
3932b29a | 460 | |
3215096c GM |
461 | (let* ((enable-local-variables t) |
462 | (enable-local-eval t) | |
f39caf44 KS |
463 | (existing-buffer (get-file-buffer log-file)) |
464 | (buffer (find-file-noselect log-file)) | |
465 | author file pos) | |
3215096c GM |
466 | (save-excursion |
467 | (set-buffer buffer) | |
468 | (save-restriction | |
469 | (widen) | |
470 | (goto-char (point-min)) | |
471 | (while (re-search-forward "^[0-9]\\|^[ \t]+\\* " nil t) | |
472 | (beginning-of-line) | |
f39caf44 | 473 | (setq pos (point)) |
3215096c GM |
474 | (cond ((looking-at "^[0-9]+-[0-9]+-[0-9]+") |
475 | (skip-chars-forward " \t+:0-9-") | |
476 | (setq author (buffer-substring-no-properties | |
477 | (point) (line-end-position))) | |
478 | (setq author (authors-canonical-author-name author)) | |
479 | (forward-line 1)) | |
480 | ((looking-at "^[ \t]+\\*") | |
481 | (let ((line (buffer-substring-no-properties | |
482 | (match-end 0) (line-end-position)))) | |
483 | (while (and (not (string-match ":" line)) | |
484 | (forward-line 1) | |
485 | (not (looking-at ":\\|^[ \t]*$"))) | |
486 | (setq line (concat line | |
487 | (buffer-substring-no-properties | |
488 | (line-beginning-position) | |
489 | (line-end-position))))) | |
490 | (when (string-match ":" line) | |
491 | (setq line (substring line 0 (match-beginning 0))) | |
492 | (setq line (replace-regexp-in-string "[[(<{].*$" "" line)) | |
493 | (setq line (replace-regexp-in-string "," "" line)) | |
494 | (dolist (file (split-string line)) | |
f39caf44 KS |
495 | (when (setq file (authors-canonical-file-name file log-file pos author)) |
496 | ;;(message "%s changed %s" author file) | |
497 | (authors-add author file :changed table)))) | |
3215096c GM |
498 | (forward-line 1))))))) |
499 | (unless existing-buffer | |
500 | (kill-buffer buffer)))) | |
501 | ||
502 | ||
503 | (defun authors-scan-el (file table) | |
504 | "Scan Lisp file FILE for author information. | |
505 | TABLE is a hash table to add author information to." | |
506 | (let* ((existing-buffer (get-file-buffer file)) | |
507 | (enable-local-variables t) | |
508 | (enable-local-eval t) | |
509 | (buffer (find-file-noselect file))) | |
510 | (save-excursion | |
511 | (set-buffer buffer) | |
512 | (save-restriction | |
513 | (widen) | |
514 | (goto-char (point-min)) | |
515 | (while (and (re-search-forward | |
516 | "^;+[ \t]*\\(Author\\|Commentary\\):[ \t]*" nil t) | |
517 | (not (string= (match-string 1) "Commentary"))) | |
518 | ;; Some entries contain a year range in front of the | |
519 | ;; author's name. | |
520 | (skip-chars-forward "-0-9 \t") | |
521 | (let ((author (buffer-substring-no-properties | |
522 | (point) (line-end-position)))) | |
523 | (setq author (authors-canonical-author-name author)) | |
524 | (setq file (file-name-nondirectory file)) | |
525 | (authors-add author file :wrote table))))) | |
526 | (unless existing-buffer | |
527 | (kill-buffer buffer)))) | |
528 | ||
529 | ||
0a521885 GM |
530 | (defun authors-public-domain-p (file) |
531 | "Return t if FILE is a file that was put in public domain." | |
532 | (let ((public-domain-p nil) | |
533 | (list authors-public-domain-files)) | |
534 | (while (and list (not public-domain-p)) | |
535 | (when (string-match (car list) file) | |
536 | (setq public-domain-p t)) | |
537 | (setq list (cdr list))) | |
538 | public-domain-p)) | |
539 | ||
f39caf44 KS |
540 | (defvar authors-author-list) |
541 | ||
542 | (defun authors-add-to-author-list (author changes) | |
543 | "Insert information about AUTHOR's work on Emacs into `authors-author-list'. | |
544 | CHANGES is an alist of entries (FILE (ACTION . COUNT) ...), as produced by | |
545 | `authors-scan-change-log'. | |
546 | The element added to `authors-author-list' is (AUTHOR WROTE CHANGED), where | |
a1506d29 | 547 | WROTE and CHANGED are lists of the files written and changed by AUTHOR." |
f39caf44 KS |
548 | (when author |
549 | (let ((nchanged 0) | |
550 | wrote-list | |
551 | changed-list) | |
3215096c GM |
552 | (dolist (change changes) |
553 | (let ((actions (cdr change)) | |
f39caf44 KS |
554 | (file (car change)) |
555 | slot) | |
556 | (if (assq :wrote actions) | |
557 | (setq wrote-list | |
558 | (cons | |
559 | (if (authors-public-domain-p file) | |
560 | (concat file " (public domain)") | |
561 | file) | |
562 | wrote-list)) | |
563 | (setq changed-list | |
564 | (cons (cons file (cdr (assq :changed actions))) | |
565 | changed-list))))) | |
566 | (if wrote-list | |
567 | (setq wrote-list (sort wrote-list 'string-lessp))) | |
568 | (when changed-list | |
569 | (setq changed-list (sort changed-list | |
570 | (lambda (a b) | |
571 | (if (= (cdr a) (cdr b)) | |
572 | (string-lessp (car a) (car b)) | |
573 | (> (cdr a) (cdr b)))))) | |
574 | (setq nchanged (length changed-list)) | |
575 | (setq changed-list (mapcar 'car changed-list))) | |
576 | (if (> (- nchanged authors-many-files) 2) | |
577 | (setcdr (nthcdr authors-many-files changed-list) | |
578 | (list (format "and %d other files" (- nchanged authors-many-files))))) | |
579 | (setq authors-author-list | |
580 | (cons (list author wrote-list changed-list) | |
581 | authors-author-list))))) | |
3215096c | 582 | |
3215096c GM |
583 | (defun authors (root) |
584 | "Extract author information from change logs and Lisp source files. | |
585 | ROOT is the root directory under which to find the files. If called | |
a1506d29 | 586 | interactively, ROOT is read from the minibuffer. |
f39caf44 KS |
587 | Result is a buffer *Authors* containing authorship information, and a |
588 | buffer *Authors Errors* containing references to unknown files." | |
3215096c | 589 | (interactive "DEmacs source directory: ") |
d2f288c6 | 590 | (setq root (expand-file-name root)) |
3215096c GM |
591 | (let ((logs (authors-process-lines "find" root "-name" "ChangeLog*")) |
592 | (table (make-hash-table :test 'equal)) | |
f39caf44 KS |
593 | (buffer-name "*Authors*") |
594 | authors-checked-files-alist | |
595 | authors-invalid-file-names) | |
d5ab63b2 | 596 | (authors-add-fixed-entries table) |
3215096c GM |
597 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) |
598 | (error "Not the root directory of Emacs: %s" root)) | |
599 | (dolist (log logs) | |
d5ab63b2 GM |
600 | (when (and (string-match "ChangeLog\\(.[0-9]+\\)?$" log) |
601 | (not (string-match "/lispref/" log))) | |
3215096c GM |
602 | (message "Scanning %s..." log) |
603 | (authors-scan-change-log log table))) | |
604 | (let ((els (authors-process-lines "find" root "-name" "*.el"))) | |
605 | (dolist (file els) | |
606 | (message "Scanning %s..." file) | |
607 | (authors-scan-el file table))) | |
f39caf44 | 608 | (message "Generating buffer %s..." buffer-name) |
3215096c GM |
609 | (set-buffer (get-buffer-create buffer-name)) |
610 | (erase-buffer) | |
f39caf44 | 611 | (set-buffer-file-coding-system authors-coding-system) |
a1506d29 | 612 | (insert |
f39caf44 KS |
613 | "Many people have contributed code included in the Free Software |
614 | Foundation's distribution of GNU Emacs. To show our appreciation for | |
615 | their public spirit, we list here in alphabetical order a condensed | |
616 | list of their contributions.\n") | |
617 | (let (authors-author-list a) | |
618 | (maphash #'authors-add-to-author-list table) | |
a1506d29 | 619 | (setq authors-author-list |
f39caf44 KS |
620 | (sort authors-author-list |
621 | (lambda (a b) (string-lessp (car a) (car b))))) | |
622 | (dolist (a authors-author-list) | |
623 | (let ((author (car a)) | |
624 | (wrote (nth 1 a)) | |
625 | (changed (nth 2 a)) | |
626 | file) | |
627 | (insert "\n" author ": ") | |
628 | (when wrote | |
629 | (insert "wrote") | |
630 | (dolist (file wrote) | |
631 | (if (> (+ (current-column) (length file)) 72) | |
632 | (insert "\n ")) | |
633 | (insert " " file)) | |
634 | (insert "\n")) | |
635 | (when changed | |
636 | (if wrote | |
637 | (insert "and ")) | |
638 | (insert "changed") | |
639 | (dolist (file changed) | |
640 | (if (> (+ (current-column) (length file)) 72) | |
641 | (insert "\n ")) | |
642 | (insert " " file)) | |
643 | (insert "\n"))))) | |
a1506d29 | 644 | (insert "\nLocal" " Variables:\ncoding: " |
f39caf44 KS |
645 | (symbol-name authors-coding-system) "\nEnd:\n") |
646 | (message "Generating buffer %s... done" buffer-name) | |
d5ab63b2 | 647 | (unless noninteractive |
f39caf44 KS |
648 | (when authors-invalid-file-names |
649 | (with-current-buffer (get-buffer-create "*Authors Errors*") | |
650 | (erase-buffer) | |
651 | (set-buffer-file-coding-system authors-coding-system) | |
652 | (insert "Unrecognized file entries found:\n\n") | |
653 | (mapcar (lambda (f) (if (not (string-match "^[A-Za-z]+$" f)) (insert f "\n"))) | |
654 | (sort authors-invalid-file-names 'string-lessp)) | |
655 | (goto-char (point-min)) | |
656 | (compilation-mode) | |
657 | (message "Errors were found. See buffer %s" (buffer-name)))) | |
d5ab63b2 GM |
658 | (pop-to-buffer buffer-name)))) |
659 | ||
660 | ||
d5ab63b2 GM |
661 | (defun batch-update-authors () |
662 | "Produce an AUTHORS file. | |
663 | Call this function in batch mode with two command line arguments FILE | |
664 | and ROOT. FILE is the file to write, ROOT is the root directory of | |
665 | the Emacs source tree, from which to build the file." | |
666 | (unless noninteractive | |
667 | (error "`batch-update-authors' is to be used only with -batch")) | |
668 | (when (/= (length command-line-args-left) 2) | |
669 | (error "Call `batch-update-authors' with the name of the file to write")) | |
670 | (let* ((file (pop command-line-args-left)) | |
671 | (root (pop command-line-args-left))) | |
672 | (authors root) | |
673 | (write-file file))) | |
3215096c | 674 | |
ab5796a9 | 675 | ;;; arch-tag: 659d5900-5ff2-43b0-954c-a315cc1e4dc1 |
55535639 | 676 | ;;; authors.el ends here |