annotate lisp/emacs-lisp/authors.el @ 30859:b852b4302d3f

(pong): Doc fix.
author Dave Love <fx@gnu.org>
date Wed, 16 Aug 2000 19:07:04 +0000
parents fa166d86d278
children 9fcbb508e58c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30790
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; authors.el --- utility for maintaining Emacs' AUTHORS file
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 2000 Free Software Foundation, Inc.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; This file is part of GNU Emacs.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; the Free Software Foundation; either version 2, or (at your option)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; any later version.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is distributed in the hope that it will be useful,
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU General Public License for more details.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; Boston, MA 02111-1307, USA.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;;; Commentary:
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;; Use M-x authors RET to create an *Authors* buffer that can used as
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;; or merged with Emacs' AUTHORS file.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;;; Code:
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 (defconst authors-many-files 20
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 "Maximum number of files for which to print individual information.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 If an author has modified more files, only a single entry is
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 printed telling how many files he changed, instead of listing each
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 file individually.")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 (defconst authors-aliases
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 '(("eliz" . "Eli Zaretskii")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 ("Richard Stallman" . "Richard M. Stallman")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 ("Richard M. Stallman,,," . "Richard M. Stallman")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 ("Richard Stallmao" . "Richard M. Stallman")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 ("rms@gnu.org" . "Richard M. Stallman")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 ("NIIBE Yutaka" . "Yutaka NIIBE")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 ("(saw@cebaf.gov)" . "Stephen A. Wood")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 ("(pmr@legacy.pajato.com)" . "Paul Reilly")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 ("(Eric Youngdale at youngdale@v6550c.nrl.navy.mil)" . "Eric Youngdale")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 ("<Daniel.Pfeiffer@Informatik.START.db.de>" . "Daniel Pfeiffer")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 ("<Daniel.Pfeiffer@Informatik.START.dbp.de>" . "Daniel Pfeiffer")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 ("(afs@hplb.hpl.hp.com)" . "ignore")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 ("<Use-Author-Address-Header@\\[127.1\\]>" . "ignore")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 ("Code Extracted" . "ignore")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 ("Fsf" . "ignore")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 ("David M. Koppelman, Koppel@Ee.Lsu.Edu" . "David M. Koppelman")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 ("jka@ece.cmu.edu" . "Jay K. Adams")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 ("Per Abhiddenware; you can redistribute it and/or modify" . "Per Abrahamsen")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 ("Andrw Innes" . "Andrew Innes")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 ("Barry Warsaw" . "Barry A. Warsaw")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 ("Barry A. Warsaw, Century Computing, Inc." . "Barry A. Warsaw")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 ("Barry A. Warsaw, ITB" . "Barry A. Warsaw")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 ("Ken'ichi Handa" . "Kenichi Handa")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 ("Bob Chassell" . "Robert J. Chassell")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 ("SL Baur" . "Steven L. Baur")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 ("Steven L Baur" . "Steven L. Baur")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 ("eggert" . "Paul Eggert")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 ("voelker" . "Geoff Voelker")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 ("rms" . "Richard M. Stallman")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 ("Edward M Reingold" . "Edward M. Reingold")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 ("Eric Ludlam" . "Eric M. Ludlam")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 ("Eric Raymond" . "Eric S. Raymond")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 ("Francois Pinard" . "François Pinard")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 ("Fred Pierresteguy" . "Frederic Pierresteguy")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 ("Hallvard B Furuseth" . "Hallvard B. Furuseth")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 ("ISO-2022-JP" . "ignore")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 ("Jens-Ulrik Petersen" . "Jens-Ulrik Holger Petersen")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 ("Christoph.Wedler@sap.com" . "Christoph Wedler")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 ("Jonathan Kamens" . "Jonathan I. Kamens")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 ("Kim Storm" . "Kim F. Storm")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 ("Marcus Daniels" . "Marcus G. Daniels")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 ("Michael I Bushnell" . "Michael I. Bushnell")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 ("Michael I. Bushnell, P/Bsg" . "Michael I. Bushnell")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 ("Reingold Edward M" . "Edward M. Reingold")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 ("Roland B Roberts" . "Roland B. Roberts")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 ("Sam Shteingold" . "Sam Steingold")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 ("Kenichi HANDA" . "Kenichi Handa"))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 "Alist of author aliases.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 Each entry is of the form (REGEXP . ALIAS). If an author's name
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 matches REGEXP, use ALIAS instead. The special alias \"ignore\" means
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 ignore that author.")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (defun authors-add (author file action table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 "Record that AUTHOR worked on FILE.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 ACTION is a keyword symbol describing what he did. Record file,
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 author and what he did in hash table TABLE. See the description of
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 `authors-scan-change-log' for the structure of the hash table."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (let* ((value (gethash author table))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (entry (assoc file value)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (if (null entry)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (puthash author (cons (list file action) value) table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (unless (memq action entry)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (append entry (list action))))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (defun authors-process-lines (program &rest args)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 "Execute PROGRAM with ARGS, returning its output as a list of lines.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 Signal an error if the program returns with a non-zero exit status."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (with-temp-buffer
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (let ((status (apply 'call-process program nil (current-buffer) nil args)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (unless (eq status 0)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (error "%s exited with status %s" program status))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (goto-char (point-min))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (let (lines)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (while (not (eobp))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (setq lines (cons (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 (line-beginning-position)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (line-end-position))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 lines))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (forward-line 1))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (nreverse lines)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (defun authors-canonical-author-name (author)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 "Return a canonicalized form of AUTHOR, an author name.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 If AUTHOR has an alias, use that. Remove email addresses. Capitalize
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 words in the author's name."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (let ((aliases authors-aliases))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (while aliases
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (when (string-match (car (car aliases)) author)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (setq author (cdr (car aliases))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 aliases nil))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (setq aliases (cdr aliases))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (setq author (replace-regexp-in-string "[ \t]*[(<].*$" "" author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 (setq author (replace-regexp-in-string "^[ \t]+" "" author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (setq author (replace-regexp-in-string "[ \t]+$" "" author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (capitalize author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 (defun authors-scan-change-log (file table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 "Scan change log FILE for author information.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 For each change mentioned in the log, add an entry to hash table TABLE
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 under the author's canonical name.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 Keys of TABLE are author names. Values are alists of entries (FILE
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 ACTION...). FILE is one file the author worked on. The rest of the
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 entry is a list of keyword symbols describing what he did with the
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 file.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 :wrote means the author wrote the file
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 :changed means he changed the file."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 (let* ((enable-local-variables t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 (enable-local-eval t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 (existing-buffer (get-file-buffer file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 (buffer (find-file-noselect file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 author)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 (save-excursion
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 (set-buffer buffer)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 (save-restriction
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 (widen)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 (goto-char (point-min))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (while (re-search-forward "^[0-9]\\|^[ \t]+\\* " nil t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (beginning-of-line)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (cond ((looking-at "^[0-9]+-[0-9]+-[0-9]+")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 (skip-chars-forward " \t+:0-9-")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 (setq author (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 (point) (line-end-position)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 (setq author (authors-canonical-author-name author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 (forward-line 1))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 ((looking-at "^[ \t]+\\*")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 (let ((line (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 (match-end 0) (line-end-position))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172 (while (and (not (string-match ":" line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 (forward-line 1)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 (not (looking-at ":\\|^[ \t]*$")))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 (setq line (concat line
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 (line-beginning-position)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 (line-end-position)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (when (string-match ":" line)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 (setq line (substring line 0 (match-beginning 0)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 (setq line (replace-regexp-in-string "[[(<{].*$" "" line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (setq line (replace-regexp-in-string "," "" line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 (dolist (file (split-string line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 (setq file (file-name-nondirectory file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 ;(message "%s changed %s" author file)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 (authors-add author file :changed table)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (forward-line 1)))))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 (unless existing-buffer
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 (kill-buffer buffer))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 (defun authors-scan-el (file table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 "Scan Lisp file FILE for author information.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 TABLE is a hash table to add author information to."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (let* ((existing-buffer (get-file-buffer file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 (enable-local-variables t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 (enable-local-eval t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (buffer (find-file-noselect file)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (save-excursion
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 (set-buffer buffer)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 (save-restriction
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 (widen)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 (goto-char (point-min))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204 (while (and (re-search-forward
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 "^;+[ \t]*\\(Author\\|Commentary\\):[ \t]*" nil t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 (not (string= (match-string 1) "Commentary")))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 ;; Some entries contain a year range in front of the
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 ;; author's name.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 (skip-chars-forward "-0-9 \t")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 (let ((author (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 (point) (line-end-position))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 (setq author (authors-canonical-author-name author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 (setq file (file-name-nondirectory file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 (authors-add author file :wrote table)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 (unless existing-buffer
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 (kill-buffer buffer))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 (defun authors-print (author changes)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 "Insert information about AUTHOR's work on Emacs into the current buffer.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 CHANGES is an alist of entries (FILE ACTION...), as produced by
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 `authors-scan-change-log'."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 (unless (equal author "Ignore")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224 (let ((nchanged 0))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
225 (dolist (change changes)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226 (let ((actions (cdr change))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
227 (file (car change)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228 (if (memq :wrote actions)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 (insert author " (wrote) " file "\n")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 (setq nchanged (1+ nchanged)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231 (if (> nchanged authors-many-files)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 (insert author " (changed) [changes in more than "
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 (int-to-string authors-many-files) " files]\n")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234 (dolist (change changes)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
235 (let ((actions (cdr change))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
236 (file (car change)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
237 (unless (memq :wrote actions)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 (insert author " (changed) " file "\n"))))))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
240
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
241 ;;;###autoload
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 (defun authors (root)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 "Extract author information from change logs and Lisp source files.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 ROOT is the root directory under which to find the files. If called
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 interactively, ROOT is read from the minibuffer. Result is a
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
246 buffer *Authors* containing authorship information."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247 (interactive "DEmacs source directory: ")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248 (let ((logs (authors-process-lines "find" root "-name" "ChangeLog*"))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 (table (make-hash-table :test 'equal))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 (buffer-name "*Authors*"))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251 (setq root (expand-file-name root))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 (error "Not the root directory of Emacs: %s" root))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 (dolist (log logs)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 (when (string-match "ChangeLog\\(.[0-9]+\\)?$" log)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 (message "Scanning %s..." log)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 (authors-scan-change-log log table)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
258 (let ((els (authors-process-lines "find" root "-name" "*.el")))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 (dolist (file els)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 (message "Scanning %s..." file)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261 (authors-scan-el file table)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 (set-buffer (get-buffer-create buffer-name))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 (erase-buffer)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (maphash #'authors-print table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 (sort-lines nil (point-min) (point-max))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 (pop-to-buffer buffer-name)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 ;; authors.el ends here