annotate lisp/emacs-lisp/gulp.el @ 15833:aa7b0c77a89a

(rmail-reply-regexp): Match Re[2].
author Richard M. Stallman <rms@gnu.org>
date Tue, 06 Aug 1996 18:41:06 +0000
parents 80562f089595
children d0f4e2e9e1f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; gulp.el --- Ask for updates for Lisp packages
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1996 Free Software Foundation, Inc.
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Sam Shteingold <shteingd@math.ucla.edu>
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Maintainer: FSF
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: maintenance
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
15742
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15211
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15211
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15211
diff changeset
24 ;; Boston, MA 02111-1307, USA.
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; Search the emacs/{version}/lisp directory for *.el files, extract the
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; name of the author or maintainer and send him e-mail requesting
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; update.
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;;; Code:
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 (defvar gulp-discard "^;+ *Maintainer: *FSF *$"
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 "*The regexp matching the packages not requiring the request for updates.")
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
37 (defvar gulp-tmp-buffer "*gulp*" "The name of the temporary buffer.")
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (defvar gulp-max-len 2000
15179
be7cc250142a (gulp-search-path, gulp-packages): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents: 15178
diff changeset
40 "*Distance into a Lisp source file to scan for keywords.")
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 (defvar gulp-request-header
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
43 (concat
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
44 "This message was created automatically.
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
45 A new version of GNU Emacs, "
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
46 (format "%d.%d" emacs-major-version (+ emacs-minor-version 1))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
47 ", is entering the pretest state,
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
48 and it is high time to submit the updates to the various emacs packages.
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
49 You're listed as the maintainer of the following package(s):\n\n")
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
50 "*The starting text of a gulp message.")
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 (defvar gulp-request-end
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
53 (concat
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
54 "\nIf you have any changes since the version in the previous release ("
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
55 (format "%d.%d" emacs-major-version emacs-minor-version)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
56 "),
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
57 please send them to me ASAP.
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
59 Thanks.")
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
60 "*The closing text in a gulp message.")
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
61
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
62 (defun gulp-send-requests (dir &optional time)
15179
be7cc250142a (gulp-search-path, gulp-packages): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents: 15178
diff changeset
63 "Send requests for updates to the authors of Lisp packages in directory DIR.
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
64 For each maintainer, the message consists of `gulp-request-header',
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
65 followed by the list of packages (with modification times if the optional
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
66 prefix argument TIME is non-nil), concluded with `gulp-request-end'.
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
67
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
68 You can't edit the messages, but you can confirm whether to send each one.
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
70 The list of addresses for which you decided not to send mail
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
71 is left in the `*gulp*' buffer at the end."
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
72 (interactive "DRequest updates for Lisp directory: \nP")
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
73 (save-excursion
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
74 (set-buffer (get-buffer-create gulp-tmp-buffer))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
75 (let ((m-p-alist (gulp-create-m-p-alist
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
76 (directory-files dir nil "^[^=].*\\.el$" t)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
77 dir))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
78 ;; Temporarily inhibit undo in the *gulp* buffer.
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
79 (buffer-undo-list t)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
80 mail-setup-hook msg node)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
81 (while (setq node (car m-p-alist))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
82 (setq msg (gulp-create-message (cdr node) time))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
83 (setq mail-setup-hook
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
84 '(lambda ()
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
85 (mail-subject)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
86 (insert "It's time for Emacs updates again")
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
87 (goto-char (point-max))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
88 (insert msg)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
89 (mail nil (car node))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
90 (if (y-or-n-p "Send? ") (mail-send)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
91 (kill-this-buffer)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
92 (set-buffer gulp-tmp-buffer)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
93 (insert (format "%s\n\n" node)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
94 (setq m-p-alist (cdr m-p-alist))))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
95 (set-buffer gulp-tmp-buffer)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
96 (setq buffer-undo-list nil)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
97
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
98
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
99 (defun gulp-create-message (rec time)
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 "Return the message string for REC, which is a list like (FILE TIME)."
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (let (node (str gulp-request-header))
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (while (setq node (car rec))
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
103 (setq str (concat str "\t" (car node)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
104 (if time (concat "\tLast modified:\t" (cdr node)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
105 "\n"))
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (setq rec (cdr rec)))
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (concat str gulp-request-end)))
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
110 (defun gulp-create-m-p-alist (flist dir)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
111 "Create the maintainer/package alist for files in FLIST in DIR.
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
112 That is a list of elements, each of the form (MAINTAINER PACKAGES...)."
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (save-excursion
15211
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
114 (let (mplist filen node mnt-tm mnt tm)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
115 (get-buffer-create gulp-tmp-buffer)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
116 (set-buffer gulp-tmp-buffer)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
117 (setq buffer-undo-list t)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
118 (while flist
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
119 (setq fl-tm (gulp-maintainer (setq filen (car flist)) dir))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
120 (if (setq tm (cdr fl-tm) mnt (car fl-tm));; there is a definite maintainer
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
121 (if (setq node (assoc mnt mplist));; this is not a new maintainer
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
122 (setq mplist (cons (cons mnt (cons (cons filen tm) (cdr node)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
123 (delete node mplist)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
124 (setq mplist (cons (list mnt (cons filen (cdr fl-tm))) mplist))))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
125 (message "%s -- %s" filen fl-tm)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
126 (setq flist (cdr flist)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
127 (erase-buffer)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
128 mplist)))
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
129
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
130 (defun gulp-maintainer (filenm dir)
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
131 "Return a list (MAINTAINER TIMESTAMP) for the package FILENM in directory DIR."
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
132 (save-excursion
6bcff02ade49 Lots of fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15179
diff changeset
133 (let* ((fl (concat dir filenm)) mnt
15178
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (timest (format-time-string "%Y-%m-%d %a %T %Z"
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (elt (file-attributes fl) 5))))
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (set-buffer gulp-tmp-buffer)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 (erase-buffer)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (insert-file-contents fl nil 0 gulp-max-len)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (goto-char 1)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (if (re-search-forward gulp-discard nil t)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (setq mnt nil) ;; do nothing, return nil
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (goto-char 1)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (if (and (re-search-forward "^;+ *Maintainer: \\(.*\\)$" nil t)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (> (length (setq mnt (match-string 1))) 0))
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 () ;; found!
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (goto-char 1)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (if (re-search-forward "^;+ *Author: \\(.*\\)$" nil t)
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (setq mnt (match-string 1))))
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (if (= (length mnt) 0) (setq mnt nil))) ;; "^;; Author: $" --> nil
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (cons mnt timest))))
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151
c23003387bc9 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ;;; gulp.el ends here