1 ;;; authors.el --- utility for maintaining Emacs' AUTHORS file -*-coding: iso-2022-7bit;-*-
3 ;; Copyright (C) 2000, 2003, 2005 Free Software Foundation, Inc.
5 ;; Author: Gerd Moellmann <gerd@gnu.org>
6 ;; Maintainer: Kim F. Storm <storm@cua.dk>
9 ;; This file is part of GNU Emacs.
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)
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.
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.
28 ;; Use M-x authors RET to create an *Authors* buffer that can used as
29 ;; or merged with Emacs' AUTHORS file.
33 (defvar authors-coding-system 'iso-2022-7bit
34 "Coding system used in the AUTHORS file.")
36 (defconst authors-many-files 20
37 "Maximum number of files for which to print individual information.
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
42 (defconst authors-aliases
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")
54 ("David M. Smith" "David Smith" "David M Smith")
55 ("Ed L. Cashin" "Ed L Cashin")
56 ("Edward M. Reingold" "Ed Reingold" "Edward M Reingold"
58 ("Eli Zaretskii" "eliz")
59 ("Emilio C. Lopes" "Emilio Lopes")
60 ("Era Eriksson" "Era@Iki.Fi")
61 ("Eric M. Ludlam" "Eric Ludlam")
62 ("Eric S. Raymond" "Eric Raymond")
63 ("Eric Youngdale" "(Eric Youngdale at youngdale@v6550c.nrl.navy.mil)")
64 ("Francis J. Wright" "Dr Francis J. Wright" "Francis Wright")
65 ("Fran
\e,Ag
\e(Bois Pinard" "Francois Pinard")
66 ("Francesco Potort
\e,Al
\e(B" "Francesco Potorti" "Francesco Potorti`")
67 ("Frederic Pierresteguy" "Fred Pierresteguy")
68 ("Geoff Voelker" "voelker")
69 ("Hallvard B. Furuseth" "Hallvard B Furuseth")
70 ("Hrvoje Nik
\e,B9
\e(Bi
\e,Bf
\e(B" "Hrvoje Niksic")
71 (nil "(afs@hplb.hpl.hp.com)")
72 (nil "<Use-Author-Address-Header@\\[127.1\\]>")
73 (nil "Code Extracted")
76 ("Jaeyoun Chung" "Jae-youn Chung" "Jae-you Chung" "Chung Jae-youn")
77 ("Jan Dj
\e,Ad
\e(Brv" "Jan D." "Jan Djarv")
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")
80 ("Jens-Ulrik Holger Petersen" "Jens-Ulrik Petersen")
81 ("John W. Eaton" "John Eaton")
82 ("Jonathan I. Kamens" "Jonathan Kamens")
83 ("Joseph Arceneaux" "Joe Arceneaux")
84 ("Juan Le
\e,As
\e(Bn Lahoz Garc
\e,Am
\e(Ba" "Juan-Leon Lahoz Garcia")
85 ("K. Shane Hartman" "Shane Hartman")
86 ("Kai Gro
\e,A_
\e(Bjohann" "Kai Grossjohann" "Kai Gro
\e,b_
\e(Bjohann"
87 "Kai.Grossjohann@Cs.Uni-Dortmund.De"
88 "Kai.Grossjohann@Gmx.Net")
89 ("Karl Berry" "K. Berry")
90 ("Kazushi Marukawa" "Kazushi")
91 ("Ken Manheimer" "Kenneth Manheimer")
92 ("Kenichi Handa" "Ken'ichi Handa" "Kenichi HANDA")
93 ("Kevin Greiner" "Kevin J. Greiner")
94 ("Kim F. Storm" "Kim Storm")
95 ("Kyle Jones" "Kyle E. Jones")
96 ("Marcus G. Daniels" "Marcus Daniels")
97 ("Mark D. Baushke" "Mark D Baushke")
98 ("Martin Lorentzon" "Martin Lorentzson")
99 ("Matt Swift" "Matthew Swift")
100 ("Michael R. Mauger" "Michael Mauger")
101 ("Michael D. Ernst" "Michael Ernst")
102 ("Michael I. Bushnell" "Michael I Bushnell" "Michael I. Bushnell, P/Bsg")
103 ("Mikio Nakajima" "Nakajima Mikio")
104 ("Paul Eggert" "eggert")
105 ("Paul Reilly" "(pmr@legacy.pajato.com)")
106 ("Pavel Jan
\e,Bm
\e(Bk" "Pavel Jan
\e,Am
\e(Bk Ml." "Pavel Jan
\e,Am
\e(Bk" "Pavel@Janik.Cz")
107 ("Per Abrahamsen" "Per Abhiddenware")
108 ("Peter S. Galbraith" "Peter Galbraith")
109 ("Peter Runestig" "Peter 'luna' Runestig")
110 ("Peter S. Galbraith" "Peter S Galbraith")
111 ("Richard M. Stallman" "Richard M. Stallman,,," "Richard Stallman"
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")
117 ("Stefan Monnier" "Stefan")
118 ("Stephen A. Wood" "(saw@cebaf.gov)")
119 ("Steven L. Baur" "SL Baur" "Steven L Baur")
120 ("Takaaki Ota" "Tak Ota")
121 ("Takahashi Naoto" "Naoto Takahashi")
122 ("Teodor Zlatanov" "Ted Zlatanov")
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")
130 "Alist of author aliases.
132 Each entry is of the form (REALNAME REGEXP...). If an author's name
133 matches one of the REGEXPs, use REALNAME instead.
134 If REALNAME is nil, ignore that author.")
137 (defvar authors-public-domain-files
149 "List of regexps matching files for which the FSF doesn't need papers.")
152 (defvar authors-obsolete-files-regexps
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
160 (defconst authors-ignored-files
162 "lock" "share-lib" "local-lisp"
164 "NEWS" "PROBLEMS" "FAQ")
165 "List of files and directories to ignore.
166 Changes to files in this list are not listed.")
168 (defconst authors-fixed-entries
169 '(("Richard M. Stallman" :wrote "[The original GNU emacs and numerous files]")
170 ("Joseph Arceneaux" :wrote "xrdb.c")
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")
199 ("Henry Kautz" :wrote "bib-mode.el")
200 ("Joseph M. Kelsey" :changed "fileio.c" "vms-pwd.h" "vmsfns.c" "dir.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"
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/"
234 ("Frederic Pierresteguy" :wrote "widget.c")
235 ("Michael D. Prange" :changed "tex-mode.el")
236 ("Paul Reilly" :wrote "gux5-4r2.h" "dgux5-4r3.h")
237 ("Roland B. Roberts" :changed "files.el" "sort.el" "vmsproc.el"
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.")
273 (defconst authors-valid-file-names
277 "File names which are valid, but no longer exists (or cannot be
278 found) in the repository.")
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")
290 ("leim-Makefile" . "leim/Makefile")
291 ("leim-Makefile.in" . "leim/Makefile.in")
292 ("INSTALL-CVS" . "INSTALL.CVS")
294 "Alist of files which have been renamed during their lifetime.
295 Elements are (OLDNAME . NEWNAME).")
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")
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.")
321 (defvar authors-checked-files-alist)
322 (defvar authors-invalid-file-names)
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
329 (let ((entry (assoc file authors-checked-files-alist))
334 (setq relname (file-name-nondirectory file))
335 (if (or (member relname authors-valid-file-names)
337 (file-exists-p relname)
338 (file-exists-p (concat "etc/" relname)))
340 (setq valid (assoc file authors-renamed-files-alist))
342 (setq valid (cdr valid))
343 (let ((rules authors-renamed-files-regexps))
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))
351 (setq rules (cdr rules))))))
352 (setq authors-checked-files-alist
353 (cons (cons file valid) authors-checked-files-alist))
355 (setq authors-invalid-file-names
356 (cons (format "%s:%d: unrecognized `%s' for %s"
358 (1+ (count-lines (point-min) pos))
360 authors-invalid-file-names)))
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))
368 (dolist (item (cdr entry))
371 (authors-add author item action table))))))
374 (defun authors-obsolete-file-p (file)
375 "Return non-nil if FILE is obsolete.
376 FILE is considered obsolete if it matches one of the regular expressions
377 from `authors-obsolete-files-regexps'."
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)))
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."
391 (unless (or (member file authors-ignored-files)
392 (authors-obsolete-file-p file)
394 (let* ((value (gethash author table))
395 (entry (assoc file value))
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))))))))
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."
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))
414 (setq lines (cons (buffer-substring-no-properties
415 (line-beginning-position)
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."
426 (let* ((aliases authors-aliases)
429 (setq realname (car (car aliases))
430 regexps (cdr (car aliases))
431 aliases (cdr aliases))
433 (if (string-match (car regexps) author)
434 (setq author realname
437 (setq regexps (cdr regexps))))))
439 (setq author (replace-regexp-in-string "[ \t]*[(<].*$" "" author))
440 (setq author (replace-regexp-in-string "\`[ \t]+" "" author))
441 (setq author (replace-regexp-in-string "[ \t]+$" "" author))
442 (setq author (replace-regexp-in-string "[ \t]+" " " author))
443 (unless (string-match "[-, \t]" author)
445 (capitalize author)))
447 (defun authors-scan-change-log (log-file table)
448 "Scan change log LOG-FILE for author information.
450 For each change mentioned in the log, add an entry to hash table TABLE
451 under the author's canonical name.
453 Keys of TABLE are author names. Values are alists of entries (FILE
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.
458 :wrote means the author wrote the file
459 :changed means he changed the file COUNT times."
461 (let* ((enable-local-variables t)
462 (enable-local-eval t)
463 (existing-buffer (get-file-buffer log-file))
464 (buffer (find-file-noselect log-file))
470 (goto-char (point-min))
471 (while (re-search-forward "^[0-9]\\|^[ \t]+\\* " nil t)
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))
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))
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))
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))))
498 (forward-line 1)))))))
499 (unless existing-buffer
500 (kill-buffer buffer))))
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)))
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
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))))
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)))
540 (defvar authors-author-list)
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
547 WROTE and CHANGED are lists of the files written and changed by AUTHOR."
552 (dolist (change changes)
553 (let ((actions (cdr change))
556 (if (assq :wrote actions)
559 (if (authors-public-domain-p file)
560 (concat file " (public domain)")
564 (cons (cons file (cdr (assq :changed actions)))
567 (setq wrote-list (sort wrote-list 'string-lessp)))
569 (setq changed-list (sort changed-list
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)))))
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
586 interactively, ROOT is read from the minibuffer.
587 Result is a buffer *Authors* containing authorship information, and a
588 buffer *Authors Errors* containing references to unknown files."
589 (interactive "DEmacs source directory: ")
590 (setq root (expand-file-name root))
591 (let ((logs (authors-process-lines "find" root "-name" "ChangeLog*"))
592 (table (make-hash-table :test 'equal))
593 (buffer-name "*Authors*")
594 authors-checked-files-alist
595 authors-invalid-file-names)
596 (authors-add-fixed-entries table)
597 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
598 (error "Not the root directory of Emacs: %s" root))
600 (when (string-match "ChangeLog\\(.[0-9]+\\)?$" log)
601 (message "Scanning %s..." log)
602 (authors-scan-change-log log table)))
603 (let ((els (authors-process-lines "find" root "-name" "*.el")))
605 (message "Scanning %s..." file)
606 (authors-scan-el file table)))
607 (message "Generating buffer %s..." buffer-name)
608 (set-buffer (get-buffer-create buffer-name))
610 (set-buffer-file-coding-system authors-coding-system)
612 "Many people have contributed code included in the Free Software
613 Foundation's distribution of GNU Emacs. To show our appreciation for
614 their public spirit, we list here in alphabetical order a condensed
615 list of their contributions.\n")
616 (let (authors-author-list a)
617 (maphash #'authors-add-to-author-list table)
618 (setq authors-author-list
619 (sort authors-author-list
620 (lambda (a b) (string-lessp (car a) (car b)))))
621 (dolist (a authors-author-list)
622 (let ((author (car a))
626 (insert "\n" author ": ")
630 (if (> (+ (current-column) (length file)) 72)
638 (dolist (file changed)
639 (if (> (+ (current-column) (length file)) 72)
643 (insert "\nLocal" " Variables:\ncoding: "
644 (symbol-name authors-coding-system) "\nEnd:\n")
645 (message "Generating buffer %s... done" buffer-name)
646 (unless noninteractive
647 (when authors-invalid-file-names
648 (with-current-buffer (get-buffer-create "*Authors Errors*")
650 (set-buffer-file-coding-system authors-coding-system)
651 (insert "Unrecognized file entries found:\n\n")
652 (mapcar (lambda (f) (if (not (string-match "^[A-Za-z]+$" f)) (insert f "\n")))
653 (sort authors-invalid-file-names 'string-lessp))
654 (goto-char (point-min))
656 (message "Errors were found. See buffer %s" (buffer-name))))
657 (pop-to-buffer buffer-name))))
660 (defun batch-update-authors ()
661 "Produce an AUTHORS file.
662 Call this function in batch mode with two command line arguments FILE
663 and ROOT. FILE is the file to write, ROOT is the root directory of
664 the Emacs source tree, from which to build the file."
665 (unless noninteractive
666 (error "`batch-update-authors' is to be used only with -batch"))
667 (when (/= (length command-line-args-left) 2)
668 (error "Call `batch-update-authors' with the name of the file to write"))
669 (let* ((file (pop command-line-args-left))
670 (root (pop command-line-args-left)))
674 ;;; arch-tag: 659d5900-5ff2-43b0-954c-a315cc1e4dc1
675 ;;; authors.el ends here