diff options
| author | Kim F. Storm | 2005-12-12 14:23:06 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-12-12 14:23:06 +0000 |
| commit | c71abb541e09d65beeb325bdadd3b00caaf8daa9 (patch) | |
| tree | 9475c4cb74afd2b0b879efe34e0e1252a0fbe5c9 | |
| parent | 0900f982ad643535de1e580e048bcea08e075be6 (diff) | |
| download | emacs-c71abb541e09d65beeb325bdadd3b00caaf8daa9.tar.gz emacs-c71abb541e09d65beeb325bdadd3b00caaf8daa9.zip | |
(version-regexp-alist): Allow space as separator before
non-numeric part, e.g. "1.0 alpha".
(version-to-list): Interpret .X.Y version as 0.X.Y version.
| -rw-r--r-- | lisp/subr.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 9b6e122e673..9dce17911d8 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2895,11 +2895,11 @@ Usually the separator is \".\", but it can be any other string.") | |||
| 2895 | 2895 | ||
| 2896 | 2896 | ||
| 2897 | (defvar version-regexp-alist | 2897 | (defvar version-regexp-alist |
| 2898 | '(("^[-_+]?a\\(lpha\\)?$" . -3) | 2898 | '(("^[-_+ ]?a\\(lpha\\)?$" . -3) |
| 2899 | ("^[-_+]$" . -3) ; treat "1.2.3-20050920" and "1.2-3" as alpha releases | 2899 | ("^[-_+]$" . -3) ; treat "1.2.3-20050920" and "1.2-3" as alpha releases |
| 2900 | ("^[-_+]cvs$" . -3) ; treat "1.2.3-CVS" as alpha release | 2900 | ("^[-_+ ]cvs$" . -3) ; treat "1.2.3-CVS" as alpha release |
| 2901 | ("^[-_+]?b\\(eta\\)?$" . -2) | 2901 | ("^[-_+ ]?b\\(eta\\)?$" . -2) |
| 2902 | ("^[-_+]?\\(pre\\|rc\\)$" . -1)) | 2902 | ("^[-_+ ]?\\(pre\\|rc\\)$" . -1)) |
| 2903 | "*Specify association between non-numeric version part and a priority. | 2903 | "*Specify association between non-numeric version part and a priority. |
| 2904 | 2904 | ||
| 2905 | This association is used to handle version string like \"1.0pre2\", | 2905 | This association is used to handle version string like \"1.0pre2\", |
| @@ -2910,10 +2910,10 @@ non-numeric part to an integer. For example: | |||
| 2910 | \"1.0pre2\" (1 0 -1 2) | 2910 | \"1.0pre2\" (1 0 -1 2) |
| 2911 | \"1.0PRE2\" (1 0 -1 2) | 2911 | \"1.0PRE2\" (1 0 -1 2) |
| 2912 | \"22.8beta3\" (22 8 -2 3) | 2912 | \"22.8beta3\" (22 8 -2 3) |
| 2913 | \"22.8Beta3\" (22 8 -2 3) | 2913 | \"22.8 Beta3\" (22 8 -2 3) |
| 2914 | \"0.9alpha1\" (0 9 -3 1) | 2914 | \"0.9alpha1\" (0 9 -3 1) |
| 2915 | \"0.9AlphA1\" (0 9 -3 1) | 2915 | \"0.9AlphA1\" (0 9 -3 1) |
| 2916 | \"0.9alpha\" (0 9 -3) | 2916 | \"0.9 alpha\" (0 9 -3) |
| 2917 | 2917 | ||
| 2918 | Each element has the following form: | 2918 | Each element has the following form: |
| 2919 | 2919 | ||
| @@ -2965,8 +2965,13 @@ As an example of version convertion: | |||
| 2965 | \"0.9alpha\" (0 9 -3) | 2965 | \"0.9alpha\" (0 9 -3) |
| 2966 | 2966 | ||
| 2967 | See documentation for `version-separator' and `version-regexp-alist'." | 2967 | See documentation for `version-separator' and `version-regexp-alist'." |
| 2968 | (or (and (stringp ver) (not (string= ver ""))) | 2968 | (or (and (stringp ver) (> (length ver) 0)) |
| 2969 | (error "Invalid version string: '%s'" ver)) | 2969 | (error "Invalid version string: '%s'" ver)) |
| 2970 | ;; Change .x.y to 0.x.y | ||
| 2971 | (if (and (>= (length ver) (length version-separator)) | ||
| 2972 | (string-equal (substring ver 0 (length version-separator)) | ||
| 2973 | version-separator)) | ||
| 2974 | (setq ver (concat "0" ver))) | ||
| 2970 | (save-match-data | 2975 | (save-match-data |
| 2971 | (let ((i 0) | 2976 | (let ((i 0) |
| 2972 | (case-fold-search t) ; ignore case in matching | 2977 | (case-fold-search t) ; ignore case in matching |