annotate admin/admin.el @ 90018:49e1148db0d3

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Thu, 14 Oct 2004 12:36:25 +0000
parents 68c22ea6027c
children e1fbb019c538
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; admin.el --- utilities for Emacs administration
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 2001 Free Software Foundation, Inc.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; This file is part of GNU Emacs.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
9b5a774d579b *** 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
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; the Free Software Foundation; either version 2, or (at your option)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; any later version.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is distributed in the hope that it will be useful,
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU General Public License for more details.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
9b5a774d579b *** 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
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; Boston, MA 02111-1307, USA.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;;; Commentary:
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;; add-release-log add ``Version X released'' change log entries
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;; set-version change Emacs version number in source tree.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;;; Code:
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 (defun process-lines (program &rest args)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 "Execute PROGRAM with ARGS, returning its output as a list of lines.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 Signal an error if the program returns with a non-zero exit status."
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 (with-temp-buffer
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (let ((status (apply 'call-process program nil (current-buffer) nil args)))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 (unless (eq status 0)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 (error "%s exited with status %s" program status))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 (let (lines)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 (while (not (eobp))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 (setq lines (cons (buffer-substring-no-properties
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 (line-beginning-position)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 (line-end-position))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 lines))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 (forward-line 1))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 (nreverse lines)))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 (defun add-release-logs (root version)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 "Add \"Version VERSION released.\" change log entries in ROOT.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 Root must be the root of an Emacs source tree."
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (interactive "DEmacs root directory: \nNVersion number: ")
49298
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
51 (setq root (expand-file-name root))
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (error "%s doesn't seem to be the root of an Emacs source tree" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (let* ((logs (process-lines "find" root "-name" "ChangeLog"))
49298
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
55 (require 'add-log)
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 (entry (format "%s %s <%s>\n\n\t* Version %s released.\n\n"
49298
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
57 (funcall add-log-time-format)
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
58 (or add-log-full-name (user-full-name))
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
59 (or add-log-mailing-address user-mail-address)
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
60 version)))
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 (dolist (log logs)
40084
1f20d08b9da5 (add-release-logs): Put the log entry in lispref, too.
Gerd Moellmann <gerd@gnu.org>
parents: 40063
diff changeset
62 (unless (string-match "/gnus/" log)
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 (find-file log)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 (insert entry)))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (defun set-version-in-file (root file version rx)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (find-file (expand-file-name file root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (unless (re-search-forward rx nil t)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (error "Version not found in %s" file))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (replace-match (format "%s" version) nil nil nil 1))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (defun set-version (root version)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 "Set Emacs version to VERSION in relevant files under ROOT.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 Root must be the root of an Emacs source tree."
40161
795c8ca09f8b (set-version): Use `s' interactive spec for
Gerd Moellmann <gerd@gnu.org>
parents: 40084
diff changeset
79 (interactive "DEmacs root directory: \nsVersion number: ")
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 (error "%s doesn't seem to be the root of an Emacs source tree" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (set-version-in-file root "lisp/version.el" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (rx (and "emacs-version" (0+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 ?\" (submatch (1+ (not (in ?\")))) ?\")))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (set-version-in-file root "README" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 (rx (and "version" (1+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (submatch (1+ (in "0-9."))))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 (set-version-in-file root "man/emacs.texi" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (rx (and "EMACSVER" (1+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (submatch (1+ (in "0-9.")))))))
49298
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
91
89909
68c22ea6027c Sync to HEAD
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
92 ;;; arch-tag: 4ea83636-2293-408b-884e-ad64f22a3bf5
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 ;; admin.el ends here.