From dedfb7f8eebcb436bf1d92014f7f11cacece6ac6 Mon Sep 17 00:00:00 2001 From: Xue Fuqiao Date: Tue, 24 Dec 2013 12:41:18 +0800 Subject: [PATCH] Change some `error's to `user-error's. * admin/admin.el (add-release-logs): (set-version-in-file, set-version, set-copyright): Use `user-error'. --- admin/ChangeLog | 6 ++++++ admin/admin.el | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/admin/ChangeLog b/admin/ChangeLog index 63ed9bfbd6c..40d1e069f03 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,9 @@ +2013-12-24 Xue Fuqiao + + * admin.el (add-release-logs): + (set-version-in-file, set-version, set-copyright): + Use `user-error'. + 2013-12-22 Eli Zaretskii * unidata/unidata-gen.el (unidata-split-name): Don't give any NAME diff --git a/admin/admin.el b/admin/admin.el index f8ca8aec261..228a8570a77 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -21,7 +21,7 @@ ;; add-release-logs Add ``Version X released'' change log entries. ;; set-version Change Emacs version number in source tree. -;; set-copyright Change emacs short copyright string (eg as +;; set-copyright Change Emacs short copyright string (eg as ;; printed by --version) in source tree. ;;; Code: @@ -46,7 +46,7 @@ Optional argument DATE is the release date, default today." (funcall add-log-time-format)))))) (setq root (expand-file-name root)) (unless (file-exists-p (expand-file-name "src/emacs.c" root)) - (error "%s doesn't seem to be the root of an Emacs source tree" root)) + (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) (require 'add-log) (or date (setq date (let ((add-log-time-zone-rule t)) (funcall add-log-time-format)))) @@ -62,10 +62,11 @@ Optional argument DATE is the release date, default today." (insert entry)))) (defun set-version-in-file (root file version rx) + "Subroutine of `set-version'." (find-file (expand-file-name file root)) (goto-char (point-min)) - (unless (re-search-forward rx nil t) - (error "Version not found in %s" file)) + (unless (re-search-forward rx nil :noerror) + (user-error "Version not found in %s" file)) (replace-match (format "%s" version) nil nil nil 1)) (defun set-version (root version) @@ -73,7 +74,7 @@ Optional argument DATE is the release date, default today." Root must be the root of an Emacs source tree." (interactive "DEmacs root directory: \nsVersion number: ") (unless (file-exists-p (expand-file-name "src/emacs.c" root)) - (error "%s doesn't seem to be the root of an Emacs source tree" root)) + (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) (set-version-in-file root "README" version (rx (and "version" (1+ space) (submatch (1+ (in "0-9.")))))) @@ -167,7 +168,7 @@ Root must be the root of an Emacs source tree." (format "Copyright (C) %s Free Software Foundation, Inc." (format-time-string "%Y"))))) (unless (file-exists-p (expand-file-name "src/emacs.c" root)) - (error "%s doesn't seem to be the root of an Emacs source tree" root)) + (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) (set-version-in-file root "configure.ac" copyright (rx (and bol "copyright" (0+ (not (in ?\"))) ?\" (submatch (1+ (not (in ?\")))) ?\"))) -- 2.11.4.GIT