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