annotate admin/admin.el @ 45407:d68629e2728d

* macfns.c (parse_image_spec): Use SYMBOL_NAME and XSTRING instead of XSYMBOL and name field.
author Ken Raeburn <raeburn@raeburn.org>
date Mon, 20 May 2002 08:06:16 +0000
parents 795c8ca09f8b
children bb7bf9ff7c97
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: ")
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (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
53 (let* ((logs (process-lines "find" root "-name" "ChangeLog"))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (entry (format "%s %s <%s>\n\n\t* Version %s released.\n\n"
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 (format-time-string "%Y-%m-%d")
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 (user-full-name) user-mail-address version)))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 (dolist (log logs)
40084
1f20d08b9da5 (add-release-logs): Put the log entry in lispref, too.
Gerd Moellmann <gerd@gnu.org>
parents: 40063
diff changeset
58 (unless (string-match "/gnus/" log)
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (find-file log)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 (insert entry)))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (defun set-version-in-file (root file version rx)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 (find-file (expand-file-name file root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 (unless (re-search-forward rx nil t)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (error "Version not found in %s" file))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (replace-match (format "%s" version) nil nil nil 1))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (defun set-version (root version)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 "Set Emacs version to VERSION in relevant files under ROOT.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 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
75 (interactive "DEmacs root directory: \nsVersion number: ")
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (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
78 (set-version-in-file root "lisp/version.el" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (rx (and "emacs-version" (0+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 ?\" (submatch (1+ (not (in ?\")))) ?\")))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 (set-version-in-file root "README" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (rx (and "version" (1+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (submatch (1+ (in "0-9."))))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (set-version-in-file root "man/emacs.texi" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (rx (and "EMACSVER" (1+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 (submatch (1+ (in "0-9.")))))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 ;; admin.el ends here.