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