From: Chong Yidong Date: Thu, 10 Mar 2011 21:51:26 +0000 (-0500) Subject: Fix package-strip-rcs-id to be more robust. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~609 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ffbf300e1e88333532721940f8416b54e47ac0e7;p=emacs.git Fix package-strip-rcs-id to be more robust. See http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00396.html * lisp/emacs-lisp/package.el (package-strip-rcs-id): Accept any version string that does not signal an error in version-to-list. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 760224f601c..0fbdd9dff76 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-03-10 Chong Yidong + + * emacs-lisp/package.el (package-strip-rcs-id): Accept any version + string that does not signal an error in version-to-list. + 2011-03-10 Michael Albinus * simple.el (delete-trailing-whitespace): Return nil for the diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index d90164b5a95..29089400cef 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -848,15 +848,17 @@ The package is found on one of the archives in `package-archives'." ;; Try to activate it. (package-initialize)) -(defun package-strip-rcs-id (v-str) - "Strip RCS version ID from the version string. +(defun package-strip-rcs-id (str) + "Strip RCS version ID from the version string STR. If the result looks like a dotted numeric version, return it. Otherwise return nil." - (if v-str - (if (string-match "^[ \t]*[$]Revision:[ \t]\([0-9.]+\)[ \t]*[$]$" v-str) - (match-string 1 v-str) - (if (string-match "^[0-9.]*$" v-str) - v-str)))) + (when str + (when (string-match "\\`[ \t]*[$]Revision:[ \t]+" str) + (setq str (substring str (match-end 0)))) + (condition-case nil + (if (version-to-list str) + str) + (error nil)))) (defun package-buffer-info () "Return a vector describing the package in the current buffer.