(scheme-in-list): Add a fallback to create an error tag.
[cedet.git] / cedet-update-version.el
blob2d6af1fcbd20f5fb9b0026106afad8511b4cf1b9
1 ;;; cedet-update-version --- Update version numberes in all cedet packages.
3 ;;; Copyright (C) 2005, 2006 Eric M. Ludlam
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
7 ;; This file is not part of GNU Emacs.
9 ;; Semantic is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
14 ;; This software is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
24 ;;; Commentary:
26 ;; Maintaining all these version numbers is a real pain.
27 ;; Try to make it a little bit easier on me.
29 ;; M-x cuv-update RET
31 ;;; History:
32 ;;
34 ;;; Code:
35 (if (not (featurep 'cedet))
36 (error "You need to have cedet loaded to manage the update versions"))
38 (require 'semantic/find)
39 (require 'semantic/decorate)
40 (semantic-mode 1)
41 (global-ede-mode 1)
42 (setq ede-project-directories t)
44 (defun cuv-load-package-file (package)
45 "Get the file name for PACKAGE."
46 (setq package (symbol-name package))
47 (find-library package))
49 (defun cuv-update-package-version (package)
50 "Update the version number for the package PACKAGE."
51 (cuv-load-package-file package)
52 ;; Find the version tag.
53 (let ((tag (car
54 (semantic-find-tags-by-name
55 (concat (symbol-name package) "-version")
56 (current-buffer)))))
57 (goto-char (semantic-tag-start tag))
58 (semantic-momentary-highlight-tag tag))
59 ;; EDE will manage version numbers in files, and also
60 ;; manage updating the Project files.
61 (call-interactively 'ede-update-version)
62 ;; Update Makefiles.
63 (when (y-or-n-p "Update Makefiles from Projects? ")
64 (ede-proj-regenerate)))
66 (defun cuv-update-all-cedet-packages ()
67 "Update all package version numbers one by one."
68 (cuv-load-package-file 'cedet)
69 (let ((p cedet-packages)
70 (cep (current-buffer))
71 (tag (car
72 (semantic-find-tags-by-name "cedet-packages"
73 (current-buffer)))))
74 (while p
75 (cuv-update-package-version (car (car p)))
76 (when (not (eq (car (car p)) 'cedet))
77 ;; Update the constant in cedet.el also!
78 (let* ((eo (ede-toplevel))
79 (v (oref eo :version)))
80 (switch-to-buffer cep)
81 (goto-char (semantic-tag-start tag))
82 (re-search-forward (concat "(" (symbol-name (car (car p))) " +\"")
83 (semantic-tag-end tag))
84 (forward-char -1)
85 (when (y-or-n-p "Update this location also? ")
86 (kill-sexp 1)
87 (insert (format "%S" v))
88 (sit-for 2))
90 (setq p (cdr p)))))
92 (defun cuv-update ()
93 "Interactively update all CEDET features before a release."
94 (interactive)
95 (cuv-update-all-cedet-packages)
96 (message "Revision Number Updates Complete.")
99 (provide 'cedet-update-version)
101 ;;; cedet-update-version.el ends here