annotate lisp/emacs-lisp/authors.el @ 32229:108b464ba713

(eudc): Add :version, :link.
author Dave Love <fx@gnu.org>
date Fri, 06 Oct 2000 18:56:44 +0000
parents 1bb0e9c9c64d
children efaa4e4c5fef
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
32028
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
90 (defvar authors-obsolete-files-regexps
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
91 '("vc-\\*\\.el$"
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
92 "spec.txt$"
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
93 "vc-\\(rcs\\|cvs\\|sccs\\)-hooks\\.el$")
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
94 "List of regexps matching obsolete files.
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
95 Changes to files matching one of the regexps in this list are not
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
96 listed.")
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
97
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
98
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
99 (defun authors-obsolete-file-p (file)
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
100 "Return non-nil if FILE is obsolete.
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
101 FILE is considered obsolete if it matches on of the regular expressions
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
102 from `authors-obsolete-files-regexps'."
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
103 (let (obsolete-p
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
104 (regexps authors-obsolete-files-regexps))
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
105 (while (and regexps (not obsolete-p))
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
106 (setq obsolete-p (string-match (car regexps) file)
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
107 regexps (cdr regexps)))
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
108 obsolete-p))
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
109
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
110
30790
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (defun authors-add (author file action table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 "Record that AUTHOR worked on FILE.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 ACTION is a keyword symbol describing what he did. Record file,
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 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
115 `authors-scan-change-log' for the structure of the hash table."
32028
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
116 (unless (authors-obsolete-file-p file)
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
117 (let* ((value (gethash author table))
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
118 (entry (assoc file value)))
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
119 (if (null entry)
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
120 (puthash author (cons (list file action) value) table)
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
121 (unless (memq action entry)
1bb0e9c9c64d (authors-obsolete-file-p): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 32005
diff changeset
122 (nconc entry (list action)))))))
30790
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (defun authors-process-lines (program &rest args)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 "Execute PROGRAM with ARGS, returning its output as a list of lines.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 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
128 (with-temp-buffer
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (let ((status (apply 'call-process program nil (current-buffer) nil args)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (unless (eq status 0)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (error "%s exited with status %s" program status))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 (goto-char (point-min))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (let (lines)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (while (not (eobp))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (setq lines (cons (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (line-beginning-position)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 (line-end-position))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 lines))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 (forward-line 1))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 (nreverse lines)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141
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 (defun authors-canonical-author-name (author)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 "Return a canonicalized form of AUTHOR, an author name.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 If AUTHOR has an alias, use that. Remove email addresses. Capitalize
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 words in the author's name."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 (let ((aliases authors-aliases))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (while aliases
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 (when (string-match (car (car aliases)) author)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 (setq author (cdr (car aliases))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 aliases nil))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 (setq aliases (cdr aliases))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 (setq author (replace-regexp-in-string "[ \t]*[(<].*$" "" author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 (setq author (replace-regexp-in-string "^[ \t]+" "" author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 (setq author (replace-regexp-in-string "[ \t]+$" "" author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 (capitalize author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 (defun authors-scan-change-log (file table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 "Scan change log FILE for author information.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 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
163 under the author's canonical name.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 Keys of TABLE are author names. Values are alists of entries (FILE
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 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
167 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
168 file.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 :wrote means the author wrote the file
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 :changed means he changed the file."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 (let* ((enable-local-variables t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 (enable-local-eval t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 (existing-buffer (get-file-buffer file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 (buffer (find-file-noselect file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 author)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 (save-excursion
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (set-buffer buffer)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 (save-restriction
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 (widen)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (goto-char (point-min))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 (while (re-search-forward "^[0-9]\\|^[ \t]+\\* " nil t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 (beginning-of-line)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 (cond ((looking-at "^[0-9]+-[0-9]+-[0-9]+")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 (skip-chars-forward " \t+:0-9-")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (setq author (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 (point) (line-end-position)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 (setq author (authors-canonical-author-name author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 (forward-line 1))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 ((looking-at "^[ \t]+\\*")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 (let ((line (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 (match-end 0) (line-end-position))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 (while (and (not (string-match ":" line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (forward-line 1)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 (not (looking-at ":\\|^[ \t]*$")))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 (setq line (concat line
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (line-beginning-position)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 (line-end-position)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 (when (string-match ":" line)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 (setq line (substring line 0 (match-beginning 0)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 (setq line (replace-regexp-in-string "[[(<{].*$" "" line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204 (setq line (replace-regexp-in-string "," "" line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 (dolist (file (split-string line))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 (setq file (file-name-nondirectory file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 ;(message "%s changed %s" author file)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 (authors-add author file :changed table)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 (forward-line 1)))))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 (unless existing-buffer
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 (kill-buffer buffer))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 (defun authors-scan-el (file table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 "Scan Lisp file FILE for author information.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 TABLE is a hash table to add author information to."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 (let* ((existing-buffer (get-file-buffer file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 (enable-local-variables t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 (enable-local-eval t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 (buffer (find-file-noselect file)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 (save-excursion
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 (set-buffer buffer)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 (save-restriction
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224 (widen)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
225 (goto-char (point-min))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226 (while (and (re-search-forward
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
227 "^;+[ \t]*\\(Author\\|Commentary\\):[ \t]*" nil t)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228 (not (string= (match-string 1) "Commentary")))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 ;; Some entries contain a year range in front of the
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 ;; author's name.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231 (skip-chars-forward "-0-9 \t")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 (let ((author (buffer-substring-no-properties
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 (point) (line-end-position))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234 (setq author (authors-canonical-author-name author))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
235 (setq file (file-name-nondirectory file))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
236 (authors-add author file :wrote table)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
237 (unless existing-buffer
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 (kill-buffer buffer))))
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 (defun authors-print (author changes)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 "Insert information about AUTHOR's work on Emacs into the current buffer.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 CHANGES is an alist of entries (FILE ACTION...), as produced by
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 `authors-scan-change-log'."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 (unless (equal author "Ignore")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
246 (let ((nchanged 0))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247 (dolist (change changes)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248 (let ((actions (cdr change))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 (file (car change)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 (if (memq :wrote actions)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251 (insert author " (wrote) " file "\n")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (setq nchanged (1+ nchanged)))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 (if (> nchanged authors-many-files)
32005
01a7fea88dc1 (authors-print): Rephrase many-files string.
Miles Bader <miles@gnu.org>
parents: 31957
diff changeset
254 (insert author " (changed) [more than "
30790
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 (int-to-string authors-many-files) " files]\n")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 (dolist (change changes)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 (let ((actions (cdr change))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
258 (file (car change)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 (unless (memq :wrote actions)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 (insert author " (changed) " file "\n"))))))))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 ;;;###autoload
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (defun authors (root)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 "Extract author information from change logs and Lisp source files.
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 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
267 interactively, ROOT is read from the minibuffer. Result is a
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 buffer *Authors* containing authorship information."
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 (interactive "DEmacs source directory: ")
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270 (let ((logs (authors-process-lines "find" root "-name" "ChangeLog*"))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
271 (table (make-hash-table :test 'equal))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 (buffer-name "*Authors*"))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
273 (setq root (expand-file-name root))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 (error "Not the root directory of Emacs: %s" root))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 (dolist (log logs)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
277 (when (string-match "ChangeLog\\(.[0-9]+\\)?$" log)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
278 (message "Scanning %s..." log)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
279 (authors-scan-change-log log table)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
280 (let ((els (authors-process-lines "find" root "-name" "*.el")))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
281 (dolist (file els)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 (message "Scanning %s..." file)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 (authors-scan-el file table)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (set-buffer (get-buffer-create buffer-name))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 (erase-buffer)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (maphash #'authors-print table)
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 (sort-lines nil (point-min) (point-max))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (pop-to-buffer buffer-name)))
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290
fa166d86d278 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 ;; authors.el ends here